i am facing a error callednavigation.dangerouslyGetParent is not a function and its undefined so how can i fix this issue? what can i write in place of dangerouslyGetParent() if its not a function?
` useEffect(() => {
const unsubscribe = navigation.dangerouslyGetParent().addListener('tabPress', e => {
console.log("TAB PRESSED");
if(refPosts.current){
refPosts.current.scrollToIndex({ animated: true, index: 0 });
}
});`
https://reactnavigation.org/docs/upgrading-from-5.x/#dropped-dangerously-from-dangerouslygetparent-and-dangerouslygetstate
React v6
Dropped dangerously fromdangerouslyGetParentanddangerouslyGetStateThedangerouslyGetParentanddangerouslyGetStatemethods on the navigation prop are useful in many scenarios, and sometimes necessary. So we dropped the dangerously prefix to make it clear that it's safe to use. Now you can usenavigation.getParent()andnavigation.getState().
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With