From bb4b21712aa7e2ef488d1fd69eba1368d0a9a9d0 Mon Sep 17 00:00:00 2001 From: Satyajit Sahoo Date: Tue, 4 Feb 2020 23:27:35 +0100 Subject: [PATCH] fix: add dummy functions to throw on wrong version --- packages/native/package.json | 2 +- packages/native/src/index.js | 9 +++++++++ packages/native/src/throwIfWrongVersion.js | 5 +++++ packages/native/yarn.lock | 8 ++++---- 4 files changed, 19 insertions(+), 5 deletions(-) create mode 100644 packages/native/src/throwIfWrongVersion.js diff --git a/packages/native/package.json b/packages/native/package.json index 041b92e3..38fa8417 100644 --- a/packages/native/package.json +++ b/packages/native/package.json @@ -41,7 +41,7 @@ "homepage": "https://github.com/react-navigation/react-navigation-native#readme", "dependencies": { "hoist-non-react-statics": "^3.3.2", - "react-native-safe-area-view": "^0.14.1" + "react-native-safe-area-view": "^0.14.8" }, "devDependencies": { "@expo/vector-icons": "^6.2.0", diff --git a/packages/native/src/index.js b/packages/native/src/index.js index 0b4cb5d3..ab1df9fc 100644 --- a/packages/native/src/index.js +++ b/packages/native/src/index.js @@ -1,5 +1,7 @@ /* eslint-disable import/no-commonjs */ +import throwIfWrongVersion from './throwIfWrongVersion'; + module.exports = { get createAppContainer() { return require('./createAppContainer').default; @@ -39,4 +41,11 @@ module.exports = { get Themed() { return require('./Themed').default; }, + + get createNavigationFactory() { + return throwIfWrongVersion; + }, + get NavigationContainer() { + return throwIfWrongVersion; + }, }; diff --git a/packages/native/src/throwIfWrongVersion.js b/packages/native/src/throwIfWrongVersion.js new file mode 100644 index 00000000..67fe55f5 --- /dev/null +++ b/packages/native/src/throwIfWrongVersion.js @@ -0,0 +1,5 @@ +export default function() { + throw new Error( + "This version of '@react-navigation/native' is not compatible with React Navigation 5. Make sure you install 5.x version of '@react-navigation/native'." + ); +} diff --git a/packages/native/yarn.lock b/packages/native/yarn.lock index 18a80069..d58f7993 100644 --- a/packages/native/yarn.lock +++ b/packages/native/yarn.lock @@ -7153,10 +7153,10 @@ react-native-safe-area-view@0.11.0: dependencies: hoist-non-react-statics "^2.3.1" -react-native-safe-area-view@^0.14.1: - version "0.14.1" - resolved "https://registry.yarnpkg.com/react-native-safe-area-view/-/react-native-safe-area-view-0.14.1.tgz#3981f6f8628c1769a163313bd8c8eba5edecca0f" - integrity sha512-pLAPWdirNWO/1F6IYkbayW9nDIXkM2F/NPtigYNjZj9nISCW+G2dNuI39DI8LenkxYdhiDaGMXfQHHx9TRn6Fw== +react-native-safe-area-view@^0.14.8: + version "0.14.8" + resolved "https://registry.yarnpkg.com/react-native-safe-area-view/-/react-native-safe-area-view-0.14.8.tgz#ef33c46ff8164ae77acad48c3039ec9c34873e5b" + integrity sha512-MtRSIcZNstxv87Jet+UsPhEd1tpGe8cVskDXlP657x6rHpSrbrc+y13ZNXrwAgGNNhqQNX7UJT68ZIq//ZRmvw== dependencies: hoist-non-react-statics "^2.3.1"