Comments (5)
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.
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:
- Expo Snack
- TypeScript Playground
- GitHub repo under your username
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.
If you want to avoid the error then use BottomTabBarHeightContext
directly instead of the hook.
from react-navigation.
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.
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)
- Drawer headerRight button also opens in the headerLeft. HOT 2
- React native bottom tab bar pushing itself up when opening keyboard HOT 4
- ReactNavigation doesn't build on ReactNative 0.73.5 on iOS (on Android everything is ok) HOT 4
- React native tabview stuck on iOS while switching tabs HOT 4
- Screen presentation type "modal" flickers when opening datepicker on iPhone SE (2022)
- Header focus issue on AndroidTV HOT 1
- 'createDrawerNavigator' is crashing the app
- Height of header with active search input seems to be ignored during back navigation transition on iOS
- 7.0.0-alpha `static` router conditional not working on iOS HOT 6
- Issue unit testing a navigation container (createInteractionHandle is not a function) HOT 4
- Elements with `position: absolute` disappear during screen transition HOT 3
- Crash due to useNativeDriver true for tab animations with android 12 devices HOT 4
- Cannot read property 'name' of undefined in "MaterialTopTabView" HOT 4
- Dropdown and popover components opening at incorrect position in iOS when using default header in React Navigation 6 stack HOT 2
- getState typescript error after version 6.1.10 HOT 2
- Header height not getting calculated in pageY value for components in new architecture HOT 3
- Incorrect pageY value when only using default header of react navigation stack in new architecture HOT 3
- v7 Navigating back randomly causes NAVIGATE action to be dispatched instead of GO_BACK HOT 3
- Possible EventEmitter memory leak detected HOT 2
- Pressable interaction issue with StackNavigator on iPhone Xs + new architecture HOT 8
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-navigation.