0

Function :

  async function ridirect(APIresponse) {
const { navigate } = this.props.navigation;
if(APIresponse.success == true){
  navigate('HomeBottomBar')

}
}

this function was getting error.

1 Answers1

0

It's you're not passing the navigation prop to the component. You could use Navigation Context to pass navigation to the function.

E.g.:

import { NavigationContext } from '@react-navigation/native';

async function ridirect(APIresponse) {
  const contextType = NavigationContext;;
  if(APIresponse.success == true){
    navigate('HomeBottomBar')
  }
}
Finley
  • 166
  • 1
  • 8