File tree 3 files changed +14
-1
lines changed
3 files changed +14
-1
lines changed Original file line number Diff line number Diff line change 6
6
StyleSheet ,
7
7
} from 'react-native' ;
8
8
9
+ import invert from 'invert-color' ;
10
+
9
11
export default class RNChipPicker extends React . Component {
10
12
render ( ) {
11
13
// Check & set the colour for selected chips.
@@ -38,6 +40,9 @@ export default class RNChipPicker extends React.Component {
38
40
alignSelf : 'stretch' ,
39
41
flexDirection : 'row' ,
40
42
backgroundColor : this . props . backgroundColor ,
43
+ } ,
44
+ innerText : {
45
+ color : invert ( this . props . backgroundColor , true )
41
46
}
42
47
} ) ;
43
48
@@ -59,7 +64,7 @@ export default class RNChipPicker extends React.Component {
59
64
chips . push (
60
65
< TouchableOpacity key = { i } style = { chipStyle } onPress = { ( ) => this . props . onValueSelect ( item ) } >
61
66
< View >
62
- < Text > { item } </ Text >
67
+ < Text style = { style . innerText } > { item } </ Text >
63
68
</ View >
64
69
</ TouchableOpacity >
65
70
) ;
Original file line number Diff line number Diff line change 9
9
"devDependencies" : {
10
10
"react" : " 16.9.0" ,
11
11
"react-native" : " ^0.61.4"
12
+ },
13
+ "dependencies" : {
14
+ "invert-color" : " ^2.0.0"
12
15
}
13
16
}
Original file line number Diff line number Diff line change @@ -2191,6 +2191,11 @@ invariant@^2.2.4:
2191
2191
dependencies :
2192
2192
loose-envify "^1.0.0"
2193
2193
2194
+ invert-color@^2.0.0 :
2195
+ version "2.0.0"
2196
+ resolved "https://registry.yarnpkg.com/invert-color/-/invert-color-2.0.0.tgz#894ab1f7494a6e45f5e74c2f99ec042cd67dd23e"
2197
+ integrity sha512-9s6IATlhOAr0/0MPUpLdMpk81ixIu8IqwPwORssXBauFT/4ff/iyEOcojd0UYuPwkDbJvL1+blIZGhqVIaAm5Q==
2198
+
2194
2199
invert-kv@^1.0.0 :
2195
2200
version "1.0.0"
2196
2201
resolved "https://registry.yarnpkg.com/invert-kv/-/invert-kv-1.0.0.tgz#104a8e4aaca6d3d8cd157a8ef8bfab2d7a3ffdb6"
You can’t perform that action at this time.
0 commit comments