From 7132b020cb4e0b6be5fba95b10f26ffca17a029b Mon Sep 17 00:00:00 2001 From: Thibaut Boustany Date: Mon, 17 Sep 2018 16:33:42 +0200 Subject: [PATCH] Use react-native-screens --- android/app/build.gradle | 1 + .../com/ledgerlivemobile/MainActivity.java | 4 +- .../com/ledgerlivemobile/MainApplication.java | 2 + android/settings.gradle | 2 + .../project.pbxproj | 9 ++++ package.json | 3 +- src/index.js | 3 ++ yarn.lock | 48 +++++++++++-------- 8 files changed, 50 insertions(+), 22 deletions(-) diff --git a/android/app/build.gradle b/android/app/build.gradle index 9ff668843e..5bdd0a49f7 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -171,6 +171,7 @@ configurations.all { dependencies { compile project(':react-native-open-settings') + compile project(':react-native-screens') compile project(':react-native-config') compile project(':react-native-svg') compile project(':@ledgerhq_react-native-hid') diff --git a/android/app/src/main/java/com/ledgerlivemobile/MainActivity.java b/android/app/src/main/java/com/ledgerlivemobile/MainActivity.java index 9a9a6b90ee..8c4c02449f 100644 --- a/android/app/src/main/java/com/ledgerlivemobile/MainActivity.java +++ b/android/app/src/main/java/com/ledgerlivemobile/MainActivity.java @@ -2,11 +2,11 @@ import android.os.Bundle; -import com.facebook.react.ReactActivity; +import com.facebook.react.ReactFragmentActivity; import org.devio.rn.splashscreen.SplashScreen; -public class MainActivity extends ReactActivity { +public class MainActivity extends ReactFragmentActivity { /** * Returns the name of the main component registered from JavaScript. diff --git a/android/app/src/main/java/com/ledgerlivemobile/MainApplication.java b/android/app/src/main/java/com/ledgerlivemobile/MainApplication.java index f4f9d2e96b..8b15c1cd24 100644 --- a/android/app/src/main/java/com/ledgerlivemobile/MainApplication.java +++ b/android/app/src/main/java/com/ledgerlivemobile/MainApplication.java @@ -4,6 +4,7 @@ import com.facebook.react.ReactApplication; import com.opensettings.OpenSettingsPackage; +import com.swmansion.rnscreens.RNScreenPackage; import com.lugg.ReactNativeConfig.ReactNativeConfigPackage; import com.horcrux.svg.SvgPackage; import com.ledgerwallet.hid.ReactHIDPackage; @@ -34,6 +35,7 @@ protected List getPackages() { return Arrays.asList( new MainReactPackage(), new OpenSettingsPackage(), + new RNScreenPackage(), new ReactNativeConfigPackage(), new SvgPackage(), new ReactHIDPackage(), diff --git a/android/settings.gradle b/android/settings.gradle index 39750b6019..cb8e4545d0 100644 --- a/android/settings.gradle +++ b/android/settings.gradle @@ -1,6 +1,8 @@ rootProject.name = 'ledgerlivemobile' include ':react-native-open-settings' project(':react-native-open-settings').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-open-settings/android') +include ':react-native-screens' +project(':react-native-screens').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-screens/android') include ':react-native-config' project(':react-native-config').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-config/android') include ':react-native-svg' diff --git a/ios/ledgerlivemobile.xcodeproj/project.pbxproj b/ios/ledgerlivemobile.xcodeproj/project.pbxproj index b34bf6d44c..50a982feca 100644 --- a/ios/ledgerlivemobile.xcodeproj/project.pbxproj +++ b/ios/ledgerlivemobile.xcodeproj/project.pbxproj @@ -70,6 +70,7 @@ D5C1F1874ECE48F4AA5693AF /* MuseoSans-SemiBold.otf in Resources */ = {isa = PBXBuildFile; fileRef = CEDB8CDC561E4D4BBA7A64CD /* MuseoSans-SemiBold.otf */; }; DEF1B1546B36491B9894A599 /* libz.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 545FD04868AD450083DC4717 /* libz.tbd */; }; FEA0D6AE27DE42709BBB7FC7 /* Foundation.ttf in Resources */ = {isa = PBXBuildFile; fileRef = CD5489262AA84BDF9684E3AA /* Foundation.ttf */; }; + FD935BBB77A24B79B2604726 /* libRNScreens.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 35AA9FCF9B3A4E54A2282A09 /* libRNScreens.a */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ @@ -499,6 +500,8 @@ F91D74A42E59456DBB925283 /* Rubik-Regular.ttf */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = unknown; name = "Rubik-Regular.ttf"; path = "../assets/fonts/Rubik-Regular.ttf"; sourceTree = ""; }; FEE547B54ACD4EF5AD24A94E /* libPasscodeAuth.a */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = archive.ar; path = libPasscodeAuth.a; sourceTree = ""; }; FF58CBC5DEF846309BD66D85 /* libBleClient.a */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = archive.ar; path = libBleClient.a; sourceTree = ""; }; + 1A6A2D21459F426EA996EA88 /* RNScreens.xcodeproj */ = {isa = PBXFileReference; name = "RNScreens.xcodeproj"; path = "../node_modules/react-native-screens/ios/RNScreens.xcodeproj"; sourceTree = ""; fileEncoding = undefined; lastKnownFileType = wrapper.pb-project; explicitFileType = undefined; includeInIndex = 0; }; + 35AA9FCF9B3A4E54A2282A09 /* libRNScreens.a */ = {isa = PBXFileReference; name = "libRNScreens.a"; path = "libRNScreens.a"; sourceTree = ""; fileEncoding = undefined; lastKnownFileType = archive.ar; explicitFileType = undefined; includeInIndex = 0; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -536,6 +539,7 @@ 139FDEF61B0652A700C62182 /* libRCTWebSocket.a in Frameworks */, DEF1B1546B36491B9894A599 /* libz.tbd in Frameworks */, 7EDEA35621D64751B73F49C7 /* libReact Native Open Settings.a in Frameworks */, + FD935BBB77A24B79B2604726 /* libRNScreens.a in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -805,6 +809,7 @@ EE89361C161C48FB98136880 /* PasscodeAuth.xcodeproj */, 4AD2AECC687D45E9BBCCED05 /* RNVectorIcons.xcodeproj */, A49125B8906C40DFB2011F37 /* React Native Open Settings.xcodeproj */, + 1A6A2D21459F426EA996EA88 /* RNScreens.xcodeproj */, ); name = Libraries; sourceTree = ""; @@ -1561,6 +1566,7 @@ "$(SRCROOT)/../node_modules/@ledgerhq/react-native-passcode-auth", "$(SRCROOT)/../node_modules/react-native-vector-icons/RNVectorIconsManager", "$(SRCROOT)/../node_modules/react-native-open-settings", + "$(SRCROOT)/../node_modules/react-native-screens/ios", ); INFOPLIST_FILE = ledgerlivemobileTests/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 8.0; @@ -1600,6 +1606,7 @@ "$(SRCROOT)/../node_modules/@ledgerhq/react-native-passcode-auth", "$(SRCROOT)/../node_modules/react-native-vector-icons/RNVectorIconsManager", "$(SRCROOT)/../node_modules/react-native-open-settings", + "$(SRCROOT)/../node_modules/react-native-screens/ios", ); INFOPLIST_FILE = ledgerlivemobileTests/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 8.0; @@ -1643,6 +1650,7 @@ "$(SRCROOT)/../node_modules/@ledgerhq/react-native-passcode-auth", "$(SRCROOT)/../node_modules/react-native-vector-icons/RNVectorIconsManager", "$(SRCROOT)/../node_modules/react-native-open-settings", + "$(SRCROOT)/../node_modules/react-native-screens/ios", ); INFOPLIST_FILE = ledgerlivemobile/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 9.1; @@ -1684,6 +1692,7 @@ "$(SRCROOT)/../node_modules/@ledgerhq/react-native-passcode-auth", "$(SRCROOT)/../node_modules/react-native-vector-icons/RNVectorIconsManager", "$(SRCROOT)/../node_modules/react-native-open-settings", + "$(SRCROOT)/../node_modules/react-native-screens/ios", ); INFOPLIST_FILE = ledgerlivemobile/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 9.1; diff --git a/package.json b/package.json index 814473db96..fc7f92adc4 100644 --- a/package.json +++ b/package.json @@ -66,13 +66,14 @@ "react-native-open-settings": "^1.0.1", "react-native-progress": "^3.5.0", "react-native-qrcode-svg": "5.1.0", + "react-native-screens": "^1.0.0-alpha.11", "react-native-sentry": "0.39.0", "react-native-simple-store": "1.3.0", "react-native-splash-screen": "3.1.1", "react-native-svg": "6.5.2", "react-native-touch-id": "4.0.4", "react-native-vector-icons": "^5.0.0", - "react-navigation": "2.9.3", + "react-navigation": "2.14.2", "react-navigation-tabs": "^0.6.0", "react-redux": "5.0.7", "redux": "4.0.0", diff --git a/src/index.js b/src/index.js index 96190bc568..da6e1a2bbf 100644 --- a/src/index.js +++ b/src/index.js @@ -2,6 +2,7 @@ import "./polyfill"; /* eslint-disable import/first */ import React, { Component } from "react"; import { StyleSheet, View } from "react-native"; +import { useScreens } from "react-native-screens"; import SplashScreen from "react-native-splash-screen"; import { exportSelector as settingsExportSelector } from "./reducers/settings"; import { exportSelector as accountsExportSelector } from "./reducers/accounts"; @@ -18,6 +19,8 @@ import StyledStatusBar from "./components/StyledStatusBar"; import { BridgeSyncProvider } from "./bridge/BridgeSyncContext"; import DBSave from "./components/DBSave"; +useScreens(); + const styles = StyleSheet.create({ root: { flex: 1, diff --git a/yarn.lock b/yarn.lock index 25b0eaf596..c23b28313b 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2450,7 +2450,7 @@ create-react-class@^15.5.2, create-react-class@^15.5.3, create-react-class@^15.6 loose-envify "^1.3.1" object-assign "^4.1.1" -create-react-context@0.2.2, create-react-context@^0.2.1: +create-react-context@0.2.2: version "0.2.2" resolved "https://registry.yarnpkg.com/create-react-context/-/create-react-context-0.2.2.tgz#9836542f9aaa22868cd7d4a6f82667df38019dca" dependencies: @@ -6710,17 +6710,21 @@ react-native-qrcode-svg@5.1.0: prop-types "^15.5.10" qrcode "^1.2.0" +react-native-safe-area-view@^0.10.0: + version "0.10.0" + resolved "https://registry.yarnpkg.com/react-native-safe-area-view/-/react-native-safe-area-view-0.10.0.tgz#e8e9228d22698c0f82ad1202d24a4e4977260489" + dependencies: + hoist-non-react-statics "^2.3.1" + react-native-safe-area-view@^0.7.0: version "0.7.0" resolved "https://registry.yarnpkg.com/react-native-safe-area-view/-/react-native-safe-area-view-0.7.0.tgz#38f5ab9368d6ef9e5d18ab64212938af3ec39421" dependencies: hoist-non-react-statics "^2.3.1" -react-native-safe-area-view@^0.8.0: - version "0.8.0" - resolved "https://registry.yarnpkg.com/react-native-safe-area-view/-/react-native-safe-area-view-0.8.0.tgz#22d78cb8e8658d04a10cd53c1546e0bc86cb7aea" - dependencies: - hoist-non-react-statics "^2.3.1" +react-native-screens@^1.0.0-alpha.10, react-native-screens@^1.0.0-alpha.11: + version "1.0.0-alpha.11" + resolved "https://registry.yarnpkg.com/react-native-screens/-/react-native-screens-1.0.0-alpha.11.tgz#4f4faeb5607b1e08cc70d76a04c2f8da0b241200" react-native-sentry@0.39.0: version "0.39.0" @@ -6833,20 +6837,25 @@ react-navigation-deprecated-tab-navigator@1.3.0: dependencies: react-native-tab-view "^0.0.77" -react-navigation-drawer@0.4.3: - version "0.4.3" - resolved "https://registry.yarnpkg.com/react-navigation-drawer/-/react-navigation-drawer-0.4.3.tgz#c04c94e2429b7e724801af05bd0a93a79cb27f71" +react-navigation-drawer@0.5.0: + version "0.5.0" + resolved "https://registry.yarnpkg.com/react-navigation-drawer/-/react-navigation-drawer-0.5.0.tgz#d91b6a6ec65c34ba78c00f814b1e6508922cc9ec" dependencies: react-native-drawer-layout-polyfill "^1.3.2" -react-navigation-tabs@0.5.1: +react-navigation-stack@0.5.1: version "0.5.1" - resolved "https://registry.yarnpkg.com/react-navigation-tabs/-/react-navigation-tabs-0.5.1.tgz#ed33bce3a3e21b92646700de25bd94b8fc570371" + resolved "https://registry.yarnpkg.com/react-navigation-stack/-/react-navigation-stack-0.5.1.tgz#acc3c84c7b5209c7d89380d7f4576f17624f683c" + dependencies: + react-native-screens "^1.0.0-alpha.10" + +react-navigation-tabs@0.7.0: + version "0.7.0" + resolved "https://registry.yarnpkg.com/react-navigation-tabs/-/react-navigation-tabs-0.7.0.tgz#c89d41e501043f7fdb38550de85814452c3e6104" dependencies: hoist-non-react-statics "^2.5.0" prop-types "^15.6.1" react-lifecycles-compat "^3.0.4" - react-native-safe-area-view "^0.7.0" react-native-tab-view "^1.0.0" react-navigation-tabs@^0.6.0: @@ -6859,20 +6868,21 @@ react-navigation-tabs@^0.6.0: react-native-safe-area-view "^0.7.0" react-native-tab-view "^1.0.0" -react-navigation@2.9.3: - version "2.9.3" - resolved "https://registry.yarnpkg.com/react-navigation/-/react-navigation-2.9.3.tgz#de97f7102df6b836af780bfa5bfa80747148da19" +react-navigation@2.14.2: + version "2.14.2" + resolved "https://registry.yarnpkg.com/react-navigation/-/react-navigation-2.14.2.tgz#e3c933b15efdc6bcb1e9b014aeacfb2a08997d5b" dependencies: clamp "^1.0.1" - create-react-context "^0.2.1" + create-react-context "0.2.2" hoist-non-react-statics "^2.2.0" path-to-regexp "^1.7.0" query-string "^6.1.0" react-lifecycles-compat "^3" - react-native-safe-area-view "^0.8.0" + react-native-safe-area-view "^0.10.0" react-navigation-deprecated-tab-navigator "1.3.0" - react-navigation-drawer "0.4.3" - react-navigation-tabs "0.5.1" + react-navigation-drawer "0.5.0" + react-navigation-stack "0.5.1" + react-navigation-tabs "0.7.0" react-proxy@^1.1.7: version "1.1.8"