Categories
BLOG

loteria font

React Native TouchableHighlight Font Color Text Change

how do TouchableHighlight handles the color of the text when tap. I already did it on the backgroundColor using underLayColor. Here’s my code:

2 Answers 2

I’ve been struggling with this myself. And using onPressIn and onPressOut props of TouchableWithoutFeedback causes a little delay that becomes glitchy if you use that on a component that receives frequent taps. However, that delay doesn’t occur when you use onShowUnderlay and onHideUnderlay props of TouchableHighlight itself.

P.S. your TouchableHighlight component should have an onPress property for this to work.

The TouchableHighlight has all the props of TouchableWithoutFeedback. TouchableWithoutFeedback has the onPressIn and onPressOut props which can receive a function (basically like onMouseDown and onMouseUp). You can use those methods to change a state which will change the style of the text. Here is a working example.

React Native TouchableHighlight Font Color Text Change how do TouchableHighlight handles the color of the text when tap. I already did it on the backgroundColor using underLayColor. Here’s my