-
-
Notifications
You must be signed in to change notification settings - Fork 617
feat(Tabs): add native RTL support for bottom tabs on iOS & Android #3613
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
ahmedawaad1804
wants to merge
13
commits into
software-mansion:main
Choose a base branch
from
ahmedawaad1804:add-bottomtab-rtl-support
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+189
−12
Open
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
1d98498
feat(iOS, Bottom Tabs): add support for direction property in bottom …
aa3b0e1
feat(Android, Tabs): add setDirection method to TabsHostViewManager
75757a2
feat(tests): add Test3598 for bottom tabs configuration and mode swit…
f535729
feat(tests): update Test3598 to reflect direction changes in bottom tabs
8698f29
fix(Tabs): update direction property documentation to include Android…
d197695
refactor(tests): simplify makeTab function in Test3598 by removing co…
0677f36
Merge branch 'main' into add-bottomtab-rtl-support
ahmedawaad1804 9d09301
rename to avoid naming clash, handle badge, refactor native + JS
kligarski a333fcb
change prop name on Android
kligarski 24b3502
simplify example
kligarski 27df8ca
fix Paper setter on iOS
kligarski 0cc64e6
Merge branch 'main' into add-bottomtab-rtl-support
kligarski 1650e24
use trait override on iOS 17+
kligarski File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,64 @@ | ||
| import React from 'react'; | ||
|
|
||
| import { | ||
| BottomTabsContainer, | ||
| type TabConfiguration, | ||
| } from '../../shared/gamma/containers/bottom-tabs/BottomTabsContainer'; | ||
| import { CenteredLayoutView } from '../../shared/CenteredLayoutView'; | ||
| import { I18nManager, Text } from 'react-native'; | ||
|
|
||
| function makeTab(title: string) { | ||
| return function Tab() { | ||
| return ( | ||
| <CenteredLayoutView> | ||
| <Text>{title}</Text> | ||
| <Text style={{ fontWeight: 'bold' }}> | ||
| {'Direction is ' + (I18nManager.isRTL ? 'RTL' : 'LTR')} | ||
| </Text> | ||
| </CenteredLayoutView> | ||
| ); | ||
| }; | ||
| } | ||
|
|
||
| function App() { | ||
| const TAB_CONFIGS: TabConfiguration[] = [ | ||
| { | ||
| tabScreenProps: { | ||
| tabKey: 'Tab1', | ||
| title: 'قائمة ١', | ||
| icon: { | ||
| android: { | ||
| type: 'drawableResource', | ||
| name: 'sym_call_missed', | ||
| }, | ||
| ios: { | ||
| type: 'sfSymbol', | ||
| name: 'sun.max', | ||
| }, | ||
| }, | ||
| }, | ||
| component: makeTab('Tab 1'), | ||
| }, | ||
| { | ||
| tabScreenProps: { | ||
| tabKey: 'Tab2', | ||
| title: 'قائمة ٢', | ||
| icon: { | ||
| android: { | ||
| type: 'drawableResource', | ||
| name: 'sym_call_incoming', | ||
| }, | ||
| ios: { | ||
| type: 'sfSymbol', | ||
| name: 'snow', | ||
| }, | ||
| }, | ||
| }, | ||
| component: makeTab('Tab 2'), | ||
| }, | ||
| ]; | ||
|
|
||
| return <BottomTabsContainer tabConfigs={TAB_CONFIGS} />; | ||
| } | ||
|
|
||
| export default App; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| import { Platform } from 'react-native'; | ||
|
|
||
| export const isIOS26OrHigher = | ||
| Platform.OS === 'ios' && parseInt(Platform.Version, 10) >= 26; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can use
[RCTI18nUtil isRTL]instead of passing a prop, it should have an updated value as it reads it from[NSUserDefaults standardUserDefaults](but it would be unable to react to dynamic changes). I'm not sure if we can consider this a stable API but it has been mentioned in blog post in react-native: https://reactnative.dev/blog/2016/08/19/right-to-left-support-for-react-native-apps.cc @kkafar - let me know what you think is better
We can also leave the prop for now (it's not exposed as a part of API either way) and rethink our approach to RTL in separate PR - I'm wondering whether RTL should be handled via some top-level wrapper component for the entire hierarchy below it.