Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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:

<TouchableHighlight
                        style={{ borderRadius: 5}}
                        underlayColor="#ffffff"
                        onPress={this.onLoadPress}>
                            <View style={[styles.buttonBox, styles.btnEditProfile]}>
                                <Text style={styles.btnEditProfileText}>
                                    Edit Profile
                                </Text>
                            </View>
                    </TouchableHighlight>
like image 747
Sydney Loteria Avatar asked Mar 03 '26 07:03

Sydney Loteria


1 Answers

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.

like image 66
Gokhan Sari Avatar answered Mar 04 '26 21:03

Gokhan Sari



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!