Home > Net >  Touchableopacity onPress is not working with react navigation
Touchableopacity onPress is not working with react navigation

Time:10-08

how do I use touchable opacity in my code if my next screen is SplashScreen2

<TouchableOpacity
                style={[styles.buttonText]}
                onPress={() => navigation.navigateToScreen("SplashScreen2")}
              >
                <Text style={[styles.buttonContent, { color: "white" }]}>
                  Next
                </Text>
              </TouchableOpacity>

CodePudding user response:

Try this

Change to ->

onPress={() => navigation.navigate('SplashScreen2')}

CodePudding user response:

try this,

    <TouchableOpacity
          style={[styles.buttonText]}
          onPress={() => navigation.navigate("SplashScreen2")} // change navigateToScreen to navigate
    >
          <Text style={[styles.buttonContent, { color: "white" }]}>
            Next
          </Text>
    </TouchableOpacity>
  • Related