Home > Software design >  navigation does not work when imported - React native
navigation does not work when imported - React native

Time:11-15

When I use props.navigation.navigate("example"), it works normally. But if I import the component on another page it doesn't work anymore, props returns an empty object.

Works Fine:

const Menu = props =>{
console.log(props)
return(
       
    <View style={styles.menuStyle}>

        <TouchableOpacity  style={styles.topicDiv} onPress={() =>props.navigation.navigate("Ads")}>
        <View>
           
            <Image style={styles.topicStyle} source={require ("../assets/security-camera.png")}/>
            <Text style={styles.textStyle}>Câmeras</Text>
            <Text style={styles.subTextStyle}>Veja como está a praia ao vivo            
  • Related