├── .babelrc ├── .buckconfig ├── .eslintrc.js ├── .flowconfig ├── .gitattributes ├── .gitignore ├── .npmignore ├── .watchmanconfig ├── Example ├── .babelrc ├── .buckconfig ├── .flowconfig ├── .gitattributes ├── .gitignore ├── .watchmanconfig ├── App.js ├── android │ ├── app │ │ ├── build.gradle │ │ ├── proguard-rules.pro │ │ └── src │ │ │ └── main │ │ │ ├── AndroidManifest.xml │ │ │ ├── java │ │ │ └── com │ │ │ │ └── swmansion │ │ │ │ └── rnscreens │ │ │ │ └── example │ │ │ │ ├── LifecycleAwareView.java │ │ │ │ ├── MainActivity.java │ │ │ │ ├── MainApplication.java │ │ │ │ ├── ReactNativeFlipper.java │ │ │ │ └── SampleLifecycleAwareViewManager.java │ │ │ └── res │ │ │ ├── mipmap-hdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-mdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-xhdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-xxhdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-xxxhdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ │ ├── values │ │ │ ├── strings.xml │ │ │ └── styles.xml │ │ │ └── xml │ │ │ └── network_security_config.xml │ ├── build.gradle │ ├── gradle.properties │ ├── gradle │ │ └── wrapper │ │ │ ├── gradle-wrapper.jar │ │ │ └── gradle-wrapper.properties │ ├── gradlew │ ├── gradlew.bat │ ├── keystores │ │ ├── BUCK │ │ └── debug.keystore.properties │ └── settings.gradle ├── app.json ├── index.js ├── ios │ ├── File.swift │ ├── Podfile │ ├── Podfile.lock │ ├── ScreensExample-Bridging-Header.h │ ├── ScreensExample-tvOS │ │ └── Info.plist │ ├── ScreensExample-tvOSTests │ │ └── Info.plist │ ├── ScreensExample.xcodeproj │ │ ├── project.pbxproj │ │ └── xcshareddata │ │ │ └── xcschemes │ │ │ ├── ScreensExample-tvOS.xcscheme │ │ │ └── ScreensExample.xcscheme │ ├── ScreensExample.xcworkspace │ │ ├── contents.xcworkspacedata │ │ └── xcshareddata │ │ │ └── IDEWorkspaceChecks.plist │ ├── ScreensExample │ │ ├── AppDelegate.h │ │ ├── AppDelegate.m │ │ ├── Base.lproj │ │ │ └── LaunchScreen.xib │ │ ├── Images.xcassets │ │ │ ├── AppIcon.appiconset │ │ │ │ └── Contents.json │ │ │ └── Contents.json │ │ ├── Info.plist │ │ ├── RNSSampleLifecycleAwareView.m │ │ └── main.m │ └── ScreensExampleTests │ │ ├── Info.plist │ │ └── ScreensExampleTests.m ├── metro.config.js ├── nativeNavigation.js ├── nativeStack.js ├── navigation │ ├── img │ │ ├── dawid-zawila-628275-unsplash.jpg │ │ ├── dawid-zawila-715178-unsplash.jpg │ │ ├── hires │ │ │ ├── dawid-zawila-628275-unsplash.jpg │ │ │ ├── dawid-zawila-715178-unsplash.jpg │ │ │ ├── janusz-maniak-143024-unsplash.jpg │ │ │ ├── janusz-maniak-272680-unsplash.jpg │ │ │ └── mariusz-prusaczyk-185182-unsplash.jpg │ │ ├── janusz-maniak-143024-unsplash.jpg │ │ ├── janusz-maniak-272680-unsplash.jpg │ │ └── mariusz-prusaczyk-185182-unsplash.jpg │ └── index.js ├── navigationTabsAndStack.js ├── package.json ├── stack.js ├── tabs.js └── yarn.lock ├── LICENSE ├── README.md ├── RNCoolModals.podspec ├── android ├── README.md ├── build.gradle ├── gradle.properties ├── gradle │ └── wrapper │ │ ├── gradle-wrapper.jar │ │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── settings.gradle └── src │ └── main │ ├── AndroidManifest.xml │ └── java │ └── com │ └── swmansion │ └── rnscreens │ ├── LifecycleHelper.java │ ├── RNScreensPackage.java │ ├── Screen.java │ ├── ScreenAppearEvent.java │ ├── ScreenContainer.java │ ├── ScreenContainerViewManager.java │ ├── ScreenDismissedEvent.java │ ├── ScreenFragment.java │ ├── ScreenStack.java │ ├── ScreenStackFragment.java │ ├── ScreenStackHeaderConfig.java │ ├── ScreenStackHeaderConfigViewManager.java │ ├── ScreenStackHeaderSubview.java │ ├── ScreenStackHeaderSubviewManager.java │ ├── ScreenStackViewManager.java │ ├── ScreenViewManager.java │ └── StackFinishTransitioningEvent.java ├── createNativeStackNavigator.js ├── ios ├── RNCMScreen.h ├── RNCMScreen.m ├── RNCMScreenStack.h ├── RNCMScreenStack.m ├── RNScreens.xcodeproj │ └── project.pbxproj └── UIViewController+slack.swift ├── jest.config.js ├── native-stack ├── README.md ├── index.tsx ├── navigators │ └── createNativeStackNavigator.tsx ├── types.tsx └── views │ ├── HeaderConfig.tsx │ └── NativeStackView.tsx ├── package.json ├── prettier.config.js ├── src ├── screens.d.ts ├── screens.js └── screens.web.js ├── tsconfig.json └── yarn.lock /.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "presets": ["react-native"] 3 | } -------------------------------------------------------------------------------- /.buckconfig: -------------------------------------------------------------------------------- 1 | 2 | [android] 3 | target = Google Inc.:Google APIs:23 4 | 5 | [maven_repositories] 6 | central = https://repo1.maven.org/maven2 7 | -------------------------------------------------------------------------------- /.eslintrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | parser: 'babel-eslint', 3 | 4 | extends: [ 5 | 'standard', 6 | 'prettier', 7 | 'prettier/flowtype', 8 | 'prettier/react', 9 | 'prettier/standard', 10 | ], 11 | 12 | plugins: ['react', 'react-native', 'import', 'jest'], 13 | 14 | settings: { 15 | 'import/core-modules': ['react-native-screens'], 16 | }, 17 | 18 | env: { 19 | 'react-native/react-native': true, 20 | 'jest/globals': true, 21 | }, 22 | 23 | rules: { 24 | 'import/no-unresolved': 2, 25 | 'react/jsx-uses-react': 2, 26 | 'react/jsx-uses-vars': 2, 27 | }, 28 | 29 | overrides: [ 30 | { 31 | files: ['*.ts', '*.tsx'], 32 | parser: '@typescript-eslint/parser', 33 | plugins: ['@typescript-eslint/eslint-plugin'], 34 | settings: { 35 | 'import/extensions': ['.js', '.ts', '.tsx'], 36 | 'import/parsers': { 37 | '@typescript-eslint/parser': ['.ts', '.tsx'], 38 | }, 39 | 'import/resolver': { 40 | node: { 41 | extensions: ['.js', '.ts', '.tsx'], 42 | }, 43 | }, 44 | }, 45 | rules: { 46 | '@typescript-eslint/adjacent-overload-signatures': 'error', 47 | '@typescript-eslint/array-type': 'error', 48 | '@typescript-eslint/consistent-type-assertions': [ 49 | 'error', 50 | { assertionStyle: 'as' }, 51 | ], 52 | '@typescript-eslint/member-delimiter-style': 'error', 53 | '@typescript-eslint/no-array-constructor': 'error', 54 | '@typescript-eslint/no-dynamic-delete': 'error', 55 | '@typescript-eslint/no-empty-interface': [ 56 | 'error', 57 | { allowSingleExtends: true }, 58 | ], 59 | '@typescript-eslint/no-extra-non-null-assertion': 'error', 60 | '@typescript-eslint/no-extraneous-class': 'error', 61 | '@typescript-eslint/no-misused-new': 'error', 62 | '@typescript-eslint/no-namespace': 'error', 63 | '@typescript-eslint/no-unused-vars': [ 64 | 'error', 65 | { argsIgnorePattern: '^_' }, 66 | ], 67 | '@typescript-eslint/no-use-before-define': [ 68 | 'error', 69 | { 70 | functions: false, 71 | classes: false, 72 | variables: false, 73 | typedefs: false, 74 | }, 75 | ], 76 | '@typescript-eslint/no-useless-constructor': 'error', 77 | '@typescript-eslint/prefer-for-of': 'error', 78 | '@typescript-eslint/prefer-function-type': 'error', 79 | '@typescript-eslint/prefer-namespace-keyword': 'error', 80 | '@typescript-eslint/prefer-optional-chain': 'error', 81 | '@typescript-eslint/triple-slash-reference': 'error', 82 | '@typescript-eslint/unified-signatures': 'error', 83 | 84 | 'default-case': 'off', 85 | 'no-dupe-class-members': 'off', 86 | 'no-unused-vars': 'off', 87 | 'no-array-constructor': 'off', 88 | 'no-use-before-define': 'off', 89 | }, 90 | }, 91 | ], 92 | }; 93 | -------------------------------------------------------------------------------- /.flowconfig: -------------------------------------------------------------------------------- 1 | [ignore] 2 | ; We fork some components by platform 3 | .*/*[.]android.js 4 | 5 | ; Ignore unexpected extra "@providesModule" 6 | .*/node_modules/.*/node_modules/fbjs/.* 7 | 8 | ; Ignore duplicate module providers 9 | ; For RN Apps installed via npm, "Libraries" folder is inside 10 | ; "node_modules/react-native" but in the source repo it is in the root 11 | .*/Libraries/react-native/React.js 12 | 13 | ; Ignore polyfills 14 | .*/Libraries/polyfills/.* 15 | 16 | ; Ignore any possible duplicates from within our Example folder 17 | .*/Example/node_modules/.* 18 | 19 | [include] 20 | 21 | [libs] 22 | node_modules/react-native/Libraries/react-native/react-native-interface.js 23 | node_modules/react-native/flow/ 24 | 25 | [options] 26 | emoji=true 27 | 28 | module.system=haste 29 | 30 | munge_underscores=true 31 | 32 | 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' 33 | 34 | module.file_ext=.js 35 | module.file_ext=.jsx 36 | module.file_ext=.json 37 | module.file_ext=.native.js 38 | 39 | suppress_type=$FlowIssue 40 | suppress_type=$FlowFixMe 41 | suppress_type=$FlowFixMeProps 42 | suppress_type=$FlowFixMeState 43 | suppress_type=$FixMe 44 | 45 | suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(>=0\\.\\(5[0-6]\\|[1-4][0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\) 46 | suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(>=0\\.\\(5[0-6]\\|[1-4][0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)?:? #[0-9]+ 47 | suppress_comment=\\(.\\|\n\\)*\\$FlowFixedInNextDeploy 48 | suppress_comment=\\(.\\|\n\\)*\\$FlowExpectedError 49 | 50 | unsafe.enable_getters_and_setters=true 51 | 52 | [version] 53 | ^0.56.0 54 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | # specific for windows script files 2 | *.bat text eol=crlf 3 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # OSX 2 | # 3 | .DS_Store 4 | 5 | # Xcode 6 | # 7 | build/ 8 | *.pbxuser 9 | !default.pbxuser 10 | *.mode1v3 11 | !default.mode1v3 12 | *.mode2v3 13 | !default.mode2v3 14 | *.perspectivev3 15 | !default.perspectivev3 16 | xcuserdata 17 | *.xccheckout 18 | *.moved-aside 19 | DerivedData 20 | *.hmap 21 | *.ipa 22 | *.xcuserstate 23 | project.xcworkspace 24 | 25 | # Android/IJ 26 | # 27 | *.iml 28 | .idea 29 | .gradle 30 | local.properties 31 | 32 | # node.js 33 | # 34 | node_modules/ 35 | npm-debug.log 36 | package-lock.json 37 | 38 | # vscode 39 | jsconfig.json 40 | .project 41 | .vscode 42 | 43 | # BUCK 44 | buck-out/ 45 | bin/ 46 | \.buckd/ 47 | android/app/libs 48 | android/keystores/debug.keystore 49 | -------------------------------------------------------------------------------- /.npmignore: -------------------------------------------------------------------------------- 1 | Example/ 2 | -------------------------------------------------------------------------------- /.watchmanconfig: -------------------------------------------------------------------------------- 1 | {} -------------------------------------------------------------------------------- /Example/.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "presets": ["module:metro-react-native-babel-preset"] 3 | } 4 | -------------------------------------------------------------------------------- /Example/.buckconfig: -------------------------------------------------------------------------------- 1 | 2 | [android] 3 | target = Google Inc.:Google APIs:23 4 | 5 | [maven_repositories] 6 | central = https://repo1.maven.org/maven2 7 | -------------------------------------------------------------------------------- /Example/.flowconfig: -------------------------------------------------------------------------------- 1 | [ignore] 2 | ; We fork some components by platform 3 | .*/*[.]android.js 4 | 5 | ; Ignore "BUCK" generated dirs 6 | /\.buckd/ 7 | 8 | ; Ignore polyfills 9 | node_modules/react-native/Libraries/polyfills/.* 10 | 11 | ; These should not be required directly 12 | ; require from fbjs/lib instead: require('fbjs/lib/warning') 13 | node_modules/warning/.* 14 | 15 | ; Flow doesn't support platforms 16 | .*/Libraries/Utilities/LoadingView.js 17 | 18 | [untyped] 19 | .*/node_modules/@react-native-community/cli/.*/.* 20 | 21 | [include] 22 | 23 | [libs] 24 | node_modules/react-native/interface.js 25 | node_modules/react-native/flow/ 26 | 27 | [options] 28 | emoji=true 29 | 30 | esproposal.optional_chaining=enable 31 | esproposal.nullish_coalescing=enable 32 | 33 | module.file_ext=.js 34 | module.file_ext=.json 35 | module.file_ext=.ios.js 36 | 37 | munge_underscores=true 38 | 39 | module.name_mapper='^react-native/\(.*\)$' -> '/node_modules/react-native/\1' 40 | 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' 41 | 42 | suppress_type=$FlowIssue 43 | suppress_type=$FlowFixMe 44 | suppress_type=$FlowFixMeProps 45 | suppress_type=$FlowFixMeState 46 | 47 | suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(\\)? *\\(site=[a-z,_]*react_native\\(_ios\\)?_\\(oss\\|fb\\)[a-z,_]*\\)?)\\) 48 | suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(\\)? *\\(site=[a-z,_]*react_native\\(_ios\\)?_\\(oss\\|fb\\)[a-z,_]*\\)?)\\)?:? #[0-9]+ 49 | suppress_comment=\\(.\\|\n\\)*\\$FlowExpectedError 50 | 51 | [lints] 52 | sketchy-null-number=warn 53 | sketchy-null-mixed=warn 54 | sketchy-number=warn 55 | untyped-type-import=warn 56 | nonstrict-import=warn 57 | deprecated-type=warn 58 | unsafe-getters-setters=warn 59 | inexact-spread=warn 60 | unnecessary-invariant=warn 61 | signature-verification-failure=warn 62 | deprecated-utility=error 63 | 64 | [strict] 65 | deprecated-type 66 | nonstrict-import 67 | sketchy-null 68 | unclear-type 69 | unsafe-getters-setters 70 | untyped-import 71 | untyped-type-import 72 | 73 | [version] 74 | ^0.113.0 75 | -------------------------------------------------------------------------------- /Example/.gitattributes: -------------------------------------------------------------------------------- 1 | *.pbxproj -text 2 | -------------------------------------------------------------------------------- /Example/.gitignore: -------------------------------------------------------------------------------- 1 | # OSX 2 | # 3 | .DS_Store 4 | 5 | # Xcode 6 | # 7 | build/ 8 | *.pbxuser 9 | !default.pbxuser 10 | *.mode1v3 11 | !default.mode1v3 12 | *.mode2v3 13 | !default.mode2v3 14 | *.perspectivev3 15 | !default.perspectivev3 16 | xcuserdata 17 | *.xccheckout 18 | *.moved-aside 19 | DerivedData 20 | *.hmap 21 | *.ipa 22 | *.xcuserstate 23 | 24 | # Android/IntelliJ 25 | # 26 | build/ 27 | .idea 28 | .gradle 29 | local.properties 30 | *.iml 31 | 32 | # node.js 33 | # 34 | node_modules/ 35 | npm-debug.log 36 | yarn-error.log 37 | 38 | # BUCK 39 | buck-out/ 40 | \.buckd/ 41 | *.keystore 42 | 43 | # fastlane 44 | # 45 | # It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the 46 | # screenshots whenever they are needed. 47 | # For more information about the recommended setup visit: 48 | # https://docs.fastlane.tools/best-practices/source-control/ 49 | 50 | */fastlane/report.xml 51 | */fastlane/Preview.html 52 | */fastlane/screenshots 53 | 54 | # Bundle artifact 55 | *.jsbundle 56 | 57 | # CocoaPods 58 | /ios/Pods/ 59 | 60 | # Android cpatures 61 | /android/captures 62 | -------------------------------------------------------------------------------- /Example/.watchmanconfig: -------------------------------------------------------------------------------- 1 | {} -------------------------------------------------------------------------------- /Example/App.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { 3 | Text, 4 | View, 5 | FlatList, 6 | StyleSheet, 7 | TouchableHighlight, 8 | } from 'react-native'; 9 | import { 10 | createStackNavigator, 11 | createSwitchNavigator, 12 | createAppContainer, 13 | } from 'react-navigation'; 14 | 15 | import Stack from './stack'; 16 | import NativeStack from './nativeStack'; 17 | import Tabs from './tabs'; 18 | import Navigation from './navigation'; 19 | import NativeNavigation from './nativeNavigation'; 20 | 21 | const SCREENS = { 22 | Stack: { screen: Stack, title: 'Screen container based stack' }, 23 | NativeStack: { screen: NativeStack, title: 'Native stack example' }, 24 | Tabs: { screen: Tabs, title: 'Tabs example' }, 25 | NativeNavigation: { 26 | screen: NativeNavigation, 27 | title: 'Native stack bindings for RNN', 28 | }, 29 | Navigation: { 30 | screen: Navigation, 31 | title: 'React Navigation with screen enabled', 32 | }, 33 | }; 34 | 35 | class MainScreen extends React.Component { 36 | static navigationOptions = { 37 | title: '📱 React Native Screens Examples', 38 | }; 39 | render() { 40 | const data = Object.keys(SCREENS).map(key => ({ key })); 41 | return ( 42 | ( 47 | this.props.navigation.navigate(key)} 50 | /> 51 | )} 52 | /> 53 | ); 54 | } 55 | } 56 | 57 | const ItemSeparator = () => ; 58 | 59 | class MainScreenItem extends React.Component { 60 | _onPress = () => this.props.onPressItem(this.props.item); 61 | render() { 62 | const { key } = this.props.item; 63 | return ( 64 | 65 | 66 | {SCREENS[key].title || key} 67 | 68 | 69 | ); 70 | } 71 | } 72 | const styles = StyleSheet.create({ 73 | list: { 74 | backgroundColor: '#EFEFF4', 75 | }, 76 | separator: { 77 | height: 1, 78 | backgroundColor: '#DBDBE0', 79 | }, 80 | buttonText: { 81 | backgroundColor: 'transparent', 82 | }, 83 | button: { 84 | flex: 1, 85 | height: 60, 86 | padding: 10, 87 | flexDirection: 'row', 88 | alignItems: 'center', 89 | backgroundColor: '#fff', 90 | }, 91 | }); 92 | 93 | export default createAppContainer(NativeNavigation); 94 | -------------------------------------------------------------------------------- /Example/android/app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in /usr/local/Cellar/android-sdk/24.3.3/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the proguardFiles 5 | # directive in build.gradle. 6 | # 7 | # For more details, see 8 | # http://developer.android.com/guide/developing/tools/proguard.html 9 | 10 | # Add any project specific keep options here: 11 | 12 | # If your project uses WebView with JS, uncomment the following 13 | # and specify the fully qualified class name to the JavaScript interface 14 | # class: 15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 16 | # public *; 17 | #} 18 | -------------------------------------------------------------------------------- /Example/android/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | 7 | 14 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /Example/android/app/src/main/java/com/swmansion/rnscreens/example/LifecycleAwareView.java: -------------------------------------------------------------------------------- 1 | package com.swmansion.rnscreens.example; 2 | 3 | import android.content.Context; 4 | import android.util.Log; 5 | 6 | import androidx.lifecycle.Lifecycle; 7 | import androidx.lifecycle.LifecycleObserver; 8 | import androidx.lifecycle.OnLifecycleEvent; 9 | 10 | import com.facebook.react.views.view.ReactViewGroup; 11 | 12 | public class LifecycleAwareView extends ReactViewGroup implements LifecycleObserver { 13 | public LifecycleAwareView(Context context) { 14 | super(context); 15 | } 16 | 17 | @OnLifecycleEvent(Lifecycle.Event.ON_RESUME) 18 | public void onResume() { 19 | Log.e("CAT", "VIEW RESUME " + this); 20 | } 21 | 22 | @OnLifecycleEvent(Lifecycle.Event.ON_PAUSE) 23 | public void onPause() { 24 | Log.e("CAT", "VIEW PAUSE " + this); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /Example/android/app/src/main/java/com/swmansion/rnscreens/example/MainActivity.java: -------------------------------------------------------------------------------- 1 | package com.swmansion.rnscreens.example; 2 | 3 | import android.os.Bundle; 4 | 5 | import com.facebook.react.ReactActivity; 6 | import com.facebook.react.ReactActivityDelegate; 7 | import com.facebook.react.ReactRootView; 8 | import com.swmansion.gesturehandler.react.RNGestureHandlerEnabledRootView; 9 | 10 | public class MainActivity extends ReactActivity { 11 | 12 | /** 13 | * Returns the name of the main component registered from JavaScript. 14 | * This is used to schedule rendering of the component. 15 | */ 16 | @Override 17 | protected String getMainComponentName() { 18 | return "ScreensExample"; 19 | } 20 | 21 | @Override 22 | protected void onCreate(Bundle savedInstanceState) { 23 | super.onCreate(null); 24 | } 25 | 26 | @Override 27 | protected ReactActivityDelegate createReactActivityDelegate() { 28 | return new ReactActivityDelegate(this, getMainComponentName()) { 29 | @Override 30 | protected ReactRootView createRootView() { 31 | return new RNGestureHandlerEnabledRootView(MainActivity.this); 32 | } 33 | }; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /Example/android/app/src/main/java/com/swmansion/rnscreens/example/MainApplication.java: -------------------------------------------------------------------------------- 1 | package com.swmansion.rnscreens.example; 2 | 3 | import android.app.Application; 4 | 5 | 6 | import android.app.Application; 7 | import android.content.Context; 8 | import com.facebook.react.PackageList; 9 | import com.facebook.react.ReactApplication; 10 | import com.facebook.react.ReactInstanceManager; 11 | import com.facebook.react.ReactNativeHost; 12 | import com.facebook.react.ReactPackage; 13 | import com.facebook.soloader.SoLoader; 14 | import java.lang.reflect.InvocationTargetException; 15 | import java.util.List; 16 | import com.facebook.hermes.reactexecutor.HermesExecutorFactory; 17 | import com.facebook.react.bridge.JavaScriptExecutorFactory; 18 | import com.facebook.react.bridge.NativeModule; 19 | import com.facebook.react.bridge.ReactApplicationContext; 20 | import com.facebook.react.uimanager.ViewManager; 21 | 22 | import java.util.Arrays; 23 | import java.util.Collections; 24 | 25 | public class MainApplication extends Application implements ReactApplication { 26 | 27 | private static class MyPackage implements ReactPackage { 28 | 29 | @Override 30 | public List createNativeModules(ReactApplicationContext reactContext) { 31 | return Collections.emptyList(); 32 | } 33 | 34 | @Override 35 | public List createViewManagers(ReactApplicationContext reactContext) { 36 | return Arrays.asList(new SampleLifecycleAwareViewManager()); 37 | } 38 | } 39 | 40 | private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) { 41 | @Override 42 | public boolean getUseDeveloperSupport() { 43 | return BuildConfig.DEBUG; 44 | } 45 | 46 | @Override 47 | protected List getPackages() { 48 | @SuppressWarnings("UnnecessaryLocalVariable") 49 | List packages = new PackageList(this).getPackages(); 50 | packages.add(new MyPackage()); 51 | return packages; 52 | } 53 | 54 | @Override 55 | protected String getJSMainModuleName() { 56 | return "index"; 57 | } 58 | }; 59 | 60 | @Override 61 | public ReactNativeHost getReactNativeHost() { 62 | return mReactNativeHost; 63 | } 64 | 65 | @Override 66 | public void onCreate() { 67 | super.onCreate(); 68 | SoLoader.init(this, /* native exopackage */ false); 69 | initializeFlipper(this, getReactNativeHost().getReactInstanceManager()); 70 | } 71 | 72 | /** 73 | * Loads Flipper in React Native templates. Call this in the onCreate method with something like 74 | * initializeFlipper(this, getReactNativeHost().getReactInstanceManager()); 75 | * 76 | * @param context 77 | * @param reactInstanceManager 78 | */ 79 | private static void initializeFlipper( 80 | Context context, ReactInstanceManager reactInstanceManager) { 81 | if (BuildConfig.DEBUG) { 82 | try { 83 | /* 84 | We use reflection here to pick up the class that initializes Flipper, 85 | since Flipper library is not available in release mode 86 | */ 87 | Class aClass = Class.forName("com.swmansion.rnscreens.example.ReactNativeFlipper"); 88 | aClass 89 | .getMethod("initializeFlipper", Context.class, ReactInstanceManager.class) 90 | .invoke(null, context, reactInstanceManager); 91 | } catch (ClassNotFoundException e) { 92 | e.printStackTrace(); 93 | } catch (NoSuchMethodException e) { 94 | e.printStackTrace(); 95 | } catch (IllegalAccessException e) { 96 | e.printStackTrace(); 97 | } catch (InvocationTargetException e) { 98 | e.printStackTrace(); 99 | } 100 | } 101 | } 102 | 103 | } 104 | 105 | -------------------------------------------------------------------------------- /Example/android/app/src/main/java/com/swmansion/rnscreens/example/ReactNativeFlipper.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Facebook, Inc. and its affiliates. 3 | * 4 | *

This source code is licensed under the MIT license found in the LICENSE file in the root 5 | * directory of this source tree. 6 | */ 7 | package com.swmansion.rnscreens.example; 8 | import android.content.Context; 9 | import com.facebook.flipper.android.AndroidFlipperClient; 10 | import com.facebook.flipper.android.utils.FlipperUtils; 11 | import com.facebook.flipper.core.FlipperClient; 12 | import com.facebook.flipper.plugins.crashreporter.CrashReporterPlugin; 13 | import com.facebook.flipper.plugins.databases.DatabasesFlipperPlugin; 14 | import com.facebook.flipper.plugins.fresco.FrescoFlipperPlugin; 15 | import com.facebook.flipper.plugins.inspector.DescriptorMapping; 16 | import com.facebook.flipper.plugins.inspector.InspectorFlipperPlugin; 17 | import com.facebook.flipper.plugins.network.FlipperOkhttpInterceptor; 18 | import com.facebook.flipper.plugins.network.NetworkFlipperPlugin; 19 | import com.facebook.flipper.plugins.react.ReactFlipperPlugin; 20 | import com.facebook.flipper.plugins.sharedpreferences.SharedPreferencesFlipperPlugin; 21 | import com.facebook.react.ReactInstanceManager; 22 | import com.facebook.react.bridge.ReactContext; 23 | import com.facebook.react.modules.network.NetworkingModule; 24 | import okhttp3.OkHttpClient; 25 | public class ReactNativeFlipper { 26 | public static void initializeFlipper(Context context, ReactInstanceManager reactInstanceManager) { 27 | if (FlipperUtils.shouldEnableFlipper(context)) { 28 | final FlipperClient client = AndroidFlipperClient.getInstance(context); 29 | client.addPlugin(new InspectorFlipperPlugin(context, DescriptorMapping.withDefaults())); 30 | client.addPlugin(new ReactFlipperPlugin()); 31 | client.addPlugin(new DatabasesFlipperPlugin(context)); 32 | client.addPlugin(new SharedPreferencesFlipperPlugin(context)); 33 | client.addPlugin(CrashReporterPlugin.getInstance()); 34 | NetworkFlipperPlugin networkFlipperPlugin = new NetworkFlipperPlugin(); 35 | NetworkingModule.setCustomClientBuilder( 36 | new NetworkingModule.CustomClientBuilder() { 37 | @Override 38 | public void apply(OkHttpClient.Builder builder) { 39 | builder.addNetworkInterceptor(new FlipperOkhttpInterceptor(networkFlipperPlugin)); 40 | } 41 | }); 42 | client.addPlugin(networkFlipperPlugin); 43 | client.start(); 44 | // Fresco Plugin needs to ensure that ImagePipelineFactory is initialized 45 | // Hence we run if after all native modules have been initialized 46 | ReactContext reactContext = reactInstanceManager.getCurrentReactContext(); 47 | if (reactContext == null) { 48 | reactInstanceManager.addReactInstanceEventListener( 49 | new ReactInstanceManager.ReactInstanceEventListener() { 50 | @Override 51 | public void onReactContextInitialized(ReactContext reactContext) { 52 | reactInstanceManager.removeReactInstanceEventListener(this); 53 | reactContext.runOnNativeModulesQueueThread( 54 | new Runnable() { 55 | @Override 56 | public void run() { 57 | client.addPlugin(new FrescoFlipperPlugin()); 58 | } 59 | }); 60 | } 61 | }); 62 | } else { 63 | client.addPlugin(new FrescoFlipperPlugin()); 64 | } 65 | } 66 | } 67 | } -------------------------------------------------------------------------------- /Example/android/app/src/main/java/com/swmansion/rnscreens/example/SampleLifecycleAwareViewManager.java: -------------------------------------------------------------------------------- 1 | package com.swmansion.rnscreens.example; 2 | 3 | import android.util.Log; 4 | 5 | import com.facebook.react.module.annotations.ReactModule; 6 | import com.facebook.react.uimanager.ThemedReactContext; 7 | import com.facebook.react.uimanager.ViewGroupManager; 8 | import com.swmansion.rnscreens.LifecycleHelper; 9 | 10 | @ReactModule(name = SampleLifecycleAwareViewManager.REACT_CLASS) 11 | public class SampleLifecycleAwareViewManager extends ViewGroupManager { 12 | 13 | protected static final String REACT_CLASS = "RNSLifecycleAwareView"; 14 | 15 | private LifecycleHelper mLifecycleHelper = new LifecycleHelper(); 16 | 17 | @Override 18 | public String getName() { 19 | return REACT_CLASS; 20 | } 21 | 22 | @Override 23 | protected LifecycleAwareView createViewInstance(ThemedReactContext reactContext) { 24 | LifecycleAwareView view = new LifecycleAwareView(reactContext); 25 | mLifecycleHelper.register(view); 26 | return view; 27 | } 28 | 29 | @Override 30 | public void onDropViewInstance(LifecycleAwareView view) { 31 | mLifecycleHelper.unregister(view); 32 | super.onDropViewInstance(view); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /Example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/osdnk/react-native-cool-modals/8fb5db6ab669ecf6cf4f28c728a1b364eef24511/Example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /Example/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/osdnk/react-native-cool-modals/8fb5db6ab669ecf6cf4f28c728a1b364eef24511/Example/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /Example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/osdnk/react-native-cool-modals/8fb5db6ab669ecf6cf4f28c728a1b364eef24511/Example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /Example/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/osdnk/react-native-cool-modals/8fb5db6ab669ecf6cf4f28c728a1b364eef24511/Example/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /Example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/osdnk/react-native-cool-modals/8fb5db6ab669ecf6cf4f28c728a1b364eef24511/Example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /Example/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/osdnk/react-native-cool-modals/8fb5db6ab669ecf6cf4f28c728a1b364eef24511/Example/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /Example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/osdnk/react-native-cool-modals/8fb5db6ab669ecf6cf4f28c728a1b364eef24511/Example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /Example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/osdnk/react-native-cool-modals/8fb5db6ab669ecf6cf4f28c728a1b364eef24511/Example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /Example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/osdnk/react-native-cool-modals/8fb5db6ab669ecf6cf4f28c728a1b364eef24511/Example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /Example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/osdnk/react-native-cool-modals/8fb5db6ab669ecf6cf4f28c728a1b364eef24511/Example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /Example/android/app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | ScreensExample 3 | 4 | -------------------------------------------------------------------------------- /Example/android/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /Example/android/app/src/main/res/xml/network_security_config.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | localhost 5 | 6 | -------------------------------------------------------------------------------- /Example/android/build.gradle: -------------------------------------------------------------------------------- 1 | // Top-level build file where you can add configuration options common to all sub-projects/modules. 2 | 3 | buildscript { 4 | repositories { 5 | google() 6 | jcenter() 7 | } 8 | dependencies { 9 | classpath("com.android.tools.build:gradle:3.5.2") 10 | } 11 | } 12 | 13 | allprojects { 14 | repositories { 15 | mavenLocal() 16 | google() 17 | maven { 18 | // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm 19 | url "$rootDir/../node_modules/react-native/android" 20 | } 21 | jcenter() 22 | maven { url 'https://www.jitpack.io' } 23 | } 24 | } 25 | 26 | ext { 27 | buildToolsVersion = "29.0.2" 28 | minSdkVersion = 16 29 | compileSdkVersion = 29 30 | targetSdkVersion = 29 31 | } 32 | -------------------------------------------------------------------------------- /Example/android/gradle.properties: -------------------------------------------------------------------------------- 1 | # Project-wide Gradle settings. 2 | 3 | # IDE (e.g. Android Studio) users: 4 | # Gradle settings configured through the IDE *will override* 5 | # any settings specified in this file. 6 | 7 | # For more details on how to configure your build environment visit 8 | # http://www.gradle.org/docs/current/userguide/build_environment.html 9 | 10 | # Specifies the JVM arguments used for the daemon process. 11 | # The setting is particularly useful for tweaking memory settings. 12 | # Default value: -Xmx10248m -XX:MaxPermSize=256m 13 | # org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 14 | 15 | # When configured, Gradle will run in incubating parallel mode. 16 | # This option should only be used with decoupled projects. More details, visit 17 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 18 | # org.gradle.parallel=true 19 | 20 | # AndroidX package structure to make it clearer which packages are bundled with the 21 | # Android operating system, and which are packaged with your app's APK 22 | # https://developer.android.com/topic/libraries/support-library/androidx-rn 23 | android.useAndroidX=true 24 | # Automatically convert third-party libraries to use AndroidX 25 | android.enableJetifier=true 26 | 27 | # Version of flipper SDK to use with React Native 28 | FLIPPER_VERSION=0.33.1 29 | -------------------------------------------------------------------------------- /Example/android/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/osdnk/react-native-cool-modals/8fb5db6ab669ecf6cf4f28c728a1b364eef24511/Example/android/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /Example/android/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | zipStoreBase=GRADLE_USER_HOME 4 | zipStorePath=wrapper/dists 5 | distributionUrl=https\://services.gradle.org/distributions/gradle-6.0.1-all.zip 6 | -------------------------------------------------------------------------------- /Example/android/gradlew: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | # 4 | # Copyright 2015 the original author or authors. 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # https://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | # 18 | 19 | ############################################################################## 20 | ## 21 | ## Gradle start up script for UN*X 22 | ## 23 | ############################################################################## 24 | 25 | # Attempt to set APP_HOME 26 | # Resolve links: $0 may be a link 27 | PRG="$0" 28 | # Need this for relative symlinks. 29 | while [ -h "$PRG" ] ; do 30 | ls=`ls -ld "$PRG"` 31 | link=`expr "$ls" : '.*-> \(.*\)$'` 32 | if expr "$link" : '/.*' > /dev/null; then 33 | PRG="$link" 34 | else 35 | PRG=`dirname "$PRG"`"/$link" 36 | fi 37 | done 38 | SAVED="`pwd`" 39 | cd "`dirname \"$PRG\"`/" >/dev/null 40 | APP_HOME="`pwd -P`" 41 | cd "$SAVED" >/dev/null 42 | 43 | APP_NAME="Gradle" 44 | APP_BASE_NAME=`basename "$0"` 45 | 46 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 47 | DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' 48 | 49 | # Use the maximum available, or set MAX_FD != -1 to use that value. 50 | MAX_FD="maximum" 51 | 52 | warn () { 53 | echo "$*" 54 | } 55 | 56 | die () { 57 | echo 58 | echo "$*" 59 | echo 60 | exit 1 61 | } 62 | 63 | # OS specific support (must be 'true' or 'false'). 64 | cygwin=false 65 | msys=false 66 | darwin=false 67 | nonstop=false 68 | case "`uname`" in 69 | CYGWIN* ) 70 | cygwin=true 71 | ;; 72 | Darwin* ) 73 | darwin=true 74 | ;; 75 | MINGW* ) 76 | msys=true 77 | ;; 78 | NONSTOP* ) 79 | nonstop=true 80 | ;; 81 | esac 82 | 83 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 84 | 85 | # Determine the Java command to use to start the JVM. 86 | if [ -n "$JAVA_HOME" ] ; then 87 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 88 | # IBM's JDK on AIX uses strange locations for the executables 89 | JAVACMD="$JAVA_HOME/jre/sh/java" 90 | else 91 | JAVACMD="$JAVA_HOME/bin/java" 92 | fi 93 | if [ ! -x "$JAVACMD" ] ; then 94 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 95 | 96 | Please set the JAVA_HOME variable in your environment to match the 97 | location of your Java installation." 98 | fi 99 | else 100 | JAVACMD="java" 101 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 102 | 103 | Please set the JAVA_HOME variable in your environment to match the 104 | location of your Java installation." 105 | fi 106 | 107 | # Increase the maximum file descriptors if we can. 108 | if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then 109 | MAX_FD_LIMIT=`ulimit -H -n` 110 | if [ $? -eq 0 ] ; then 111 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then 112 | MAX_FD="$MAX_FD_LIMIT" 113 | fi 114 | ulimit -n $MAX_FD 115 | if [ $? -ne 0 ] ; then 116 | warn "Could not set maximum file descriptor limit: $MAX_FD" 117 | fi 118 | else 119 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" 120 | fi 121 | fi 122 | 123 | # For Darwin, add options to specify how the application appears in the dock 124 | if $darwin; then 125 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" 126 | fi 127 | 128 | # For Cygwin or MSYS, switch paths to Windows format before running java 129 | if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then 130 | APP_HOME=`cygpath --path --mixed "$APP_HOME"` 131 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` 132 | JAVACMD=`cygpath --unix "$JAVACMD"` 133 | 134 | # We build the pattern for arguments to be converted via cygpath 135 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` 136 | SEP="" 137 | for dir in $ROOTDIRSRAW ; do 138 | ROOTDIRS="$ROOTDIRS$SEP$dir" 139 | SEP="|" 140 | done 141 | OURCYGPATTERN="(^($ROOTDIRS))" 142 | # Add a user-defined pattern to the cygpath arguments 143 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then 144 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" 145 | fi 146 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 147 | i=0 148 | for arg in "$@" ; do 149 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` 150 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option 151 | 152 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition 153 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` 154 | else 155 | eval `echo args$i`="\"$arg\"" 156 | fi 157 | i=$((i+1)) 158 | done 159 | case $i in 160 | (0) set -- ;; 161 | (1) set -- "$args0" ;; 162 | (2) set -- "$args0" "$args1" ;; 163 | (3) set -- "$args0" "$args1" "$args2" ;; 164 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;; 165 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; 166 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; 167 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; 168 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; 169 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; 170 | esac 171 | fi 172 | 173 | # Escape application args 174 | save () { 175 | for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done 176 | echo " " 177 | } 178 | APP_ARGS=$(save "$@") 179 | 180 | # Collect all arguments for the java command, following the shell quoting and substitution rules 181 | eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" 182 | 183 | # by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong 184 | if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then 185 | cd "$(dirname "$0")" 186 | fi 187 | 188 | exec "$JAVACMD" "$@" 189 | -------------------------------------------------------------------------------- /Example/android/gradlew.bat: -------------------------------------------------------------------------------- 1 | @rem 2 | @rem Copyright 2015 the original author or authors. 3 | @rem 4 | @rem Licensed under the Apache License, Version 2.0 (the "License"); 5 | @rem you may not use this file except in compliance with the License. 6 | @rem You may obtain a copy of the License at 7 | @rem 8 | @rem https://www.apache.org/licenses/LICENSE-2.0 9 | @rem 10 | @rem Unless required by applicable law or agreed to in writing, software 11 | @rem distributed under the License is distributed on an "AS IS" BASIS, 12 | @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | @rem See the License for the specific language governing permissions and 14 | @rem limitations under the License. 15 | @rem 16 | 17 | @if "%DEBUG%" == "" @echo off 18 | @rem ########################################################################## 19 | @rem 20 | @rem Gradle startup script for Windows 21 | @rem 22 | @rem ########################################################################## 23 | 24 | @rem Set local scope for the variables with windows NT shell 25 | if "%OS%"=="Windows_NT" setlocal 26 | 27 | set DIRNAME=%~dp0 28 | if "%DIRNAME%" == "" set DIRNAME=. 29 | set APP_BASE_NAME=%~n0 30 | set APP_HOME=%DIRNAME% 31 | 32 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 33 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" 34 | 35 | @rem Find java.exe 36 | if defined JAVA_HOME goto findJavaFromJavaHome 37 | 38 | set JAVA_EXE=java.exe 39 | %JAVA_EXE% -version >NUL 2>&1 40 | if "%ERRORLEVEL%" == "0" goto init 41 | 42 | echo. 43 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 44 | echo. 45 | echo Please set the JAVA_HOME variable in your environment to match the 46 | echo location of your Java installation. 47 | 48 | goto fail 49 | 50 | :findJavaFromJavaHome 51 | set JAVA_HOME=%JAVA_HOME:"=% 52 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 53 | 54 | if exist "%JAVA_EXE%" goto init 55 | 56 | echo. 57 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 58 | echo. 59 | echo Please set the JAVA_HOME variable in your environment to match the 60 | echo location of your Java installation. 61 | 62 | goto fail 63 | 64 | :init 65 | @rem Get command-line arguments, handling Windows variants 66 | 67 | if not "%OS%" == "Windows_NT" goto win9xME_args 68 | 69 | :win9xME_args 70 | @rem Slurp the command line arguments. 71 | set CMD_LINE_ARGS= 72 | set _SKIP=2 73 | 74 | :win9xME_args_slurp 75 | if "x%~1" == "x" goto execute 76 | 77 | set CMD_LINE_ARGS=%* 78 | 79 | :execute 80 | @rem Setup the command line 81 | 82 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 83 | 84 | @rem Execute Gradle 85 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 86 | 87 | :end 88 | @rem End local scope for the variables with windows NT shell 89 | if "%ERRORLEVEL%"=="0" goto mainEnd 90 | 91 | :fail 92 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 93 | rem the _cmd.exe /c_ return code! 94 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 95 | exit /b 1 96 | 97 | :mainEnd 98 | if "%OS%"=="Windows_NT" endlocal 99 | 100 | :omega 101 | -------------------------------------------------------------------------------- /Example/android/keystores/BUCK: -------------------------------------------------------------------------------- 1 | keystore( 2 | name = "debug", 3 | properties = "debug.keystore.properties", 4 | store = "debug.keystore", 5 | visibility = [ 6 | "PUBLIC", 7 | ], 8 | ) 9 | -------------------------------------------------------------------------------- /Example/android/keystores/debug.keystore.properties: -------------------------------------------------------------------------------- 1 | key.store=debug.keystore 2 | key.alias=androiddebugkey 3 | key.store.password=android 4 | key.alias.password=android 5 | -------------------------------------------------------------------------------- /Example/android/settings.gradle: -------------------------------------------------------------------------------- 1 | rootProject.name = 'ScreensExample' 2 | 3 | apply from: file("../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesSettingsGradle(settings) 4 | 5 | include ':react-native-screens' 6 | project(':react-native-screens').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-screens/android') 7 | 8 | include ':app' 9 | -------------------------------------------------------------------------------- /Example/app.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "ScreensExample", 3 | "displayName": "ScreensExample" 4 | } -------------------------------------------------------------------------------- /Example/index.js: -------------------------------------------------------------------------------- 1 | /** @format */ 2 | 3 | import {AppRegistry} from 'react-native'; 4 | import App from './App'; 5 | import {name as appName} from './app.json'; 6 | 7 | AppRegistry.registerComponent(appName, () => App); 8 | -------------------------------------------------------------------------------- /Example/ios/File.swift: -------------------------------------------------------------------------------- 1 | // 2 | // File.swift 3 | // ScreensExample 4 | // 5 | // Created by Michał Osadnik on 21/03/2020. 6 | // Copyright © 2020 Facebook. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | -------------------------------------------------------------------------------- /Example/ios/Podfile: -------------------------------------------------------------------------------- 1 | platform :ios, '10.0' 2 | require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules' 3 | 4 | def add_flipper_pods! 5 | version = '~> 0.33.1' 6 | pod 'FlipperKit', version, :configuration => 'Debug' 7 | pod 'FlipperKit/FlipperKitLayoutPlugin', version, :configuration => 'Debug' 8 | pod 'FlipperKit/SKIOSNetworkPlugin', version, :configuration => 'Debug' 9 | pod 'FlipperKit/FlipperKitUserDefaultsPlugin', version, :configuration => 'Debug' 10 | pod 'FlipperKit/FlipperKitReactPlugin', version, :configuration => 'Debug' 11 | end 12 | 13 | # Post Install processing for Flipper 14 | def flipper_post_install(installer) 15 | installer.pods_project.targets.each do |target| 16 | if target.name == 'YogaKit' 17 | target.build_configurations.each do |config| 18 | config.build_settings['SWIFT_VERSION'] = '4.1' 19 | end 20 | end 21 | end 22 | end 23 | 24 | target 'ScreensExample' do 25 | # Pods for RnDiffApp 26 | pod 'FBLazyVector', :path => "../node_modules/react-native/Libraries/FBLazyVector" 27 | pod 'FBReactNativeSpec', :path => "../node_modules/react-native/Libraries/FBReactNativeSpec" 28 | pod 'RCTRequired', :path => "../node_modules/react-native/Libraries/RCTRequired" 29 | pod 'RCTTypeSafety', :path => "../node_modules/react-native/Libraries/TypeSafety" 30 | pod 'React', :path => '../node_modules/react-native/' 31 | pod 'React-Core', :path => '../node_modules/react-native/' 32 | pod 'React-CoreModules', :path => '../node_modules/react-native/React/CoreModules' 33 | pod 'React-Core/DevSupport', :path => '../node_modules/react-native/' 34 | pod 'React-RCTActionSheet', :path => '../node_modules/react-native/Libraries/ActionSheetIOS' 35 | pod 'React-RCTAnimation', :path => '../node_modules/react-native/Libraries/NativeAnimation' 36 | pod 'React-RCTBlob', :path => '../node_modules/react-native/Libraries/Blob' 37 | pod 'React-RCTImage', :path => '../node_modules/react-native/Libraries/Image' 38 | pod 'React-RCTLinking', :path => '../node_modules/react-native/Libraries/LinkingIOS' 39 | pod 'React-RCTNetwork', :path => '../node_modules/react-native/Libraries/Network' 40 | pod 'React-RCTSettings', :path => '../node_modules/react-native/Libraries/Settings' 41 | pod 'React-RCTText', :path => '../node_modules/react-native/Libraries/Text' 42 | pod 'React-RCTVibration', :path => '../node_modules/react-native/Libraries/Vibration' 43 | pod 'React-Core/RCTWebSocket', :path => '../node_modules/react-native/' 44 | 45 | pod 'React-cxxreact', :path => '../node_modules/react-native/ReactCommon/cxxreact' 46 | pod 'React-jsi', :path => '../node_modules/react-native/ReactCommon/jsi' 47 | pod 'React-jsiexecutor', :path => '../node_modules/react-native/ReactCommon/jsiexecutor' 48 | pod 'React-jsinspector', :path => '../node_modules/react-native/ReactCommon/jsinspector' 49 | pod 'ReactCommon/callinvoker', :path => "../node_modules/react-native/ReactCommon" 50 | pod 'ReactCommon/turbomodule/core', :path => "../node_modules/react-native/ReactCommon" 51 | pod 'Yoga', :path => '../node_modules/react-native/ReactCommon/yoga', :modular_headers => true 52 | 53 | pod 'DoubleConversion', :podspec => '../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec' 54 | pod 'glog', :podspec => '../node_modules/react-native/third-party-podspecs/glog.podspec' 55 | pod 'Folly', :podspec => '../node_modules/react-native/third-party-podspecs/Folly.podspec' 56 | use_native_modules! 57 | 58 | # Enables Flipper. 59 | # 60 | # Note that if you have use_frameworks! enabled, Flipper will not work and 61 | # you should disable these next few lines. 62 | add_flipper_pods! 63 | post_install do |installer| 64 | flipper_post_install(installer) 65 | end 66 | end 67 | -------------------------------------------------------------------------------- /Example/ios/ScreensExample-Bridging-Header.h: -------------------------------------------------------------------------------- 1 | // 2 | // Use this file to import your target's public headers that you would like to expose to Swift. 3 | // 4 | 5 | -------------------------------------------------------------------------------- /Example/ios/ScreensExample-tvOS/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | LSRequiresIPhoneOS 24 | 25 | UILaunchStoryboardName 26 | LaunchScreen 27 | UIRequiredDeviceCapabilities 28 | 29 | armv7 30 | 31 | UISupportedInterfaceOrientations 32 | 33 | UIInterfaceOrientationPortrait 34 | UIInterfaceOrientationLandscapeLeft 35 | UIInterfaceOrientationLandscapeRight 36 | 37 | UIViewControllerBasedStatusBarAppearance 38 | 39 | NSLocationWhenInUseUsageDescription 40 | 41 | NSAppTransportSecurity 42 | 43 | 44 | NSExceptionDomains 45 | 46 | localhost 47 | 48 | NSExceptionAllowsInsecureHTTPLoads 49 | 50 | 51 | 52 | 53 | 54 | 55 | -------------------------------------------------------------------------------- /Example/ios/ScreensExample-tvOSTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | 24 | 25 | -------------------------------------------------------------------------------- /Example/ios/ScreensExample.xcodeproj/xcshareddata/xcschemes/ScreensExample-tvOS.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 33 | 39 | 40 | 41 | 42 | 43 | 53 | 55 | 61 | 62 | 63 | 64 | 70 | 72 | 78 | 79 | 80 | 81 | 83 | 84 | 87 | 88 | 89 | -------------------------------------------------------------------------------- /Example/ios/ScreensExample.xcodeproj/xcshareddata/xcschemes/ScreensExample.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 33 | 39 | 40 | 41 | 42 | 43 | 53 | 55 | 61 | 62 | 63 | 64 | 70 | 72 | 78 | 79 | 80 | 81 | 83 | 84 | 87 | 88 | 89 | -------------------------------------------------------------------------------- /Example/ios/ScreensExample.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /Example/ios/ScreensExample.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /Example/ios/ScreensExample/AppDelegate.h: -------------------------------------------------------------------------------- 1 | #import 2 | #import 3 | 4 | @interface AppDelegate : UIResponder 5 | 6 | @property(nonatomic, strong) UIWindow *window; 7 | 8 | @end 9 | -------------------------------------------------------------------------------- /Example/ios/ScreensExample/AppDelegate.m: -------------------------------------------------------------------------------- 1 | #import "AppDelegate.h" 2 | 3 | #import 4 | #import 5 | 6 | #import 7 | #import 8 | #import 9 | #import 10 | #import 11 | #import 12 | 13 | static void InitializeFlipper(UIApplication *application) { 14 | FlipperClient *client = [FlipperClient sharedClient]; 15 | SKDescriptorMapper *layoutDescriptorMapper = [[SKDescriptorMapper alloc] initWithDefaults]; 16 | [client addPlugin:[[FlipperKitLayoutPlugin alloc] initWithRootNode:application withDescriptorMapper:layoutDescriptorMapper]]; 17 | [client addPlugin:[[FKUserDefaultsPlugin alloc] initWithSuiteName:nil]]; 18 | [client addPlugin:[FlipperKitReactPlugin new]]; 19 | [client addPlugin:[[FlipperKitNetworkPlugin alloc] initWithNetworkAdapter:[SKIOSNetworkAdapter new]]]; 20 | [client start]; 21 | } 22 | 23 | @implementation AppDelegate 24 | 25 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 26 | { 27 | #if DEBUG 28 | InitializeFlipper(application); 29 | #endif 30 | 31 | RCTBridge *bridge = [[RCTBridge alloc] initWithDelegate:self launchOptions:launchOptions]; 32 | RCTRootView *rootView = [[RCTRootView alloc] initWithBridge:bridge 33 | moduleName:@"ScreensExample" 34 | initialProperties:nil]; 35 | rootView.backgroundColor = [[UIColor alloc] initWithRed:1.0f green:1.0f blue:1.0f alpha:1]; 36 | 37 | self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds]; 38 | UIViewController *rootViewController = [UIViewController new]; 39 | rootViewController.view = rootView; 40 | self.window.rootViewController = rootViewController; 41 | [self.window makeKeyAndVisible]; 42 | return YES; 43 | } 44 | 45 | 46 | - (NSURL *)sourceURLForBridge:(RCTBridge *)bridge 47 | { 48 | #if DEBUG 49 | return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index" fallbackResource:nil]; 50 | #else 51 | return [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"]; 52 | #endif 53 | } 54 | 55 | @end 56 | -------------------------------------------------------------------------------- /Example/ios/ScreensExample/Base.lproj/LaunchScreen.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 21 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /Example/ios/ScreensExample/Images.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "29x29", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "29x29", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "40x40", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "40x40", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "60x60", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "60x60", 31 | "scale" : "3x" 32 | } 33 | ], 34 | "info" : { 35 | "version" : 1, 36 | "author" : "xcode" 37 | } 38 | } -------------------------------------------------------------------------------- /Example/ios/ScreensExample/Images.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /Example/ios/ScreensExample/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleDisplayName 8 | ScreensExample 9 | CFBundleExecutable 10 | $(EXECUTABLE_NAME) 11 | CFBundleIdentifier 12 | org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier) 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | $(PRODUCT_NAME) 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 1 25 | LSRequiresIPhoneOS 26 | 27 | UILaunchStoryboardName 28 | LaunchScreen 29 | UIRequiredDeviceCapabilities 30 | 31 | armv7 32 | 33 | UISupportedInterfaceOrientations 34 | 35 | UIInterfaceOrientationPortrait 36 | UIInterfaceOrientationLandscapeLeft 37 | UIInterfaceOrientationLandscapeRight 38 | 39 | UIViewControllerBasedStatusBarAppearance 40 | 41 | NSLocationWhenInUseUsageDescription 42 | 43 | NSAppTransportSecurity 44 | 45 | 46 | NSExceptionDomains 47 | 48 | localhost 49 | 50 | NSExceptionAllowsInsecureHTTPLoads 51 | 52 | 53 | 54 | 55 | 56 | 57 | -------------------------------------------------------------------------------- /Example/ios/ScreensExample/RNSSampleLifecycleAwareView.m: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | @interface RNSLifecycleAwareView : UIView 4 | @end 5 | 6 | @implementation RNSLifecycleAwareView 7 | 8 | - (void)didMoveToWindow 9 | { 10 | [super didMoveToWindow]; 11 | BOOL isVisible = self.superview && self.window; 12 | if (isVisible) { 13 | NSLog(@"ATTACHED"); 14 | } else { 15 | NSLog(@"DETTACHED"); 16 | } 17 | } 18 | 19 | @end 20 | 21 | @interface RNSLifecycleAwareViewManager : RCTViewManager 22 | @end 23 | 24 | @implementation RNSLifecycleAwareViewManager 25 | 26 | RCT_EXPORT_MODULE() 27 | 28 | - (UIView *)view 29 | { 30 | return [RNSLifecycleAwareView new]; 31 | } 32 | 33 | @end 34 | -------------------------------------------------------------------------------- /Example/ios/ScreensExample/main.m: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | #import "AppDelegate.h" 4 | 5 | int main(int argc, char * argv[]) { 6 | @autoreleasepool { 7 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /Example/ios/ScreensExampleTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | 24 | 25 | -------------------------------------------------------------------------------- /Example/ios/ScreensExampleTests/ScreensExampleTests.m: -------------------------------------------------------------------------------- 1 | #import 2 | #import 3 | 4 | #import 5 | #import 6 | 7 | #define TIMEOUT_SECONDS 600 8 | #define TEXT_TO_LOOK_FOR @"Welcome to React" 9 | 10 | @interface ScreensExampleTests : XCTestCase 11 | 12 | @end 13 | 14 | @implementation ScreensExampleTests 15 | 16 | - (BOOL)findSubviewInView:(UIView *)view matching:(BOOL(^)(UIView *view))test 17 | { 18 | if (test(view)) { 19 | return YES; 20 | } 21 | for (UIView *subview in [view subviews]) { 22 | if ([self findSubviewInView:subview matching:test]) { 23 | return YES; 24 | } 25 | } 26 | return NO; 27 | } 28 | 29 | - (void)testRendersWelcomeScreen 30 | { 31 | UIViewController *vc = [[[RCTSharedApplication() delegate] window] rootViewController]; 32 | NSDate *date = [NSDate dateWithTimeIntervalSinceNow:TIMEOUT_SECONDS]; 33 | BOOL foundElement = NO; 34 | 35 | __block NSString *redboxError = nil; 36 | #ifdef DEBUG 37 | RCTSetLogFunction(^(RCTLogLevel level, RCTLogSource source, NSString *fileName, NSNumber *lineNumber, NSString *message) { 38 | if (level >= RCTLogLevelError) { 39 | redboxError = message; 40 | } 41 | }); 42 | #endif 43 | 44 | while ([date timeIntervalSinceNow] > 0 && !foundElement && !redboxError) { 45 | [[NSRunLoop mainRunLoop] runMode:NSDefaultRunLoopMode beforeDate:[NSDate dateWithTimeIntervalSinceNow:0.1]]; 46 | [[NSRunLoop mainRunLoop] runMode:NSRunLoopCommonModes beforeDate:[NSDate dateWithTimeIntervalSinceNow:0.1]]; 47 | 48 | foundElement = [self findSubviewInView:vc.view matching:^BOOL(UIView *view) { 49 | if ([view.accessibilityLabel isEqualToString:TEXT_TO_LOOK_FOR]) { 50 | return YES; 51 | } 52 | return NO; 53 | }]; 54 | } 55 | 56 | #ifdef DEBUG 57 | RCTSetLogFunction(RCTDefaultLogFunction); 58 | #endif 59 | 60 | XCTAssertNil(redboxError, @"RedBox error: %@", redboxError); 61 | XCTAssertTrue(foundElement, @"Couldn't find element with text '%@' in %d seconds", TEXT_TO_LOOK_FOR, TIMEOUT_SECONDS); 62 | } 63 | 64 | 65 | @end 66 | -------------------------------------------------------------------------------- /Example/metro.config.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Metro configuration for React Native 3 | * https://github.com/facebook/react-native 4 | * 5 | * @format 6 | */ 7 | module.exports = { 8 | transformer: { 9 | getTransformOptions: async () => ({ 10 | transform: { 11 | experimentalImportSupport: false, 12 | inlineRequires: false, 13 | }, 14 | }), 15 | }, 16 | }; 17 | -------------------------------------------------------------------------------- /Example/nativeNavigation.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { TextInput, StyleSheet, Button, View, ScrollView } from 'react-native'; 3 | import createNativeStackNavigator from 'react-native-cool-modals/createNativeStackNavigator'; 4 | 5 | let key = 1; 6 | 7 | class PushScreen extends React.Component { 8 | static route = { 9 | navigationBar: { 10 | visible: false, 11 | }, 12 | }; 13 | render() { 14 | return ( 15 | 16 | 17 | 18 |