From 0faf0249acd9b319f1dfc788961d0d71778e9ad5 Mon Sep 17 00:00:00 2001 From: Andrey Sorokin Date: Mon, 15 Jun 2020 15:48:22 +0300 Subject: [PATCH] RN 0.62 support --- example/.eslintrc.js | 4 + example/.flowconfig | 75 +- example/.gitignore | 5 +- example/.prettierrc.js | 6 + example/App.js | 33 +- example/__tests__/App-test.js | 14 +- .../__tests__/__snapshots__/App-test.js.snap | 7 +- example/android/app/build.gradle | 84 +- example/android/app/debug.keystore | Bin 0 -> 2257 bytes example/android/app/proguard-rules.pro | 7 - .../java/com/example/ReactNativeFlipper.java | 72 + .../android/app/src/main/AndroidManifest.xml | 3 +- .../main/java/com/example/MainActivity.java | 16 +- .../java/com/example/MainApplication.java | 75 +- .../app/src/main/res/values/styles.xml | 1 + example/android/build.gradle | 15 +- example/android/gradle.properties | 10 + .../gradle/wrapper/gradle-wrapper.properties | 2 +- example/android/gradlew | 6 +- example/android/gradlew.bat | 2 +- example/android/keystores/BUCK | 8 - .../keystores/debug.keystore.properties | 4 - example/android/settings.gradle | 2 +- example/ios/Podfile | 104 + example/ios/Podfile.lock | 456 ++ example/ios/example-tvOS/Info.plist | 29 +- example/ios/example.xcodeproj/project.pbxproj | 988 +--- .../xcschemes/example-tvOS.xcscheme | 45 +- .../xcshareddata/xcschemes/example.xcscheme | 45 +- .../contents.xcworkspacedata | 10 + example/ios/example/AppDelegate.h | 7 - example/ios/example/AppDelegate.m | 30 +- example/ios/example/Info.plist | 29 +- example/ios/example/main.m | 7 - example/ios/exampleTests/exampleTests.m | 13 +- example/package.json | 29 +- example/yarn.lock | 5115 +++++++++-------- src/CollapsibleNavBarScrollView.tsx | 2 +- 38 files changed, 3975 insertions(+), 3385 deletions(-) create mode 100644 example/.eslintrc.js create mode 100644 example/.prettierrc.js create mode 100644 example/android/app/debug.keystore create mode 100644 example/android/app/src/debug/java/com/example/ReactNativeFlipper.java delete mode 100644 example/android/keystores/BUCK delete mode 100644 example/android/keystores/debug.keystore.properties create mode 100644 example/ios/Podfile create mode 100644 example/ios/Podfile.lock create mode 100644 example/ios/example.xcworkspace/contents.xcworkspacedata diff --git a/example/.eslintrc.js b/example/.eslintrc.js new file mode 100644 index 0000000..40c6dcd --- /dev/null +++ b/example/.eslintrc.js @@ -0,0 +1,4 @@ +module.exports = { + root: true, + extends: '@react-native-community', +}; diff --git a/example/.flowconfig b/example/.flowconfig index 47d80d9..786366c 100644 --- a/example/.flowconfig +++ b/example/.flowconfig @@ -5,24 +5,23 @@ ; Ignore "BUCK" generated dirs /\.buckd/ -; Ignore unexpected extra "@providesModule" -.*/node_modules/.*/node_modules/fbjs/.* +; Ignore polyfills +node_modules/react-native/Libraries/polyfills/.* -; Ignore duplicate module providers -; For RN Apps installed via npm, "Libraries" folder is inside -; "node_modules/react-native" but in the source repo it is in the root -.*/Libraries/react-native/React.js +; These should not be required directly +; require from fbjs/lib instead: require('fbjs/lib/warning') +node_modules/warning/.* -; Ignore polyfills -.*/Libraries/polyfills/.* +; Flow doesn't support platforms +.*/Libraries/Utilities/LoadingView.js -; Ignore metro -.*/node_modules/metro/.* +[untyped] +.*/node_modules/@react-native-community/cli/.*/.* [include] [libs] -node_modules/react-native/Libraries/react-native/react-native-interface.js +node_modules/react-native/interface.js node_modules/react-native/flow/ [options] @@ -31,39 +30,45 @@ emoji=true esproposal.optional_chaining=enable esproposal.nullish_coalescing=enable -module.system=haste -module.system.haste.use_name_reducers=true -# get basename -module.system.haste.name_reducers='^.*/\([a-zA-Z0-9$_.-]+\.js\(\.flow\)?\)$' -> '\1' -# strip .js or .js.flow suffix -module.system.haste.name_reducers='^\(.*\)\.js\(\.flow\)?$' -> '\1' -# strip .ios suffix -module.system.haste.name_reducers='^\(.*\)\.ios$' -> '\1' -module.system.haste.name_reducers='^\(.*\)\.android$' -> '\1' -module.system.haste.name_reducers='^\(.*\)\.native$' -> '\1' -module.system.haste.paths.blacklist=.*/__tests__/.* -module.system.haste.paths.blacklist=.*/__mocks__/.* -module.system.haste.paths.blacklist=/node_modules/react-native/Libraries/Animated/src/polyfills/.* -module.system.haste.paths.whitelist=/node_modules/react-native/Libraries/.* +module.file_ext=.js +module.file_ext=.json +module.file_ext=.ios.js munge_underscores=true -module.name_mapper='^[./a-zA-Z0-9$_-]+\.\(bmp\|gif\|jpg\|jpeg\|png\|psd\|svg\|webp\|m4v\|mov\|mp4\|mpeg\|mpg\|webm\|aac\|aiff\|caf\|m4a\|mp3\|wav\|html\|pdf\)$' -> 'RelativeImageStub' - -module.file_ext=.js -module.file_ext=.jsx -module.file_ext=.json -module.file_ext=.native.js +module.name_mapper='^react-native/\(.*\)$' -> '/node_modules/react-native/\1' +module.name_mapper='^@?[./a-zA-Z0-9$_-]+\.\(bmp\|gif\|jpg\|jpeg\|png\|psd\|svg\|webp\|m4v\|mov\|mp4\|mpeg\|mpg\|webm\|aac\|aiff\|caf\|m4a\|mp3\|wav\|html\|pdf\)$' -> '/node_modules/react-native/Libraries/Image/RelativeImageStub' suppress_type=$FlowIssue suppress_type=$FlowFixMe suppress_type=$FlowFixMeProps suppress_type=$FlowFixMeState -suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\) -suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)?:? #[0-9]+ -suppress_comment=\\(.\\|\n\\)*\\$FlowFixedInNextDeploy +suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(\\)? *\\(site=[a-z,_]*react_native\\(_ios\\)?_\\(oss\\|fb\\)[a-z,_]*\\)?)\\) +suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(\\)? *\\(site=[a-z,_]*react_native\\(_ios\\)?_\\(oss\\|fb\\)[a-z,_]*\\)?)\\)?:? #[0-9]+ suppress_comment=\\(.\\|\n\\)*\\$FlowExpectedError +[lints] +sketchy-null-number=warn +sketchy-null-mixed=warn +sketchy-number=warn +untyped-type-import=warn +nonstrict-import=warn +deprecated-type=warn +unsafe-getters-setters=warn +inexact-spread=warn +unnecessary-invariant=warn +signature-verification-failure=warn +deprecated-utility=error + +[strict] +deprecated-type +nonstrict-import +sketchy-null +unclear-type +unsafe-getters-setters +untyped-import +untyped-type-import + [version] -^0.92.0 +^0.113.0 diff --git a/example/.gitignore b/example/.gitignore index 5d64756..ad572e6 100644 --- a/example/.gitignore +++ b/example/.gitignore @@ -20,7 +20,6 @@ DerivedData *.hmap *.ipa *.xcuserstate -project.xcworkspace # Android/IntelliJ # @@ -40,6 +39,7 @@ yarn-error.log buck-out/ \.buckd/ *.keystore +!debug.keystore # fastlane # @@ -54,3 +54,6 @@ buck-out/ # Bundle artifact *.jsbundle + +# CocoaPods +/ios/Pods/ diff --git a/example/.prettierrc.js b/example/.prettierrc.js new file mode 100644 index 0000000..5c4de1a --- /dev/null +++ b/example/.prettierrc.js @@ -0,0 +1,6 @@ +module.exports = { + bracketSpacing: false, + jsxBracketSameLine: true, + singleQuote: true, + trailingComma: 'all', +}; diff --git a/example/App.js b/example/App.js index ccf88c0..565bb03 100644 --- a/example/App.js +++ b/example/App.js @@ -1,22 +1,22 @@ -import React, { memo, useMemo, useRef, useCallback } from 'react' -import { StyleSheet, View, SafeAreaView, Animated, Button } from 'react-native' -import { CollapsibleNavBarScrollView } from '@busfor/react-native-collapsible-navbar-scrollview' +import React, {memo, useMemo, useRef, useCallback} from 'react'; +import {StyleSheet, View, SafeAreaView, Animated, Button} from 'react-native'; +import {CollapsibleNavBarScrollView} from '@busfor/react-native-collapsible-navbar-scrollview'; -const HEADER_MAX_HEIGHT = 300 -const HEADER_MIN_HEIGHT = 56 +const HEADER_MAX_HEIGHT = 300; +const HEADER_MIN_HEIGHT = 56; -const HEADER_SCROLL_DISTANCE = HEADER_MAX_HEIGHT - HEADER_MIN_HEIGHT +const HEADER_SCROLL_DISTANCE = HEADER_MAX_HEIGHT - HEADER_MIN_HEIGHT; export default memo(() => { - const animatedValue = useMemo(() => new Animated.Value(0), []) - const scrollViewRef = useRef() - const viewRef = useRef() + const animatedValue = useMemo(() => new Animated.Value(0), []); + const scrollViewRef = useRef(); + const viewRef = useRef(); const onPress = useCallback(() => { if (scrollViewRef.current && viewRef.current) { - scrollViewRef.current.scrollToView(viewRef.current) + scrollViewRef.current.scrollToView(viewRef.current); } - }, []) + }, []); return ( @@ -38,19 +38,18 @@ export default memo(() => { /> } animatedValue={animatedValue} - useNativeDriver={false} - > + useNativeDriver={false}> -