Search code examples
react-nativereact-navigation-v6

React Navigation : Current screen also updates when pushing same screen in stack


When i push Posts screen in a stack navigator with query prop, prev screen also updates and all data are same in all screen.

navigation.dispatch(StackActions.push('Posts', { query: { keyword: 'iphone' } }))

or

navigation.push('Posts', { query: { keyword: 'iphone' } })

Any solutions?


React Native: 0.71.x React navigation : ^6.x


Solution

  • Because of @tanstack/react-query@4.^ library i used in my app with react-navigation@6.^, when i push Posts screen, prev screen also changed every time i push. i don't know why but now i use react-native fetch and its works fine.