Giter Site home page Giter Site logo

Comments (8)

draturi95 avatar draturi95 commented on May 25, 2024 1

@LuamLeite

As edited above,
Since the stack navigator is nested inside the bottom navigator, you get navigation, route objects as props in the stack navigator.

from react-native-curved-bottom-bar.

HardMode2015 avatar HardMode2015 commented on May 25, 2024

same here ...

from react-native-curved-bottom-bar.

masa2el avatar masa2el commented on May 25, 2024

same here ..

from react-native-curved-bottom-bar.

draturi95 avatar draturi95 commented on May 25, 2024

This can be done as below:

  1. Create a tabBarRef for your bottom navigator:
export const tabBarRef = createRef() 

  1. Add it to your bottom navigator:

 <CurvedBottomBar.Navigator
      ref={tabBarRef}
      ...
  >
  ...
  </CurvedBottomBar.Navigator>
  1. In your stack navigator that is nested inside the bottom navigator, import the tabBarRef and add a useFocusEffect that hides the bottom navigator when you are on a route that needs the bottom tab to be hidden. Note that since the stack navigator is nested inside the bottom navigator, you get navigation, route objects as props in the stack navigator.
import { tabBarRef } from 'path-to-bottom-navigator'
import {
  getFocusedRouteNameFromRoute,
  useFocusEffect,
} from '@react-navigation/native'

useFocusEffect(() => {
  const routeName = getFocusedRouteNameFromRoute(route)
  if (
    [
     'route-with-bottom-tab-hidden-1', 
     'route-with-bottom-tab-hidden-2', 
      ...
    ].includes(routeName)
  ) {
    tabBarRef.current.setVisible(false)
  } else {
    tabBarRef.current.setVisible(true)
  }
})

from react-native-curved-bottom-bar.

LuamLeite avatar LuamLeite commented on May 25, 2024

@draturi95 where should I get the route variable from? I did that useFocusEffect inside the definition of the stackNavigator, but couldn't find the route variable.

from react-native-curved-bottom-bar.

jelyqs avatar jelyqs commented on May 25, 2024

@LuamLeite

Hi you, can you share the bottom menu code to handle this problem?

Thank you.

from react-native-curved-bottom-bar.

Tvkaes avatar Tvkaes commented on May 25, 2024

can someone explain better that example or have one done

from react-native-curved-bottom-bar.

xgenem avatar xgenem commented on May 25, 2024

Why do you have to do this when you can have them on the same hierarchy as this tab navigator?

from react-native-curved-bottom-bar.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.