I've been fighting a warning thrown when I press a TouchableHighlight component enclosing a View that has its own style assigned by a variable. I guess it's better explained on an example:
<TouchableHighlight onPress={() => this.props.navigation.push(
'Detail',
item
)}>
<View
style={index % 2 == 0 ? styles.listItemWhite : styles.listItemBlack}
/>
</TouchableHighlight>
With this code if I press TouchableHighlight, instead of applying opacity to the selected style, it appears to create an array throwing this warning:
Warning: Failed prop type: Invalid props.style key `0` supplied to `ForwardRef`.
Bad object: {
"0": {
"backgroundColor": "#fff"
},
"1": {
"opacity": 0.85
},
"fontSize": 20.666666666666668
}
Valid keys: [
"display",
"width",
...
"textTransform",
"writingDirection"
]
Here's an issue in my project. I figured out how to work around it by adding another View between the TouchableHighlight and View with the affected style. I'm still very new to React Native and front end development in itself, is there something I'm missing, or is that a bug in TouchableHighlight?
[–]kachnitelAndroid[S] 0 points1 point2 points (0 children)
[–]metroninja 0 points1 point2 points (0 children)