mirror of
https://github.com/zhigang1992/react-navigation.git
synced 2026-01-12 22:51:18 +08:00
feat: initial version of native stack (#102)
This commit is contained in:
committed by
Satyajit Sahoo
parent
42beb660ca
commit
ba3f718ab3
@@ -8,6 +8,7 @@
|
||||
"@react-navigation/routers",
|
||||
"@react-navigation/compat",
|
||||
"@react-navigation/stack",
|
||||
"@react-navigation/native-stack",
|
||||
"@react-navigation/drawer",
|
||||
"@react-navigation/bottom-tabs",
|
||||
"@react-navigation/material-top-tabs",
|
||||
|
||||
2
.gitignore
vendored
2
.gitignore
vendored
@@ -5,6 +5,8 @@
|
||||
.expo
|
||||
.gradle
|
||||
|
||||
local.properties
|
||||
|
||||
/coverage/
|
||||
/types/
|
||||
/dist/
|
||||
|
||||
@@ -41,8 +41,8 @@
|
||||
"typescript": "^3.6.3"
|
||||
},
|
||||
"resolutions": {
|
||||
"react": "16.8.3",
|
||||
"react-native": "0.59.10"
|
||||
"react": "~16.8.3",
|
||||
"react-native": "~0.59.10"
|
||||
},
|
||||
"husky": {
|
||||
"hooks": {
|
||||
|
||||
@@ -40,8 +40,8 @@
|
||||
"@types/react": "^16.9.4",
|
||||
"@types/react-native": "^0.60.17",
|
||||
"del-cli": "^3.0.0",
|
||||
"react": "16.8.3",
|
||||
"react-native": "0.59.10",
|
||||
"react": "~16.8.3",
|
||||
"react-native": "~0.59.10",
|
||||
"react-native-safe-area-context": "^0.3.6",
|
||||
"typescript": "^3.6.3"
|
||||
},
|
||||
|
||||
@@ -28,12 +28,12 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/react": "^16.9.4",
|
||||
"react": "^16.8.3",
|
||||
"react": "~16.8.3",
|
||||
"typescript": "^3.6.3"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@react-navigation/core": "^5.0.0-alpha.0",
|
||||
"react": "^16.8.3"
|
||||
"react": "~16.8.3"
|
||||
},
|
||||
"@react-native-community/bob": {
|
||||
"source": "src",
|
||||
|
||||
@@ -40,13 +40,13 @@
|
||||
"@types/react": "^16.9.4",
|
||||
"@types/shortid": "^0.0.29",
|
||||
"del-cli": "^3.0.0",
|
||||
"react": "^16.8.3",
|
||||
"react": "~16.8.3",
|
||||
"react-native-testing-library": "^1.9.1",
|
||||
"react-test-renderer": "16.8.3",
|
||||
"react-test-renderer": "~16.8.3",
|
||||
"typescript": "^3.6.3"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"react": "^16.8.3"
|
||||
"react": "~16.8.3"
|
||||
},
|
||||
"@react-native-community/bob": {
|
||||
"source": "src",
|
||||
|
||||
@@ -41,12 +41,12 @@
|
||||
"@types/react": "^16.9.4",
|
||||
"@types/react-native": "^0.60.17",
|
||||
"del-cli": "^3.0.0",
|
||||
"react": "16.8.3",
|
||||
"react-native": "0.59.10",
|
||||
"react": "~16.8.3",
|
||||
"react-native": "~0.59.10",
|
||||
"react-native-gesture-handler": "^1.3.0",
|
||||
"react-native-reanimated": "^1.3.0",
|
||||
"react-native-safe-area-context": "^0.3.6",
|
||||
"react-native-screens": "^1.0.0-alpha.22",
|
||||
"react-native-screens": "^2.0.0-alpha.3",
|
||||
"typescript": "^3.6.3"
|
||||
},
|
||||
"peerDependencies": {
|
||||
@@ -56,7 +56,7 @@
|
||||
"react-native-gesture-handler": "^1.0.0",
|
||||
"react-native-reanimated": "^1.0.0",
|
||||
"react-native-safe-area-context": "^0.3.6",
|
||||
"react-native-screens": "^1.0.0-alpha.0"
|
||||
"react-native-screens": "^1.0.0-alpha.0 || ^2.0.0-alpha.3"
|
||||
},
|
||||
"@react-native-community/bob": {
|
||||
"source": "src",
|
||||
|
||||
@@ -151,6 +151,7 @@
|
||||
<orderEntry type="library" name="Gradle: com.facebook.soloader:soloader:0.6.0@aar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: io.nlopez.smartlocation:library:3.2.11@aar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.facebook.fresco:fbcore:1.10.0@aar" level="project" />
|
||||
<orderEntry type="module" module-name="react-native-screens" />
|
||||
<orderEntry type="module" module-name="react-native-reanimated" />
|
||||
<orderEntry type="module" module-name="react-native-gesture-handler" />
|
||||
<orderEntry type="module" module-name="expo-permissions" />
|
||||
|
||||
@@ -139,6 +139,8 @@ android {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation project(':react-native-safe-area-context')
|
||||
implementation project(':react-native-screens')
|
||||
implementation project(':react-native-reanimated')
|
||||
implementation project(':react-native-gesture-handler')
|
||||
implementation fileTree(dir: "libs", include: ["*.jar"])
|
||||
|
||||
@@ -3,6 +3,8 @@ package com.reactnavigationexample;
|
||||
import android.app.Application;
|
||||
|
||||
import com.facebook.react.ReactApplication;
|
||||
import com.th3rdwave.safeareacontext.SafeAreaContextPackage;
|
||||
import com.swmansion.rnscreens.RNScreensPackage;
|
||||
import com.swmansion.reanimated.ReanimatedPackage;
|
||||
import com.facebook.react.ReactNativeHost;
|
||||
import com.facebook.react.ReactPackage;
|
||||
@@ -39,6 +41,8 @@ public class MainApplication extends Application implements ReactApplication {
|
||||
protected List<ReactPackage> getPackages() {
|
||||
return Arrays.<ReactPackage>asList(
|
||||
new MainReactPackage(),
|
||||
new SafeAreaContextPackage(),
|
||||
new RNScreensPackage(),
|
||||
new ReanimatedPackage(),
|
||||
new RNGestureHandlerPackage(),
|
||||
new ModuleRegistryAdapter(mModuleRegistryProvider)
|
||||
|
||||
@@ -16,3 +16,6 @@
|
||||
# This option should only be used with decoupled projects. More details, visit
|
||||
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
|
||||
# org.gradle.parallel=true
|
||||
|
||||
android.useAndroidX=true
|
||||
android.enableJetifier=true
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
## This file must *NOT* be checked into Version Control Systems,
|
||||
# as it contains information specific to your local configuration.
|
||||
#
|
||||
# Location of the SDK. This is only used by Gradle.
|
||||
# For customization when using a Version Control System, please read the
|
||||
# header note.
|
||||
#Wed Sep 18 15:42:44 CEST 2019
|
||||
sdk.dir=/Users/osdnk/Library/Android/sdk
|
||||
@@ -1,4 +1,8 @@
|
||||
apply from: '../node_modules/react-native-unimodules/gradle.groovy'
|
||||
include ':react-native-safe-area-context'
|
||||
project(':react-native-safe-area-context').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-safe-area-context/android')
|
||||
include ':react-native-screens'
|
||||
project(':react-native-screens').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-screens/android')
|
||||
include ':react-native-reanimated'
|
||||
project(':react-native-reanimated').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-reanimated/android')
|
||||
includeUnimodulesProjects()
|
||||
|
||||
@@ -28,6 +28,9 @@ target 'ReactNavigationExample' do
|
||||
pod 'Folly', :podspec => '../node_modules/react-native/third-party-podspecs/Folly.podspec'
|
||||
pod 'RNGestureHandler', :podspec => '../node_modules/react-native-gesture-handler/RNGestureHandler.podspec'
|
||||
pod 'RNReanimated', :podspec => '../node_modules/react-native-reanimated/RNReanimated.podspec'
|
||||
pod 'RNScreens', :podspec => '../node_modules/react-native-screens/RNScreens.podspec'
|
||||
|
||||
use_unimodules!
|
||||
pod 'react-native-safe-area-context', :path => '../node_modules/react-native-safe-area-context'
|
||||
|
||||
end
|
||||
|
||||
@@ -1,31 +1,31 @@
|
||||
PODS:
|
||||
- boost-for-react-native (1.63.0)
|
||||
- DoubleConversion (1.1.6)
|
||||
- EXAppLoaderProvider (6.0.0)
|
||||
- EXConstants (6.0.0):
|
||||
- EXAppLoaderProvider (7.0.0)
|
||||
- EXConstants (7.0.0):
|
||||
- UMConstantsInterface
|
||||
- UMCore
|
||||
- EXFileSystem (6.0.2):
|
||||
- EXFileSystem (7.0.0):
|
||||
- UMCore
|
||||
- UMFileSystemInterface
|
||||
- EXFont (6.0.1):
|
||||
- EXFont (7.0.0):
|
||||
- UMCore
|
||||
- UMFontInterface
|
||||
- EXKeepAwake (6.0.0):
|
||||
- EXKeepAwake (7.0.0):
|
||||
- UMCore
|
||||
- EXLinearGradient (6.0.0):
|
||||
- EXLinearGradient (7.0.0):
|
||||
- UMCore
|
||||
- EXLocation (6.0.0):
|
||||
- EXLocation (7.0.0):
|
||||
- UMCore
|
||||
- UMPermissionsInterface
|
||||
- UMTaskManagerInterface
|
||||
- EXPermissions (6.0.0):
|
||||
- EXPermissions (7.0.0):
|
||||
- UMCore
|
||||
- UMPermissionsInterface
|
||||
- EXSQLite (6.0.0):
|
||||
- EXSQLite (7.0.0):
|
||||
- UMCore
|
||||
- UMFileSystemInterface
|
||||
- EXWebBrowser (6.0.0):
|
||||
- EXWebBrowser (7.0.1):
|
||||
- UMCore
|
||||
- Folly (2018.10.22.00):
|
||||
- boost-for-react-native
|
||||
@@ -34,6 +34,8 @@ PODS:
|
||||
- glog (0.3.5)
|
||||
- React (0.59.10):
|
||||
- React/Core (= 0.59.10)
|
||||
- react-native-safe-area-context (0.3.6):
|
||||
- React
|
||||
- React/Core (0.59.10):
|
||||
- yoga (= 0.59.10.React)
|
||||
- React/CxxBridge (0.59.10):
|
||||
@@ -91,21 +93,23 @@ PODS:
|
||||
- React
|
||||
- RNReanimated (1.1.0):
|
||||
- React
|
||||
- UMBarCodeScannerInterface (3.0.0)
|
||||
- UMCameraInterface (3.0.0)
|
||||
- UMConstantsInterface (3.0.0)
|
||||
- UMCore (3.0.2)
|
||||
- UMFaceDetectorInterface (3.0.0)
|
||||
- UMFileSystemInterface (3.0.0)
|
||||
- UMFontInterface (3.0.0)
|
||||
- UMImageLoaderInterface (3.0.0)
|
||||
- UMPermissionsInterface (3.0.0)
|
||||
- UMReactNativeAdapter (3.0.0):
|
||||
- RNScreens (2.0.0-alpha.3):
|
||||
- React
|
||||
- UMBarCodeScannerInterface (4.0.0)
|
||||
- UMCameraInterface (4.0.0)
|
||||
- UMConstantsInterface (4.0.0)
|
||||
- UMCore (4.0.0)
|
||||
- UMFaceDetectorInterface (4.0.0)
|
||||
- UMFileSystemInterface (4.0.0)
|
||||
- UMFontInterface (4.0.0)
|
||||
- UMImageLoaderInterface (4.0.0)
|
||||
- UMPermissionsInterface (4.0.0)
|
||||
- UMReactNativeAdapter (5.0.0-alpha.0):
|
||||
- React
|
||||
- UMCore
|
||||
- UMFontInterface
|
||||
- UMSensorsInterface (3.0.0)
|
||||
- UMTaskManagerInterface (3.0.0)
|
||||
- UMSensorsInterface (4.0.0)
|
||||
- UMTaskManagerInterface (4.0.0)
|
||||
- yoga (0.59.10.React)
|
||||
|
||||
DEPENDENCIES:
|
||||
@@ -122,6 +126,7 @@ DEPENDENCIES:
|
||||
- EXWebBrowser (from `../node_modules/expo-web-browser/ios`)
|
||||
- Folly (from `../node_modules/react-native/third-party-podspecs/Folly.podspec`)
|
||||
- glog (from `../node_modules/react-native/third-party-podspecs/glog.podspec`)
|
||||
- react-native-safe-area-context (from `../node_modules/react-native-safe-area-context`)
|
||||
- React/Core (from `../node_modules/react-native`)
|
||||
- React/CxxBridge (from `../node_modules/react-native`)
|
||||
- React/DevSupport (from `../node_modules/react-native`)
|
||||
@@ -138,6 +143,7 @@ DEPENDENCIES:
|
||||
- React/RCTWebSocket (from `../node_modules/react-native`)
|
||||
- RNGestureHandler (from `../node_modules/react-native-gesture-handler/RNGestureHandler.podspec`)
|
||||
- RNReanimated (from `../node_modules/react-native-reanimated/RNReanimated.podspec`)
|
||||
- RNScreens (from `../node_modules/react-native-screens/RNScreens.podspec`)
|
||||
- UMBarCodeScannerInterface (from `../node_modules/unimodules-barcode-scanner-interface/ios`)
|
||||
- UMCameraInterface (from `../node_modules/unimodules-camera-interface/ios`)
|
||||
- UMConstantsInterface (from `../node_modules/unimodules-constants-interface/ios`)
|
||||
@@ -147,7 +153,7 @@ DEPENDENCIES:
|
||||
- UMFontInterface (from `../node_modules/unimodules-font-interface/ios`)
|
||||
- UMImageLoaderInterface (from `../node_modules/unimodules-image-loader-interface/ios`)
|
||||
- UMPermissionsInterface (from `../node_modules/unimodules-permissions-interface/ios`)
|
||||
- "UMReactNativeAdapter (from `../node_modules/@unimodules/react-native-adapter/ios`)"
|
||||
- "UMReactNativeAdapter (from `../node_modules/react-native-unimodules/node_modules/@unimodules/react-native-adapter/ios`)"
|
||||
- UMSensorsInterface (from `../node_modules/unimodules-sensors-interface/ios`)
|
||||
- UMTaskManagerInterface (from `../node_modules/unimodules-task-manager-interface/ios`)
|
||||
- yoga (from `../node_modules/react-native/ReactCommon/yoga`)
|
||||
@@ -195,10 +201,14 @@ EXTERNAL SOURCES:
|
||||
:podspec: "../node_modules/react-native/third-party-podspecs/glog.podspec"
|
||||
React:
|
||||
:path: "../node_modules/react-native"
|
||||
react-native-safe-area-context:
|
||||
:path: "../node_modules/react-native-safe-area-context"
|
||||
RNGestureHandler:
|
||||
:podspec: "../node_modules/react-native-gesture-handler/RNGestureHandler.podspec"
|
||||
RNReanimated:
|
||||
:podspec: "../node_modules/react-native-reanimated/RNReanimated.podspec"
|
||||
RNScreens:
|
||||
:podspec: "../node_modules/react-native-screens/RNScreens.podspec"
|
||||
UMBarCodeScannerInterface:
|
||||
:path: !ruby/object:Pathname
|
||||
path: "../node_modules/unimodules-barcode-scanner-interface/ios"
|
||||
@@ -228,7 +238,7 @@ EXTERNAL SOURCES:
|
||||
path: "../node_modules/unimodules-permissions-interface/ios"
|
||||
UMReactNativeAdapter:
|
||||
:path: !ruby/object:Pathname
|
||||
path: "../node_modules/@unimodules/react-native-adapter/ios"
|
||||
path: "../node_modules/react-native-unimodules/node_modules/@unimodules/react-native-adapter/ios"
|
||||
UMSensorsInterface:
|
||||
:path: !ruby/object:Pathname
|
||||
path: "../node_modules/unimodules-sensors-interface/ios"
|
||||
@@ -241,35 +251,37 @@ EXTERNAL SOURCES:
|
||||
SPEC CHECKSUMS:
|
||||
boost-for-react-native: 39c7adb57c4e60d6c5479dd8623128eb5b3f0f2c
|
||||
DoubleConversion: bb338842f62ab1d708ceb63ec3d999f0f3d98ecd
|
||||
EXAppLoaderProvider: 7a8185228d8ba9e689a0e2d6d957fe9bdd49c8a0
|
||||
EXConstants: 5d81e84ca71b9a552529889cc798b4a04e9e22b3
|
||||
EXFileSystem: 091907902fcec9f9182b656fdead41a82f30986a
|
||||
EXFont: c862449210fc86aa11d24a202cb22c71a0d39609
|
||||
EXKeepAwake: e7cb6516675052b12a7d23291e33078b4239653a
|
||||
EXLinearGradient: 40781b77e58f844c8dc4ad310dc9755b4d3792a7
|
||||
EXLocation: 4eb76115832f08b1e78003b335c210e18fa60424
|
||||
EXPermissions: 99e52dc3e5f8e55153f1958004f6df2a30a1f2f5
|
||||
EXSQLite: 8dab6a5ab1b78be7925073d6071eb22095d4dda6
|
||||
EXWebBrowser: def838b95aa9d396f9ce71ace4e614ee16e7ee30
|
||||
EXAppLoaderProvider: 5d348813a9cf09b03bbe5b8b55437bc1bfbddbd1
|
||||
EXConstants: 31e5318521be6175009af6ccd3e97dedf39da96a
|
||||
EXFileSystem: 7e53a2c30a2eb6987ba6d5158ab908f947523228
|
||||
EXFont: 71d07dc5d2153db7d1a23f1e0cc1b6341d55c432
|
||||
EXKeepAwake: d4caf9a1a7691126ade4ca0b76592e93250a8f29
|
||||
EXLinearGradient: ebfd46cb98a46330213e4945b96227d98f624054
|
||||
EXLocation: 452a1d9edceb1b93deb86fd785236606d33742dd
|
||||
EXPermissions: df10ad83df2f6b647aec304619354f8ab48d5f63
|
||||
EXSQLite: ddc1e6727bd7d36e649f07590fe3ae5511c1f039
|
||||
EXWebBrowser: 18924c3d2a3a1aa95d413672f058beff589c80f4
|
||||
Folly: de497beb10f102453a1afa9edbf8cf8a251890de
|
||||
glog: aefd1eb5dda2ab95ba0938556f34b98e2da3a60d
|
||||
React: 36d0768f9e93be2473b37e7fa64f92c1d5341eef
|
||||
react-native-safe-area-context: e380a6f783ccaec848e2f3cc8eb205a62362950d
|
||||
RNGestureHandler: 5329a942fce3d41c68b84c2c2276ce06a696d8b0
|
||||
RNReanimated: 7a52c90473b5e81c13408d40d797b98387eaddde
|
||||
UMBarCodeScannerInterface: 84ea2d6b58ff0dc27ef9b68bab71286be18ee020
|
||||
UMCameraInterface: 26b26005d1756a0d5f4f04f1e168e39ea9154535
|
||||
UMConstantsInterface: 038bacb19de12b6fd328c589122c8dc977cccf61
|
||||
UMCore: 733094f43f7244c60ce1f0592d00013ed68fa52c
|
||||
UMFaceDetectorInterface: c9c3ae4cb045421283667a1698c2f31331f55e3f
|
||||
UMFileSystemInterface: e9adc71027017de38eaf7d05fa58b2848ecb3797
|
||||
UMFontInterface: f0c5846977ee8a93d7cfa8ae7e666772c727d195
|
||||
UMImageLoaderInterface: 36e54e570acc4d720856f03ceebc441f73ea472c
|
||||
UMPermissionsInterface: 938d010c74c43fcefc9bb990633a7c5a1631267e
|
||||
UMReactNativeAdapter: 131ea2b944ade8035f0b54c6570c405f6000548d
|
||||
UMSensorsInterface: 0ed023ce9b96f2ca6fada7bda05b7760da60b293
|
||||
UMTaskManagerInterface: 8664abd37a00715727e60df9ecd65e42ba47b548
|
||||
RNScreens: 402a99b0a27c0c32f079cec12d3ccbd35e20cd7f
|
||||
UMBarCodeScannerInterface: d5a6fdc98ed6241225b0a8432a7f4e2b397668bc
|
||||
UMCameraInterface: 68870a3197fee85bd5afca5609ba4a5b7257d19d
|
||||
UMConstantsInterface: d25b8e8887ca7aaf568c06caf08f4d40734ee4ef
|
||||
UMCore: 402cee150324974974f5c32b5404d8af65e4cff5
|
||||
UMFaceDetectorInterface: 7b4f1a92f0c726b58b086296048efe193b570678
|
||||
UMFileSystemInterface: aadb9a67aa6470d7ebc06cf04dc54fee6781ac48
|
||||
UMFontInterface: 2d3c128285086bbed3d2a650f1d698323ef3b25a
|
||||
UMImageLoaderInterface: 2829a7571a12d2e754c73c55ffe7e327d8402c7d
|
||||
UMPermissionsInterface: b6a6e96db0f4011a25aaca14e6022529dd3d6e4e
|
||||
UMReactNativeAdapter: e93109c6de5ea830d4a78d08f3a65b8d33a143a3
|
||||
UMSensorsInterface: cf59dd7602764a2419e00167429be3e4be39c61d
|
||||
UMTaskManagerInterface: 1e70fe58b872355f0ecb44fb81bb1a16484047f0
|
||||
yoga: 684513b14b03201579ba3cee20218c9d1298b0cc
|
||||
|
||||
PODFILE CHECKSUM: 41592ff50a43d56f905dbf9c7eded4b358264eba
|
||||
PODFILE CHECKSUM: 1276a2dd000c142ccc03272023bb8a6b2d5b9933
|
||||
|
||||
COCOAPODS: 1.7.5
|
||||
|
||||
@@ -13,7 +13,8 @@
|
||||
"start": "expo start",
|
||||
"native": "react-native start",
|
||||
"android": "react-native run-android",
|
||||
"ios": "react-native run-ios"
|
||||
"ios": "react-native run-ios",
|
||||
"postinstall": "jetify"
|
||||
},
|
||||
"dependencies": {
|
||||
"@expo/vector-icons": "^10.0.0",
|
||||
@@ -21,14 +22,14 @@
|
||||
"expo": "^35.0.0",
|
||||
"expo-asset": "~7.0.0",
|
||||
"query-string": "^6.8.3",
|
||||
"react": "^16.8.3",
|
||||
"react-dom": "^16.8.3",
|
||||
"react-native": "^0.59.10",
|
||||
"react": "~16.8.3",
|
||||
"react-dom": "~16.8.3",
|
||||
"react-native": "~0.59.10",
|
||||
"react-native-gesture-handler": "~1.3.0",
|
||||
"react-native-paper": "^3.0.0-alpha.3",
|
||||
"react-native-reanimated": "~1.2.0",
|
||||
"react-native-safe-area-context": "~0.3.6",
|
||||
"react-native-screens": "~1.0.0-alpha.23",
|
||||
"react-native-screens": "2.0.0-alpha.3",
|
||||
"react-native-tab-view": "2.10.0",
|
||||
"react-native-unimodules": "^0.7.0-rc.1",
|
||||
"scheduler": "^0.16.1",
|
||||
@@ -41,6 +42,7 @@
|
||||
"@types/react-native": "^0.60.17",
|
||||
"babel-preset-expo": "^7.0.0",
|
||||
"expo-cli": "^3.1.2",
|
||||
"jetifier": "^1.6.4",
|
||||
"typescript": "^3.6.3"
|
||||
}
|
||||
}
|
||||
|
||||
23
packages/example/src/Screens/NativeStack.expo.tsx
Normal file
23
packages/example/src/Screens/NativeStack.expo.tsx
Normal file
@@ -0,0 +1,23 @@
|
||||
import * as React from 'react';
|
||||
import { View, Text, StyleSheet } from 'react-native';
|
||||
|
||||
export default function NativeStack() {
|
||||
return (
|
||||
<View style={styles.container}>
|
||||
<Text style={styles.text}>Currently not supported on Expo :(</Text>
|
||||
</View>
|
||||
);
|
||||
}
|
||||
|
||||
const styles = StyleSheet.create({
|
||||
container: {
|
||||
flex: 1,
|
||||
alignItems: 'center',
|
||||
justifyContent: 'center',
|
||||
backgroundColor: '#eceff1',
|
||||
},
|
||||
text: {
|
||||
fontSize: 16,
|
||||
color: '#999',
|
||||
},
|
||||
});
|
||||
117
packages/example/src/Screens/NativeStack.tsx
Normal file
117
packages/example/src/Screens/NativeStack.tsx
Normal file
@@ -0,0 +1,117 @@
|
||||
import * as React from 'react';
|
||||
import { View, StyleSheet } from 'react-native';
|
||||
import { Button } from 'react-native-paper';
|
||||
// eslint-disable-next-line import/no-unresolved
|
||||
import { useScreens } from 'react-native-screens';
|
||||
import { RouteProp, ParamListBase } from '@react-navigation/core';
|
||||
import { StackNavigationProp } from '@react-navigation/stack';
|
||||
import {
|
||||
createNativeStackNavigator,
|
||||
NativeStackNavigationProp,
|
||||
} from '@react-navigation/native-stack';
|
||||
import Article from '../Shared/Article';
|
||||
import Albums from '../Shared/Albums';
|
||||
|
||||
type NativeStackParams = {
|
||||
article: { author: string };
|
||||
album: undefined;
|
||||
};
|
||||
|
||||
type NativeStackNavigation = NativeStackNavigationProp<NativeStackParams>;
|
||||
|
||||
const ArticleScreen = ({
|
||||
navigation,
|
||||
route,
|
||||
}: {
|
||||
navigation: NativeStackNavigation;
|
||||
route: RouteProp<NativeStackParams, 'article'>;
|
||||
}) => (
|
||||
<React.Fragment>
|
||||
<View style={styles.buttons}>
|
||||
<Button
|
||||
mode="contained"
|
||||
onPress={() => navigation.push('album')}
|
||||
style={styles.button}
|
||||
>
|
||||
Push album
|
||||
</Button>
|
||||
<Button
|
||||
mode="outlined"
|
||||
onPress={() => navigation.goBack()}
|
||||
style={styles.button}
|
||||
>
|
||||
Go back
|
||||
</Button>
|
||||
</View>
|
||||
<Article author={{ name: route.params.author }} />
|
||||
</React.Fragment>
|
||||
);
|
||||
|
||||
const AlbumsScreen = ({
|
||||
navigation,
|
||||
}: {
|
||||
navigation: NativeStackNavigation;
|
||||
}) => (
|
||||
<React.Fragment>
|
||||
<View style={styles.buttons}>
|
||||
<Button
|
||||
mode="contained"
|
||||
onPress={() => navigation.push('article', { author: 'Babel fish' })}
|
||||
style={styles.button}
|
||||
>
|
||||
Push article
|
||||
</Button>
|
||||
<Button
|
||||
mode="outlined"
|
||||
onPress={() => navigation.goBack()}
|
||||
style={styles.button}
|
||||
>
|
||||
Go back
|
||||
</Button>
|
||||
</View>
|
||||
<Albums />
|
||||
</React.Fragment>
|
||||
);
|
||||
|
||||
const NativeStack = createNativeStackNavigator<NativeStackParams>();
|
||||
|
||||
type Props = {
|
||||
navigation: StackNavigationProp<ParamListBase>;
|
||||
};
|
||||
|
||||
export default function NativeStackScreen({ navigation }: Props) {
|
||||
navigation.setOptions({
|
||||
headerShown: false,
|
||||
});
|
||||
|
||||
return (
|
||||
<NativeStack.Navigator>
|
||||
<NativeStack.Screen
|
||||
name="article"
|
||||
component={ArticleScreen}
|
||||
options={({ route }) => ({
|
||||
title: `Article by ${route.params.author}`,
|
||||
})}
|
||||
initialParams={{ author: 'Gandalf' }}
|
||||
/>
|
||||
<NativeStack.Screen
|
||||
name="album"
|
||||
component={AlbumsScreen}
|
||||
options={{ title: 'Album' }}
|
||||
/>
|
||||
</NativeStack.Navigator>
|
||||
);
|
||||
}
|
||||
|
||||
// eslint-disable-next-line react-hooks/rules-of-hooks
|
||||
useScreens(true);
|
||||
|
||||
const styles = StyleSheet.create({
|
||||
buttons: {
|
||||
flexDirection: 'row',
|
||||
padding: 8,
|
||||
},
|
||||
button: {
|
||||
margin: 8,
|
||||
},
|
||||
});
|
||||
@@ -5,6 +5,7 @@ import { RouteProp, ParamListBase } from '@react-navigation/core';
|
||||
import {
|
||||
createStackNavigator,
|
||||
StackNavigationProp,
|
||||
StackNavigationOptions,
|
||||
} from '@react-navigation/stack';
|
||||
import Article from '../Shared/Article';
|
||||
import Albums from '../Shared/Albums';
|
||||
@@ -77,7 +78,7 @@ const AlbumsScreen = ({
|
||||
const SimpleStack = createStackNavigator<SimpleStackParams>();
|
||||
|
||||
type Props = {
|
||||
options?: React.ComponentProps<typeof SimpleStack.Navigator>;
|
||||
options?: StackNavigationOptions;
|
||||
navigation: StackNavigationProp<ParamListBase>;
|
||||
};
|
||||
|
||||
|
||||
@@ -28,6 +28,10 @@ export default function Albums() {
|
||||
// eslint-disable-next-line react/no-array-index-key
|
||||
<Image key={i} source={source} style={styles.cover} />
|
||||
))}
|
||||
{COVERS.map((source, i) => (
|
||||
// eslint-disable-next-line react/no-array-index-key
|
||||
<Image key={i + 'F'} source={source} style={styles.cover} />
|
||||
))}
|
||||
</ScrollView>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -23,6 +23,7 @@ import {
|
||||
} from '@react-navigation/stack';
|
||||
|
||||
import SimpleStack from './Screens/SimpleStack';
|
||||
import NativeStack from './Screens/NativeStack';
|
||||
import ModalPresentationStack from './Screens/ModalPresentationStack';
|
||||
import BottomTabs from './Screens/BottomTabs';
|
||||
import MaterialTopTabsScreen from './Screens/MaterialTopTabs';
|
||||
@@ -44,6 +45,7 @@ type RootStackParamList = {
|
||||
|
||||
const SCREENS = {
|
||||
SimpleStack: { title: 'Simple Stack', component: SimpleStack },
|
||||
NativeStack: { title: 'Native Stack', component: NativeStack },
|
||||
ModalPresentationStack: {
|
||||
title: 'Modal Presentation Stack',
|
||||
component: ModalPresentationStack,
|
||||
|
||||
@@ -42,8 +42,8 @@
|
||||
"@types/react-native": "^0.60.17",
|
||||
"@types/react-native-vector-icons": "^6.4.4",
|
||||
"del-cli": "^3.0.0",
|
||||
"react": "16.8.3",
|
||||
"react-native": "0.59.10",
|
||||
"react": "~16.8.3",
|
||||
"react-native": "~0.59.10",
|
||||
"react-native-paper": "^3.0.0-alpha.3",
|
||||
"react-native-vector-icons": "^6.6.0",
|
||||
"typescript": "^3.6.3"
|
||||
|
||||
@@ -41,8 +41,8 @@
|
||||
"@types/react": "^16.9.4",
|
||||
"@types/react-native": "^0.60.17",
|
||||
"del-cli": "^3.0.0",
|
||||
"react": "16.8.3",
|
||||
"react-native": "^0.59.10",
|
||||
"react": "~16.8.3",
|
||||
"react-native": "~0.59.10",
|
||||
"react-native-gesture-handler": "^1.3.0",
|
||||
"react-native-reanimated": "^1.3.0",
|
||||
"react-native-tab-view": "^2.10.0",
|
||||
|
||||
4
packages/native-stack/CHANGELOG.md
Normal file
4
packages/native-stack/CHANGELOG.md
Normal file
@@ -0,0 +1,4 @@
|
||||
# Change Log
|
||||
|
||||
All notable changes to this project will be documented in this file.
|
||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||
64
packages/native-stack/README.md
Normal file
64
packages/native-stack/README.md
Normal file
@@ -0,0 +1,64 @@
|
||||
# `@react-navigation/native-stack`
|
||||
|
||||
Stack navigator for React Native using native primitives for navigation. Uses [`react-native-screens`](https://github.com/kmagiera/react-native-screens) under the hood.
|
||||
|
||||
Expo is currently not supported as it includes an older version of `react-native-screens`.
|
||||
|
||||
## Installation
|
||||
|
||||
Open a Terminal in your project's folder and run,
|
||||
|
||||
```sh
|
||||
yarn add @react-navigation/core @react-navigation/native-stack
|
||||
```
|
||||
|
||||
Now we need to install [`react-native-screens`](https://github.com/kmagiera/react-native-screens).
|
||||
|
||||
```sh
|
||||
yarn add react-native-screens
|
||||
```
|
||||
|
||||
To complete the linking on iOS, make sure you have [Cocoapods](https://cocoapods.org/) installed. Then run:
|
||||
|
||||
```sh
|
||||
cd ios
|
||||
pod install
|
||||
cd ..
|
||||
```
|
||||
|
||||
To finalize installation of `react-native-screens` for Android, add the following two lines to dependencies section in `android/app/build.gradle`:
|
||||
|
||||
```gradle
|
||||
implementation 'androidx.appcompat:appcompat:1.1.0-rc01'
|
||||
implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0-alpha02'
|
||||
```
|
||||
|
||||
Make sure to enable `react-native-screens`. This needs to be done before our app renders. To do it, add the following code in your entry file (e.g. `App.js`):
|
||||
|
||||
```js
|
||||
import { useScreens } from 'react-native-screens';
|
||||
|
||||
useScreens();
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
import { createNativeStackNavigator } from '@react-navigation/native-stack';
|
||||
|
||||
const Stack = createNativeStackNavigator();
|
||||
|
||||
export default function App() {
|
||||
return (
|
||||
<Stack.Navigator>
|
||||
<Stack.Screen name="home" component={Home} options={{ title: 'Home' }} />
|
||||
<Stack.Screen name="feed" component={Feed} options={{ title: 'Feed' }} />
|
||||
<Stack.Screen
|
||||
name="profile"
|
||||
component={Profile}
|
||||
options={{ title: 'Profile' }}
|
||||
/>
|
||||
</Stack.Navigator>
|
||||
);
|
||||
}
|
||||
```
|
||||
55
packages/native-stack/package.json
Normal file
55
packages/native-stack/package.json
Normal file
@@ -0,0 +1,55 @@
|
||||
{
|
||||
"name": "@react-navigation/native-stack",
|
||||
"description": "Native stack navigator component for iOS and Android",
|
||||
"keywords": [
|
||||
"react",
|
||||
"react-native",
|
||||
"react-navigation"
|
||||
],
|
||||
"version": "5.0.0-alpha.0",
|
||||
"license": "MIT",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/react-navigation/navigation-ex.git",
|
||||
"directory": "packages/native-stack"
|
||||
},
|
||||
"main": "lib/commonjs/index.js",
|
||||
"react-native": "src/index.tsx",
|
||||
"module": "lib/module/index.js",
|
||||
"types": "lib/typescript/native-stack/src/index.d.ts",
|
||||
"files": [
|
||||
"src",
|
||||
"lib"
|
||||
],
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"scripts": {
|
||||
"prepare": "bob build",
|
||||
"clean": "del lib"
|
||||
},
|
||||
"dependencies": {
|
||||
"@react-navigation/routers": "^5.0.0-alpha.9"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@react-native-community/bob": "^0.7.0",
|
||||
"del-cli": "^2.0.0",
|
||||
"react-native-screens": "^2.0.0-alpha.3",
|
||||
"typescript": "^3.5.3"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@react-navigation/core": "^5.0.0-alpha.0",
|
||||
"react": "*",
|
||||
"react-native": "*",
|
||||
"react-native-screens": "^2.0.0-alpha.3"
|
||||
},
|
||||
"@react-native-community/bob": {
|
||||
"source": "src",
|
||||
"output": "lib",
|
||||
"targets": [
|
||||
"commonjs",
|
||||
"module",
|
||||
"typescript"
|
||||
]
|
||||
}
|
||||
}
|
||||
14
packages/native-stack/src/index.tsx
Normal file
14
packages/native-stack/src/index.tsx
Normal file
@@ -0,0 +1,14 @@
|
||||
/**
|
||||
* Navigators
|
||||
*/
|
||||
export {
|
||||
default as createNativeStackNavigator,
|
||||
} from './navigators/createNativeStackNavigator';
|
||||
|
||||
/**
|
||||
* Types
|
||||
*/
|
||||
export {
|
||||
NativeStackNavigationOptions,
|
||||
NativeStackNavigationProp,
|
||||
} from './types';
|
||||
@@ -0,0 +1,52 @@
|
||||
import React from 'react';
|
||||
import { createNavigator, useNavigationBuilder } from '@react-navigation/core';
|
||||
|
||||
import {
|
||||
StackRouter,
|
||||
StackNavigationState,
|
||||
StackRouterOptions,
|
||||
} from '@react-navigation/routers';
|
||||
|
||||
import {
|
||||
screensEnabled,
|
||||
// eslint-disable-next-line import/no-unresolved
|
||||
} from 'react-native-screens';
|
||||
import StackView from '../views/StackView';
|
||||
import {
|
||||
NativeStackNavigatorProps,
|
||||
NativeStackNavigationOptions,
|
||||
} from '../types';
|
||||
|
||||
function NativeStackNavigator(props: NativeStackNavigatorProps) {
|
||||
if (!screensEnabled()) {
|
||||
throw new Error(
|
||||
'Native stack is only available if React Native Screens is enabled.'
|
||||
);
|
||||
}
|
||||
|
||||
const { initialRouteName, children, screenOptions, ...rest } = props;
|
||||
const { state, descriptors, navigation } = useNavigationBuilder<
|
||||
StackNavigationState,
|
||||
StackRouterOptions,
|
||||
NativeStackNavigationOptions,
|
||||
{}
|
||||
>(StackRouter, {
|
||||
initialRouteName,
|
||||
children,
|
||||
screenOptions,
|
||||
});
|
||||
|
||||
return (
|
||||
<StackView
|
||||
state={state}
|
||||
navigation={navigation}
|
||||
descriptors={descriptors}
|
||||
{...rest}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
export default createNavigator<
|
||||
NativeStackNavigationOptions,
|
||||
typeof NativeStackNavigator
|
||||
>(NativeStackNavigator);
|
||||
160
packages/native-stack/src/types.tsx
Normal file
160
packages/native-stack/src/types.tsx
Normal file
@@ -0,0 +1,160 @@
|
||||
import * as React from 'react';
|
||||
import { StyleProp, ViewStyle } from 'react-native';
|
||||
import {
|
||||
DefaultNavigatorOptions,
|
||||
Descriptor,
|
||||
NavigationHelpers,
|
||||
NavigationProp,
|
||||
ParamListBase,
|
||||
} from '@react-navigation/core';
|
||||
import {
|
||||
StackNavigationState,
|
||||
StackRouterOptions,
|
||||
} from '@react-navigation/routers';
|
||||
|
||||
export type NativeStackNavigationProp<
|
||||
ParamList extends ParamListBase,
|
||||
RouteName extends keyof ParamList = string
|
||||
> = NavigationProp<
|
||||
ParamList,
|
||||
RouteName,
|
||||
StackNavigationState,
|
||||
NativeStackNavigationOptions,
|
||||
{}
|
||||
> & {
|
||||
/**
|
||||
* Push a new screen onto the stack.
|
||||
*
|
||||
* @param name Name of the route for the tab.
|
||||
* @param [params] Params object for the route.
|
||||
*/
|
||||
push<RouteName extends keyof ParamList>(
|
||||
...args: ParamList[RouteName] extends (undefined | any)
|
||||
? [RouteName] | [RouteName, ParamList[RouteName]]
|
||||
: [RouteName, ParamList[RouteName]]
|
||||
): void;
|
||||
|
||||
/**
|
||||
* Pop a screen from the stack.
|
||||
*/
|
||||
pop(count?: number): void;
|
||||
|
||||
/**
|
||||
* Pop to the first route in the stack, dismissing all other screens.
|
||||
*/
|
||||
popToTop(): void;
|
||||
};
|
||||
|
||||
export type NativeStackNavigationHelpers = NavigationHelpers<ParamListBase, {}>;
|
||||
|
||||
export type NativeStackNavigationConfig = {};
|
||||
|
||||
export type NativeStackNavigationOptions = {
|
||||
/**
|
||||
* String that can be displayed in the header as a fallback for `headerTitle`.
|
||||
*/
|
||||
title?: string;
|
||||
/**
|
||||
* String to display in the header as title. Defaults to scene `title`.
|
||||
*/
|
||||
headerTitle?: string;
|
||||
/**
|
||||
* Title to display in the back button.
|
||||
* Only supported on iOS.
|
||||
*
|
||||
* @platform ios
|
||||
*/
|
||||
headerBackTitle?: string;
|
||||
/**
|
||||
* Whether to show the header.
|
||||
*/
|
||||
headerShown?: boolean;
|
||||
/**
|
||||
* Style object for header title. Supported properties:
|
||||
* - backgroundColor
|
||||
*/
|
||||
headerStyle?: {
|
||||
backgroundColor?: string;
|
||||
};
|
||||
/**
|
||||
* Indicating whether the navigation bar is translucent.
|
||||
* Only supported on iOS.
|
||||
*
|
||||
* @platform ios
|
||||
*/
|
||||
headerTranslucent?: boolean;
|
||||
/**
|
||||
* Set native property to prefer large title header (like in iOS seeting).
|
||||
* Only supported on iOS.
|
||||
*
|
||||
* @platform ios
|
||||
*/
|
||||
headerLargeTitle?: boolean;
|
||||
/**
|
||||
* Function which returns a React Element to display on the right side of the header.
|
||||
*/
|
||||
headerRight?: () => React.ReactNode;
|
||||
/**
|
||||
* Tint color for the header.
|
||||
*/
|
||||
headerTintColor?: string;
|
||||
/**
|
||||
* Style object for header title. Supported properties:
|
||||
* - fontFamily
|
||||
* - fontSize
|
||||
* - color
|
||||
*/
|
||||
headerTitleStyle?: {
|
||||
fontFamily?: string;
|
||||
fontSize?: number;
|
||||
color?: string;
|
||||
};
|
||||
/**
|
||||
* Style object for header back title. Supported properties:
|
||||
* - fontFamily
|
||||
* - fontSize
|
||||
*
|
||||
* Only supported on iOS.
|
||||
*
|
||||
* @platform ios
|
||||
*/
|
||||
headerBackTitleStyle?: {
|
||||
fontFamily?: string;
|
||||
fontSize?: number;
|
||||
};
|
||||
/**
|
||||
* Whether you can use gestures to dismiss this screen. Defaults to `true`.
|
||||
* Only supported on iOS.
|
||||
*
|
||||
* @platform ios
|
||||
*/
|
||||
gestureEnabled?: boolean;
|
||||
/**
|
||||
* Style object for the scene content.
|
||||
*/
|
||||
contentStyle?: StyleProp<ViewStyle>;
|
||||
/**
|
||||
* How should the screen be presented.
|
||||
* Only supported on iOS.
|
||||
*
|
||||
* @platform ios
|
||||
*/
|
||||
presentation?: 'modal' | 'transparentModal' | 'push';
|
||||
};
|
||||
|
||||
export type NativeStackNavigatorProps = DefaultNavigatorOptions<
|
||||
NativeStackNavigationOptions
|
||||
> &
|
||||
StackRouterOptions &
|
||||
NativeStackNavigationConfig;
|
||||
|
||||
export type NativeStackDescriptor = Descriptor<
|
||||
ParamListBase,
|
||||
string,
|
||||
StackNavigationState,
|
||||
NativeStackNavigationOptions
|
||||
>;
|
||||
|
||||
export type NativeStackDescriptorMap = {
|
||||
[key: string]: NativeStackDescriptor;
|
||||
};
|
||||
64
packages/native-stack/src/views/HeaderConfig.tsx
Normal file
64
packages/native-stack/src/views/HeaderConfig.tsx
Normal file
@@ -0,0 +1,64 @@
|
||||
import * as React from 'react';
|
||||
import {
|
||||
// @ts-ignore
|
||||
ScreenStackHeaderConfig,
|
||||
// @ts-ignore
|
||||
ScreenStackHeaderRightView,
|
||||
// eslint-disable-next-line import/no-unresolved
|
||||
} from 'react-native-screens';
|
||||
import { Route } from '@react-navigation/core';
|
||||
import { NativeStackNavigationOptions } from '../types';
|
||||
|
||||
type Props = NativeStackNavigationOptions & {
|
||||
route: Route<string>;
|
||||
};
|
||||
|
||||
export default function HeaderConfig(props: Props) {
|
||||
const {
|
||||
route,
|
||||
title,
|
||||
headerRight,
|
||||
headerTitle,
|
||||
headerBackTitle,
|
||||
headerTintColor,
|
||||
gestureEnabled,
|
||||
headerLargeTitle,
|
||||
headerTranslucent,
|
||||
headerStyle = {},
|
||||
headerTitleStyle = {},
|
||||
headerBackTitleStyle = {},
|
||||
headerShown,
|
||||
} = props;
|
||||
|
||||
return (
|
||||
<ScreenStackHeaderConfig
|
||||
hidden={headerShown === false}
|
||||
translucent={headerTranslucent === true}
|
||||
title={
|
||||
headerTitle !== undefined
|
||||
? headerTitle
|
||||
: title !== undefined
|
||||
? title
|
||||
: route.name
|
||||
}
|
||||
titleFontFamily={headerTitleStyle.fontFamily}
|
||||
titleFontSize={headerTitleStyle.fontFamily}
|
||||
titleColor={
|
||||
headerTitleStyle.color !== undefined
|
||||
? headerTitleStyle.color
|
||||
: headerTintColor
|
||||
}
|
||||
backTitle={headerBackTitle}
|
||||
backTitleFontFamily={headerBackTitleStyle.fontFamily}
|
||||
backTitleFontSize={headerBackTitleStyle.fontSize}
|
||||
color={headerTintColor}
|
||||
gestureEnabled={gestureEnabled === undefined ? true : gestureEnabled}
|
||||
largeTitle={headerLargeTitle}
|
||||
backgroundColor={headerStyle.backgroundColor}
|
||||
>
|
||||
{headerRight !== undefined ? (
|
||||
<ScreenStackHeaderRightView>{headerRight()}</ScreenStackHeaderRightView>
|
||||
) : null}
|
||||
</ScreenStackHeaderConfig>
|
||||
);
|
||||
}
|
||||
62
packages/native-stack/src/views/StackView.tsx
Normal file
62
packages/native-stack/src/views/StackView.tsx
Normal file
@@ -0,0 +1,62 @@
|
||||
import * as React from 'react';
|
||||
import { View, StyleSheet, Platform } from 'react-native';
|
||||
import { StackNavigationState, StackActions } from '@react-navigation/routers';
|
||||
|
||||
import {
|
||||
// @ts-ignore
|
||||
ScreenStack,
|
||||
Screen,
|
||||
// eslint-disable-next-line import/no-unresolved
|
||||
} from 'react-native-screens';
|
||||
import HeaderConfig from './HeaderConfig';
|
||||
import {
|
||||
NativeStackNavigationHelpers,
|
||||
NativeStackDescriptorMap,
|
||||
} from '../types';
|
||||
|
||||
type Props = {
|
||||
state: StackNavigationState;
|
||||
navigation: NativeStackNavigationHelpers;
|
||||
descriptors: NativeStackDescriptorMap;
|
||||
};
|
||||
|
||||
export default function StackView({ state, navigation, descriptors }: Props) {
|
||||
return (
|
||||
<ScreenStack style={styles.scenes}>
|
||||
{state.routes.map(route => {
|
||||
const { options, render: renderScene } = descriptors[route.key];
|
||||
const { presentation = 'push', contentStyle } = options;
|
||||
|
||||
return (
|
||||
// @ts-ignore
|
||||
<Screen
|
||||
key={route.key}
|
||||
style={StyleSheet.absoluteFill}
|
||||
stackPresentation={presentation}
|
||||
onDismissed={() => {
|
||||
navigation.dispatch({
|
||||
...StackActions.pop(),
|
||||
source: route.key,
|
||||
target: state.key,
|
||||
});
|
||||
}}
|
||||
>
|
||||
<HeaderConfig {...options} route={route} />
|
||||
<View style={[styles.content, contentStyle]}>{renderScene()}</View>
|
||||
</Screen>
|
||||
);
|
||||
})}
|
||||
</ScreenStack>
|
||||
);
|
||||
}
|
||||
|
||||
const styles = StyleSheet.create({
|
||||
content: {
|
||||
flex: 1,
|
||||
backgroundColor: '#eee',
|
||||
marginTop: Platform.OS === 'android' ? 56 : 0,
|
||||
},
|
||||
scenes: {
|
||||
flex: 1,
|
||||
},
|
||||
});
|
||||
3
packages/native-stack/tsconfig.json
Normal file
3
packages/native-stack/tsconfig.json
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"extends": "../../tsconfig"
|
||||
}
|
||||
@@ -34,8 +34,8 @@
|
||||
"@types/react": "^16.9.4",
|
||||
"@types/react-native": "^0.60.17",
|
||||
"del-cli": "^3.0.0",
|
||||
"react": "16.8.3",
|
||||
"react-native": "0.59.10",
|
||||
"react": "~16.8.3",
|
||||
"react-native": "~0.59.10",
|
||||
"typescript": "^3.6.3"
|
||||
},
|
||||
"peerDependencies": {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# `@react-navigation/stack`
|
||||
|
||||
Bottom tab navigator for React Navigation following iOS design guidelines.
|
||||
Stack navigator for React Navigation.
|
||||
|
||||
## Installation
|
||||
|
||||
|
||||
@@ -41,12 +41,12 @@
|
||||
"@types/react": "^16.9.4",
|
||||
"@types/react-native": "^0.60.17",
|
||||
"del-cli": "^3.0.0",
|
||||
"react": "16.8.3",
|
||||
"react-native": "0.59.10",
|
||||
"react": "~16.8.3",
|
||||
"react-native": "~0.59.10",
|
||||
"react-native-gesture-handler": "^1.3.0",
|
||||
"react-native-reanimated": "^1.3.0",
|
||||
"react-native-safe-area-context": "^0.3.6",
|
||||
"react-native-screens": "^1.0.0-alpha.22",
|
||||
"react-native-screens": "^2.0.0-alpha.3",
|
||||
"typescript": "^3.6.3"
|
||||
},
|
||||
"peerDependencies": {
|
||||
@@ -57,7 +57,7 @@
|
||||
"react-native-gesture-handler": "^1.0.0",
|
||||
"react-native-reanimated": "^1.0.0",
|
||||
"react-native-safe-area-context": "^0.3.6",
|
||||
"react-native-screens": "^1.0.0-alpha.0"
|
||||
"react-native-screens": "^1.0.0-alpha.0 || ^2.0.0-alpha.3"
|
||||
},
|
||||
"@react-native-community/bob": {
|
||||
"source": "src",
|
||||
|
||||
62
yarn.lock
62
yarn.lock
@@ -5606,6 +5606,14 @@ define-property@^2.0.2:
|
||||
is-descriptor "^1.0.2"
|
||||
isobject "^3.0.1"
|
||||
|
||||
del-cli@^2.0.0:
|
||||
version "2.0.0"
|
||||
resolved "https://registry.yarnpkg.com/del-cli/-/del-cli-2.0.0.tgz#e9a778398863c26796d85409b9891f98b0122cd1"
|
||||
integrity sha512-IREsO6mjSTxxvWLKMMUi1G0izhqEBx7qeDkOJ6H3+TJl8gQl6x5C5hK4Sm1GJ51KodUMR6O7HuIhnF24Edua3g==
|
||||
dependencies:
|
||||
del "^4.1.1"
|
||||
meow "^5.0.0"
|
||||
|
||||
del-cli@^3.0.0:
|
||||
version "3.0.0"
|
||||
resolved "https://registry.yarnpkg.com/del-cli/-/del-cli-3.0.0.tgz#327a15d4c18d6b7e5c849a53ef0d17901bc28197"
|
||||
@@ -5626,7 +5634,7 @@ del@^3.0.0:
|
||||
pify "^3.0.0"
|
||||
rimraf "^2.2.8"
|
||||
|
||||
del@^4.1.0:
|
||||
del@^4.1.0, del@^4.1.1:
|
||||
version "4.1.1"
|
||||
resolved "https://registry.yarnpkg.com/del/-/del-4.1.1.tgz#9e8f117222ea44a31ff3a156c049b99052a9f0b4"
|
||||
integrity sha512-QwGuEUouP2kVwQenAsOof5Fv8K9t3D8Ca8NxcXKrIpEHjTXK5J2nXLdP+ALI1cgv8wj7KuwBhTwBkOZSJKM5XQ==
|
||||
@@ -9428,7 +9436,7 @@ jest@^24.8.0:
|
||||
import-local "^2.0.0"
|
||||
jest-cli "^24.9.0"
|
||||
|
||||
jetifier@^1.0.0-beta04.2:
|
||||
jetifier@^1.0.0-beta04.2, jetifier@^1.6.4:
|
||||
version "1.6.4"
|
||||
resolved "https://registry.yarnpkg.com/jetifier/-/jetifier-1.6.4.tgz#6159db8e275d97980d26162897a0648b6d4a3222"
|
||||
integrity sha512-+f/4OLeqY8RAmXnonI1ffeY1DR8kMNJPhv5WMFehchf7U71cjMQVKkOz1n6asz6kfVoAqKNWJz1A/18i18AcXA==
|
||||
@@ -13018,22 +13026,22 @@ react-devtools-core@^3.6.0:
|
||||
shell-quote "^1.6.1"
|
||||
ws "^3.3.1"
|
||||
|
||||
react-dom@^16.8.3:
|
||||
version "16.10.2"
|
||||
resolved "https://registry.yarnpkg.com/react-dom/-/react-dom-16.10.2.tgz#4840bce5409176bc3a1f2bd8cb10b92db452fda6"
|
||||
integrity sha512-kWGDcH3ItJK4+6Pl9DZB16BXYAZyrYQItU4OMy0jAkv5aNqc+mAKb4TpFtAteI6TJZu+9ZlNhaeNQSVQDHJzkw==
|
||||
react-dom@~16.8.3:
|
||||
version "16.8.6"
|
||||
resolved "https://registry.yarnpkg.com/react-dom/-/react-dom-16.8.6.tgz#71d6303f631e8b0097f56165ef608f051ff6e10f"
|
||||
integrity sha512-1nL7PIq9LTL3fthPqwkvr2zY7phIPjYrT0jp4HjyEQrEROnw4dG41VVwi/wfoCneoleqrNX7iAD+pXebJZwrwA==
|
||||
dependencies:
|
||||
loose-envify "^1.1.0"
|
||||
object-assign "^4.1.1"
|
||||
prop-types "^15.6.2"
|
||||
scheduler "^0.16.2"
|
||||
scheduler "^0.13.6"
|
||||
|
||||
react-error-overlay@^6.0.1:
|
||||
version "6.0.3"
|
||||
resolved "https://registry.yarnpkg.com/react-error-overlay/-/react-error-overlay-6.0.3.tgz#c378c4b0a21e88b2e159a3e62b2f531fd63bf60d"
|
||||
integrity sha512-bOUvMWFQVk5oz8Ded9Xb7WVdEi3QGLC8tH7HmYP0Fdp4Bn3qw0tRFmr5TW6mvahzvmrK4a6bqWGfCevBflP+Xw==
|
||||
|
||||
react-is@^16.7.0, react-is@^16.8.1, react-is@^16.8.3, react-is@^16.8.4:
|
||||
react-is@^16.7.0, react-is@^16.8.1, react-is@^16.8.4, react-is@^16.8.6:
|
||||
version "16.10.2"
|
||||
resolved "https://registry.yarnpkg.com/react-is/-/react-is-16.10.2.tgz#984120fd4d16800e9a738208ab1fba422d23b5ab"
|
||||
integrity sha512-INBT1QEgtcCCgvccr5/86CfD71fw9EPmDxgiJX4I2Ddr6ZsV6iFXsuby+qWJPtmNuMY0zByTsG4468P7nHuNWA==
|
||||
@@ -13093,10 +13101,10 @@ react-native-safe-area-view@^0.12.0:
|
||||
dependencies:
|
||||
hoist-non-react-statics "^2.3.1"
|
||||
|
||||
react-native-screens@^1.0.0-alpha.22, react-native-screens@~1.0.0-alpha.23:
|
||||
version "1.0.0-alpha.23"
|
||||
resolved "https://registry.yarnpkg.com/react-native-screens/-/react-native-screens-1.0.0-alpha.23.tgz#25d7ea4d11bda4fcde2d1da7ae50271c6aa636e0"
|
||||
integrity sha512-tOxHGQUN83MTmQB4ghoQkibqOdGiX4JQEmeyEv96MKWO/x8T2PJv84ECUos9hD3blPRQwVwSpAid1PPPhrVEaw==
|
||||
react-native-screens@2.0.0-alpha.3, react-native-screens@^2.0.0-alpha.3:
|
||||
version "2.0.0-alpha.3"
|
||||
resolved "https://registry.yarnpkg.com/react-native-screens/-/react-native-screens-2.0.0-alpha.3.tgz#af86f265b2fb4293b626cf4396db7743de5a54af"
|
||||
integrity sha512-SA3uGrc3UM1V9y6gfVU1UPf1a3dMyQCj3p5J7y6g81Of8rV5Pc34s6fWzOKNAWgOiviAktZB1z7Jngdl7+acZg==
|
||||
dependencies:
|
||||
debounce "^1.2.0"
|
||||
|
||||
@@ -13150,7 +13158,7 @@ react-native-view-shot@2.6.0:
|
||||
resolved "https://registry.yarnpkg.com/react-native-view-shot/-/react-native-view-shot-2.6.0.tgz#3b23675826f67658366352c4b97b59a6aded2f43"
|
||||
integrity sha512-yO9vWi/11m2hEJl8FrW1SMeVzFfPtMKh20MUInGqlsL0H8Ya2JGGlFfrBzx1KiFR2hFb5OdsTLYNtcVZtJ6pLQ==
|
||||
|
||||
react-native@0.59.10, react-native@^0.59.10:
|
||||
react-native@~0.59.10:
|
||||
version "0.59.10"
|
||||
resolved "https://registry.yarnpkg.com/react-native/-/react-native-0.59.10.tgz#352f381e382f93a0403be499c9e384bf51c2591c"
|
||||
integrity sha512-guB9YW+pBqS1dnfZ4ntzjINopiCUAbdmshU2wMWD1W32fRczLAopi/7Q2iHKP8LTCdxuYZV3fa9Mew5PSuANAw==
|
||||
@@ -13214,15 +13222,15 @@ react-proxy@^1.1.7:
|
||||
lodash "^4.6.1"
|
||||
react-deep-force-update "^1.0.0"
|
||||
|
||||
react-test-renderer@16.8.3:
|
||||
version "16.8.3"
|
||||
resolved "https://registry.yarnpkg.com/react-test-renderer/-/react-test-renderer-16.8.3.tgz#230006af264cc46aeef94392e04747c21839e05e"
|
||||
integrity sha512-rjJGYebduKNZH0k1bUivVrRLX04JfIQ0FKJLPK10TAb06XWhfi4gTobooF9K/DEFNW98iGac3OSxkfIJUN9Mdg==
|
||||
react-test-renderer@~16.8.3:
|
||||
version "16.8.6"
|
||||
resolved "https://registry.yarnpkg.com/react-test-renderer/-/react-test-renderer-16.8.6.tgz#188d8029b8c39c786f998aa3efd3ffe7642d5ba1"
|
||||
integrity sha512-H2srzU5IWYT6cZXof6AhUcx/wEyJddQ8l7cLM/F7gDXYyPr4oq+vCIxJYXVGhId1J706sqziAjuOEjyNkfgoEw==
|
||||
dependencies:
|
||||
object-assign "^4.1.1"
|
||||
prop-types "^15.6.2"
|
||||
react-is "^16.8.3"
|
||||
scheduler "^0.13.3"
|
||||
react-is "^16.8.6"
|
||||
scheduler "^0.13.6"
|
||||
|
||||
react-transform-hmr@^1.0.4:
|
||||
version "1.0.4"
|
||||
@@ -13232,15 +13240,15 @@ react-transform-hmr@^1.0.4:
|
||||
global "^4.3.0"
|
||||
react-proxy "^1.1.7"
|
||||
|
||||
react@16.8.3, react@^16.8.3:
|
||||
version "16.8.3"
|
||||
resolved "https://registry.yarnpkg.com/react/-/react-16.8.3.tgz#c6f988a2ce895375de216edcfaedd6b9a76451d9"
|
||||
integrity sha512-3UoSIsEq8yTJuSu0luO1QQWYbgGEILm+eJl2QN/VLDi7hL+EN18M3q3oVZwmVzzBJ3DkM7RMdRwBmZZ+b4IzSA==
|
||||
react@~16.8.3:
|
||||
version "16.8.6"
|
||||
resolved "https://registry.yarnpkg.com/react/-/react-16.8.6.tgz#ad6c3a9614fd3a4e9ef51117f54d888da01f2bbe"
|
||||
integrity sha512-pC0uMkhLaHm11ZSJULfOBqV4tIZkx87ZLvbbQYunNixAAvjnC+snJCg0XQXn9VIsttVsbZP/H/ewzgsd5fxKXw==
|
||||
dependencies:
|
||||
loose-envify "^1.1.0"
|
||||
object-assign "^4.1.1"
|
||||
prop-types "^15.6.2"
|
||||
scheduler "^0.13.3"
|
||||
scheduler "^0.13.6"
|
||||
|
||||
read-chunk@2.1.0:
|
||||
version "2.1.0"
|
||||
@@ -13952,7 +13960,7 @@ sax@~1.1.1:
|
||||
resolved "https://registry.yarnpkg.com/sax/-/sax-1.1.6.tgz#5d616be8a5e607d54e114afae55b7eaf2fcc3240"
|
||||
integrity sha1-XWFr6KXmB9VOEUr65Vt+ry/MMkA=
|
||||
|
||||
scheduler@^0.13.3:
|
||||
scheduler@^0.13.6:
|
||||
version "0.13.6"
|
||||
resolved "https://registry.yarnpkg.com/scheduler/-/scheduler-0.13.6.tgz#466a4ec332467b31a91b9bf74e5347072e4cd889"
|
||||
integrity sha512-IWnObHt413ucAYKsD9J1QShUKkbKLQQHdxRyw73sw4FN26iWr3DY/H34xGPe4nmL1DwXyWmSWmMrA9TfQbE/XQ==
|
||||
@@ -13960,7 +13968,7 @@ scheduler@^0.13.3:
|
||||
loose-envify "^1.1.0"
|
||||
object-assign "^4.1.1"
|
||||
|
||||
scheduler@^0.16.1, scheduler@^0.16.2:
|
||||
scheduler@^0.16.1:
|
||||
version "0.16.2"
|
||||
resolved "https://registry.yarnpkg.com/scheduler/-/scheduler-0.16.2.tgz#f74cd9d33eff6fc554edfb79864868e4819132c1"
|
||||
integrity sha512-BqYVWqwz6s1wZMhjFvLfVR5WXP7ZY32M/wYPo04CcuPM7XZEbV2TBNW7Z0UkguPTl0dWMA59VbNXxK6q+pHItg==
|
||||
@@ -15369,7 +15377,7 @@ typedarray@^0.0.6:
|
||||
resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777"
|
||||
integrity sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c=
|
||||
|
||||
typescript@^3.6.3:
|
||||
typescript@^3.5.3, typescript@^3.6.3:
|
||||
version "3.6.3"
|
||||
resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.6.3.tgz#fea942fabb20f7e1ca7164ff626f1a9f3f70b4da"
|
||||
integrity sha512-N7bceJL1CtRQ2RiG0AQME13ksR7DiuQh/QehubYcghzv20tnh+MQnQIuJddTmsbqYj+dztchykemz0zFzlvdQw==
|
||||
|
||||
Reference in New Issue
Block a user