feat: add width
prop to Tabs.Container
#208
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
First of all, thank you for a really great library! It deals with some really hard to pull off user interactions!
In an app we're building we get an issue where the window width is miscalulated after having rotated from portrait to landscape and then back to portrait. React native's built in
useWindowDimensions
hook will still return the landscape width even if the app is rotated back to portrait mode.Our specific case is probably quite extraordinary, we actually switch between a portrait UIWindow to a landscape UIWindow and then back. And when we do we still get landscape width which causes parts of the tab view to render outside of the screen. When swiping between tabs the app will crash.
Replacing the
useWindowDimensions
hook withuseSafeAreaFrame
fromreact-native-safe-area-context
solvess this problem entirely.We previously used
useWindowDimensions
in other places in our app but replaced them withuseSafeAreaFrame
and it fixed several issues we've had with wrong or not updating values. Looking through react native github issues it seems other people have similar problems with this hook: #29290 #31692 #30371 #32279I understand that this change introduces a new peer dependency on the project but I really think it's worth it in this case!