okwasniewski / react-native-bottom-tabs

Native Bottom Tabs for React Native
https://okwasniewski.github.io/react-native-bottom-tabs/
MIT License
628 stars 24 forks source link

Implement `preventDefault` for events #73

Closed okwasniewski closed 3 weeks ago

okwasniewski commented 1 month ago

Goal of this PR is to allow users to prevent default on the react navigation events.

React.useEffect(() => {
  const unsubscribe = navigation.addListener('tabPress', (e) => {
    // Prevent default behavior
    e.preventDefault();

    // Do something manually
    // ...
  });

  return unsubscribe;
}, [navigation]);
a-eid commented 3 weeks ago

also for listeners props, we often dos something similar to this

Screenshot 2024-10-31 at 6 51 20 PM
okwasniewski commented 3 weeks ago

Good news!

I've manged to get it working on iOS 🎉 cc: @gunnartorfis

https://github.com/user-attachments/assets/2c153f8d-28f1-4657-95ca-2c006ffa81a0

gunnartorfis commented 3 weeks ago

🔥🔥