Quantcast
Channel: Active questions tagged react-native+typescript - Stack Overflow
Viewing all articles
Browse latest Browse all 6314

TouchableOpacity onPress() only one button is working

$
0
0

Not sure why only the first onPress is working, other onPress no response..., just use the same way to wrap the function, but other onPress didn't respond at all

const ToMainScreen = () => {  navigation.navigate('Main')}const AskQuestion = () => {  setQuestionDisplay(true)  console.log("abc")}<TouchableOpacity onPress={ToMainScreen} ><Image    style={styles.homeIcon}    source={require('../image/homeIcon.png')}  /></TouchableOpacity><TouchableOpacity ><Image    style={styles.nextPageIcon}    source={require('../image/nextPage.png',)} /></TouchableOpacity><TouchableOpacity ><Image    style={styles.previousPageIcon}    source={require('../image/previousPage.png',)} /></TouchableOpacity><TouchableOpacity onPress={AskQuestion}><Image    style={styles.questionIcon}    source={require('../image/question.png',)} /></TouchableOpacity>    

Viewing all articles
Browse latest Browse all 6314

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>