Siva2002
Siva2002

Reputation: 1

Touchableopacity onPress is not working with react navigation

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>

Upvotes: 0

Views: 68

Answers (2)

Shivam
Shivam

Reputation: 2359

try this,

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

Upvotes: 1

Arnold Brown
Arnold Brown

Reputation: 1433

Try this

Change to ->

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

Upvotes: 1

Related Questions