功能:
async function ridirect(APIresponse) {
const { navigate } = this.props.navigation;
if(APIresponse.success == true){
navigate('HomeBottomBar')
}
}
这个函数正在出错。
这是因为您没有将导航道具传递给组件。可以使用导航上下文将导航传递给函数。
例如。:
import { NavigationContext } from '@react-navigation/native';
async function ridirect(APIresponse) {
const contextType = NavigationContext;;
if(APIresponse.success == true){
navigate('HomeBottomBar')
}
}