react-navigation / react-navigation

Routing and navigation for your React Native apps
https://reactnavigation.org
23.3k stars 4.97k forks source link

To prevent the default behavior using e.preventDefault() on `tabPress` event is no longer working #11935

Closed vikassharma96 closed 1 month ago

vikassharma96 commented 1 month ago

Current behavior

To prevent the default behavior by calling event.preventDefault() on tabPress event is no longer working for the first time even though it is mentioned in the official documentation @react-navigation/bottom-tabs@^6.5.19

Expected behavior

It should prevent the default behavior for tabPress event after calling event.preventDefault() for the first and subsequent times

Reproduction

https://snack.expo.dev/Hek2xjzn0zFcww-yg0C1L

Platform

Packages

Environment

package version
@react-navigation/native 6.1.10
@react-navigation/bottom-tabs 6.5.19
@react-navigation/native-stack 6.9.18
react-native-safe-area-context 4.9.0
react-native-screens 3.29.0
react-native-gesture-handler 2.16.0
react-native-reanimated 3.8.1
react-native 0.73.4
node 18.19.0
npm or yarn 10.2.3
github-actions[bot] commented 1 month ago

The versions mentioned in the issue for the following packages differ from the latest versions on npm:

Can you verify that the issue still exists after upgrading to the latest versions of these packages?

github-actions[bot] commented 1 month ago

Couldn't find version numbers for the following packages in the issue:

Can you update the issue to include version numbers for those packages? The version numbers must match the format 1.2.3.

The versions mentioned in the issue for the following packages differ from the latest versions on npm:

Can you verify that the issue still exists after upgrading to the latest versions of these packages?

satya164 commented 1 month ago

Screens are only rendered after you navigate to it the first time. Your code for listener isn't called https://reactnavigation.org/docs/bottom-tab-navigator/#lazy

github-actions[bot] commented 1 month ago

Hey! This issue is closed and isn't watched by the core team. You are welcome to discuss the issue with others in this thread, but if you think this issue is still valid and needs to be tracked, please open a new issue with a repro.