React-native onPress does not trigger

Click does not trigger onPress event

clipboard.png

Mar.02,2021

you can take a look at View's document , and you can see that View does not have a callback function called onPress. If you want to add a click event to it, wrap it with TouchableXXX, for example:

<TouchableOpacity  onPress={()=> this.click()}
    <View></View>
</TouchableOpacity>

you want to use TouchableXXX


onPress={() => this.clicks()}

use the arrow function


View there is no onPress event, Text has.

of course, it's best to use those button-related components, such as TouchableOpacity , etc.

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b31245-2b5c1.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b31245-2b5c1.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?