GithubHelp home page GithubHelp logo

Comments (5)

github-actions avatar github-actions commented on April 27, 2024

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

  • @react-navigation/native (found: 6.1.6, latest: 6.1.14)
  • @react-navigation/bottom-tabs (found: 6.5.8, latest: 6.5.16)
  • @react-navigation/stack (found: 6.3.17, latest: 6.3.25)

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

from react-navigation.

github-actions avatar github-actions commented on April 27, 2024

Hey @therealkh! Thanks for opening the issue. It seems that the issue doesn't contain a link to a repro.

The best way to get attention to your issue is to provide an easy way for a developer to reproduce the issue.

You can provide a repro using any of the following:

A snack link is preferred since it's the easiest way to both create and share a repro. If it's not possible to create a repro using a snack, link to a GitHub repo under your username is a good alternative. Don't link to a branch or specific file etc. as it won't be detected.

Try to keep the repro as small as possible by narrowing down the minimal amount of code needed to reproduce the issue. Don't link to your entire project or a project containing code unrelated to the issue. See "How to create a Minimal, Reproducible Example" for more information.

You can edit your original issue to include a link to the repro, or leave it as a comment. The issue will be closed automatically after a while if you don't provide a repro.

from react-navigation.

satya164 avatar satya164 commented on April 27, 2024

If you want to avoid the error then use BottomTabBarHeightContext directly instead of the hook.

from react-navigation.

github-actions avatar github-actions commented on April 27, 2024

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.

from react-navigation.

rexfordessilfie avatar rexfordessilfie commented on April 27, 2024

Hey @therealkh, you can also try this if using the context directly avoids the error, but does not give you the correct heights:

  • From inside a screen/component/hook that is rendered inside the BottomTabBarHeight synchronize the height with an external store that is accessible from where you want

Example (with React Context)
NB: I have left out the definition of the Context + Provider, but it should be simple to setup!

// Use this inside some screen that is rendered inside BottomTabBarHeightContext
function useSynchronizeTabBarHeight(){
    const height = useBottomTabBarHeight()
    const { setTabHeight } = useContext(GlobalTabBarHeightContext)

    // This will only run when the tab bar height changes.
    useEffect(()=>{
        setTabHeight(height)
    }, [height])
}

With the above, you can now use the height from the more global store anywhere you want (but still within the GlobalTabBarHeightContext:

function useCustomCalculation(){
    const { tabBarHeight } = useContext(GlobalTabBarHeightContext)

    // ... Do what you want with the height
}

Small note: The above works, but if you are hyper concerned with performance, or don't need your computations to be reactive to the tab bar height you can use another kind of global store that would not result in re-renders when the globally tracked height changes. Note, the re-renders happen regardless for the children of BottomTabBarHeightContext, I believe, so I don't think it should be much worse. Also throw in a console log in the useEffect to get a sense of how much the height changes in the life-cycle of your application to give you a sense of the re-renders that would be occurring.

from react-navigation.

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.