Skip to content

Commit 3360d8b

Browse files
authored
improve perf (#2154)
1 parent 6fe99ef commit 3360d8b

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

src/components/colorSwatch/index.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,7 @@ class ColorSwatch extends PureComponent<Props> {
137137
const {isSelected} = this.state;
138138
const Container = onPress ? TouchableOpacity : View;
139139
const tintColor = this.getTintColor(color);
140+
const accessibilityInfo = Constants.accessibility.isScreenReaderEnabled && this.getAccessibilityInfo();
140141

141142
return (
142143
<Container
@@ -148,7 +149,7 @@ class ColorSwatch extends PureComponent<Props> {
148149
onPress={this.onPress}
149150
style={[this.styles.container, style]}
150151
onLayout={this.onLayout}
151-
{...this.getAccessibilityInfo()}
152+
{...accessibilityInfo}
152153
>
153154
{Colors.isTransparent(color) && (
154155
<Image source={transparentImage} style={this.styles.transparentImage} resizeMode={'cover'}/>

src/style/colorNameMap.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
// adopted from: ntc js (Name that Color JavaScript)
22
// http://chir.ag/projects/ntc
3+
// TODO: change array to object to improve performance
34

45
const colorNameMap = [
56
['000000', 'Black'],

0 commit comments

Comments
 (0)