0

I'm using useHistory for navigate one screen to other .. but here i;m getting issue called TypeError: undefined is not an object (evaluating 'history.push') i dont know what is wrong here..please hlep me thanks in advance

import { useHistory } from "react-router-dom";
 const history = useHistory();

function intiateVideoCall ()  {
 history.push('/ChatFunction');
}

const ChatFunction = ({ navigation }) => {
 <View style={{ flex: 1, alignItems: 'center', justifyContent: 'center' }}>
   <GiftedChat
    messages={messages}
   onSend={messages => handleSendMessage(messages)}
   />
</View>   
}

<TouchableOpacity
    style = {styles.submitButton}
    onPress = {intiateVideoCall}>
  <Text style = {styles.submitButtonText}> Connect </Text>
</TouchableOpacity>

1 Answer 1

1

you can't use react-router-dom on react-native. You can use react-navigation https://reactnavigation.org/docs/getting-started/ or react-router-native https://reactrouter.com/native/guides/quick-start

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.