I cannot put any Font-Awesome Icons inside of TouchableHighlights or Pressable elements.
<TouchableHighlight onPress={someOnPressMethod}>
<FontAwesomeIcon icon={faPlus} color='white'/>
</TouchableHighlight>
If I do so the following error occurs:
ERROR TypeError: Cannot read property 'color' of undefined
This error is located at:
in FontAwesomeIcon (created by Page)
in RCTView (created by View)
in View (created by TouchableHighlight)
in TouchableHighlight (created by TouchableHighlight)
in TouchableHighlight (created by Page)
...
I can add the Icon outside of the TouchableHighlight just fine.
I am thankful for any help!
2
Answers
I guess all FontAwesomeIcons have to be put into Text elements. If i wrap the Icon around a Text element it works just fine
Use
style
property instead.