我在响应导航4中设置了addListener
。
const CurrentBids = ({ navigation }) => {
const { state, getJobdetails } = useContext(Context);
useEffect(() => {
getJobdetails();
const listener = navigation.addListener("didFocus", () => {
getJobdetails();
});
return () => {
listener.remove();
};
}, []);
return (
//something
)
}
,并尝试升级代码以响应导航5 ,
。const CurrentBids = ({ navigation }) => {
const { state, getJobdetails } = useContext(Context);
useEffect(() => {
getJobdetails();
const listener = navigation.addListener("focus", () => {
getJobdetails();
});
return listener;
}, [navigation]);
return (
//something
)
}
我从返回的屏幕上收到Type Error: state.find is not a function
。您是否看到升级片段的问题?谢谢。