Vahid Boreiri 6c3fb8d3e9 Fix some typo issues. (#3852) | 6 年之前 | |
---|---|---|
.. | ||
_images | 6 年之前 | |
api | 6 年之前 | |
docs | 6 年之前 | |
.nojekyll | 7 年之前 | |
README.md | 6 年之前 | |
_sidebar.md | 6 年之前 | |
index.html | 6 年之前 | |
sw.js | 7 年之前 |
We are rebuilding react-native-navigation.
As we are in stage alpha, expect breaking API changes or use a specific version (for example “2.0.1234”)
react-native-navigation has a few issues which are unsolvable in its current architecture. These issues stem from the same problem: you cannot specify on which screen you wish to make an action. Whenever you want to push a screen, show a modal or any other action, the action defaults to originate from your current screen. In most cases this is fine, but becomes problematic in specific edge cases. For example:
There are ways to solve some of these problems in v1 but they are not straightforward. We want to change that.
To solve this problem in v2, every screen receives its componentId
as a prop. Whenever you want to perform an action from that screen you need to pass the componentId
to the function:
Navigator.pop(this.props.componentId)
Another big architectural change is that now you can compose arbitrary native layout hierarchies, and assign a custom id
to each and control them individually.
Currently, it requires a lot of work to accept pull requests. We need to manually make sure that everything works before we approve them because v1 is not thoroughly tested.
v2 is written with contributors in mind from day one.
v2 is written in Test Driven Development. We have a test for every feature including features that are not implemented yet. This makes accepting pull requests extremely easy: If our tests pass, your pull request is accepted.
1) buttons in Android 2) showOverlay in iOS 3) showOverlay in Android 4) async commands 5) currentTab 6) change Options to be nested 7) topTabs in both platforms, with API implications
Top API | iOS | Android |
---|---|---|
setRoot | ✅ | ✅ |
registerComponent | ✅ | ✅ |
component | ✅ | ✅ |
sideMenu | ✅ | ✅ |
tabs | ✅ | ✅ |
External Component | ✅ | ✅ |
splitView | ✅ | Contribute |
Screen API | iOS | Android |
---|---|---|
push | ✅ | ✅ |
pop | ✅ | ✅ |
popToRoot | ✅ | ✅ |
popTo | ✅ | ✅ |
resetTo | ✅ | ✅ |
showModal | ✅ | ✅ |
dismissModal | ✅ | ✅ |
showOverlay | ✅ | ✅ |
dismissOverlay | ✅ | ✅ |
customTransition | ✅ | ✅ |
Screen Visibility | ✅ | ✅ |
async commands (await push) | ✅ | ✅ |
preview | ✅ | :x: |
topBar | iOS | Android |
---|---|---|
title | ✅ | ✅ |
textColor | ✅ | ✅ |
textFontSize | ✅ | ✅ |
textFontFamily | ✅ | ✅ |
backgroundColor | ✅ | ✅ |
buttonColor | ✅ | ✅ |
hidden | ✅ | ✅ |
hideOnScroll | ✅ | ✅ |
translucent | ✅ | Contribute |
transparent | ✅ | Contribute |
noBorder | ✅ | Contribute |
drawUnder | ✅ | ✅ |
blur | ✅ | Contribute |
custom component | ✅ | ✅ |
background component | ✅ | ✅ |
subtitleColor | ✅ | ✅ |
subtitleFontFamily | ✅ | ✅ |
largeTitle (iOS 11) | ✅ | /iOS Specific |
tabBar | iOS | Android |
---|---|---|
drawUnder | ✅ | ✅ |
hidden | ✅ | ✅ |
tabBadge | ✅ | ✅ |
currentTab by Index | ✅ | ✅ |
currentTab by componentId | ✅ | ✅ |
buttons | iOS | Android |
---|---|---|
id | ✅ | ✅ |
testID | ✅ | ✅ |
color | ✅ | ✅ |
icon | ✅ | ✅ |
disableTint | ✅ | ✅ |
fontSize | ✅ | ✅ |
fontWeight | ✅ | /iOS Specific |
statusBar | iOS | Android |
---|---|---|
textColorScheme | ✅ | Contribute |
textColorSchemeSingleScreen | ✅ | / iOS specific |
blur | ✅ | Contribute |
hideWithTopBar | ✅ | Contribute |
hidden | ✅ | Contribute |
other | iOS | Android |
---|---|---|
screenBackgroundColor | ✅ | ✅ |
orientation | ✅ | ✅ |
disabledBackGesture | ✅ | / iOS specific |
screenBackgroundImageName | ✅ | Contribute |
rootBackgroundImageName | ✅ | Contribute |
sideMenuVisible | ✅ | ✅ |
Here is the full comparison of features between v1 and v2 (will be updated regularly):
API | v1 | v2 |
---|---|---|
startTabBasedApp | ✅ | ✅ |
startSinglePageApp | ✅ | ✅ |
registerScreen | ✅ | ✅ |
drawer | ✅ | ✅ |
API | v1 | v2 iOS | v2 Android |
---|---|---|---|
push | ✅ | ✅ | ✅ |
pop | ✅ | ✅ | ✅ |
showModal | ✅ | ✅ | ✅ |
popToRoot | ✅ | ✅ | ✅ |
resetTo | ✅ | ✅ | ✅ |
dismissModal | ✅ | ✅ | ✅ |
dismissAllModals | ✅ | ✅ | ✅ |
showContextualMenu | ✅ | / Android specific | Contribute |
dismissContextualMenu | ✅ | / Androic specific | Contribute |
showFab | ✅ | / Android specific | ✅ |
dismissFab | ✅ | / Android specific | ✅ |
showSnackBar | ✅ | / Android specific | Contribute |
dismissSnackBar | ✅ | / Android specific | Contribute |
showLightBox | ✅ | :x: | :x: |
dismissLightBox | ✅ | :x: | :x: |
showOverlay | :x: | ✅ | ✅ |
dismissOverlay | :x: | ✅ | ✅ |
handleDeepLink | ✅ | Contribute | Contribute |
Screen Visibility | ✅ | ✅ | ✅ |
Note: v1 properties with names beginning with ‘navBar’ are replaced in v2 with properties beginning with ‘topBar’ to avoid confusion with the Android native bottom nav bar.
v1 | v2 iOS | v2 Android | |
---|---|---|---|
topBarTextColor | ✅ | ✅ | ✅ |
topBarTextFontSize | ✅ | ✅ | ✅ |
topBarTextFontFamily | ✅ | ✅ | ✅ |
topBarBackgroundColor | ✅ | ✅ | ✅ |
topBarButtonColor | ✅ | ✅ | ✅ |
topBarHidden | ✅ | ✅ | ✅ |
topBarHideOnScroll | ✅ | ✅ | ✅ |
topBarTranslucent | ✅ | ✅ | Contribute |
topBarTransparent | ✅ | ✅ | Contribute |
topBarNoBorder | ✅ | ✅ | Contribute |
drawUnderTabBar | ✅ | ✅ | ✅ |
drawUnderTopBar | ✅ | ✅ | ✅ |
statusBarBlur | ✅ | ✅ | Contribute |
topBarBlur | ✅ | ✅ | Contribute |
tabBarHidden | ✅ | ✅ | ✅ |
statusBarTextColorScheme | ✅ | ✅ | / iOS specific |
statusBarTextColorSchemeSingleScreen | ✅ | ✅ | / iOS specific |
topBarSubtitleColor | ✅ | ✅ | Contribute |
topBarSubtitleFontFamily | ✅ | ✅ | Contribute |
screenBackgroundColor | ✅ | ✅ | Contribute |
orientation | ✅ | ✅ | ✅ |
statusBarHideWithTopBar | ✅ | ✅ | Contribute |
statusBarHidden | ✅ | ✅ | Contribute |
disabledBackGesture | ✅ | ✅ | / iOS specific |
screenBackgroundImageName | ✅ | ✅ | Contribute |
rootBackgroundImageName | ✅ | ✅ | Contribute |
setButtons | ✅ | ✅ | ✅ |
title | ✅ | ✅ | ✅ |
toggleDrawer | ✅ | ✅ | ✅ |
setTabBadge | ✅ | ✅ | ✅ |
switchToTab | ✅ | ✅ | ✅ |
topBar react component | ✅ | ✅ | ✅ |
Shared Element Transition | :x: | ✅ | Contribute |
splitViewScreen | :x: | ✅ | Contribute |