\\)? *\\(site=[a-z,_]*react_native\\(_ios\\)?_\\(oss\\|fb\\)[a-z,_]*\\)?)\\)?:? #[0-9]+
50 | suppress_comment=\\(.\\|\n\\)*\\$FlowExpectedError
51 |
52 | [lints]
53 | sketchy-null-number=warn
54 | sketchy-null-mixed=warn
55 | sketchy-number=warn
56 | untyped-type-import=warn
57 | nonstrict-import=warn
58 | deprecated-type=warn
59 | unsafe-getters-setters=warn
60 | inexact-spread=warn
61 | unnecessary-invariant=warn
62 | signature-verification-failure=warn
63 | deprecated-utility=error
64 |
65 | [strict]
66 | deprecated-type
67 | nonstrict-import
68 | sketchy-null
69 | unclear-type
70 | unsafe-getters-setters
71 | untyped-import
72 | untyped-type-import
73 |
74 | [version]
75 | ^0.105.0
76 |
--------------------------------------------------------------------------------
/examples/react-native/.gitattributes:
--------------------------------------------------------------------------------
1 | *.pbxproj -text
2 |
--------------------------------------------------------------------------------
/examples/react-native/.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 | !debug.keystore
43 |
44 | # fastlane
45 | #
46 | # It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the
47 | # screenshots whenever they are needed.
48 | # For more information about the recommended setup visit:
49 | # https://docs.fastlane.tools/best-practices/source-control/
50 |
51 | */fastlane/report.xml
52 | */fastlane/Preview.html
53 | */fastlane/screenshots
54 |
55 | # Bundle artifact
56 | *.jsbundle
57 |
58 | # CocoaPods
59 | /ios/Pods/
60 |
--------------------------------------------------------------------------------
/examples/react-native/.npmignore:
--------------------------------------------------------------------------------
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 | # node.js
25 | #
26 | node_modules/
27 | npm-debug.log
28 |
--------------------------------------------------------------------------------
/examples/react-native/.prettierrc.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | bracketSpacing: false,
3 | jsxBracketSameLine: true,
4 | singleQuote: true,
5 | trailingComma: 'all',
6 | };
7 |
--------------------------------------------------------------------------------
/examples/react-native/.watchmanconfig:
--------------------------------------------------------------------------------
1 | {}
2 |
--------------------------------------------------------------------------------
/examples/react-native/__tests__/App-test.js:
--------------------------------------------------------------------------------
1 | /**
2 | * @format
3 | */
4 |
5 | import 'react-native';
6 | import React from 'react';
7 | import App from '../App';
8 |
9 | // Note: test renderer must be required after react-native.
10 | import renderer from 'react-test-renderer';
11 |
12 | it('renders correctly', () => {
13 | renderer.create();
14 | });
15 |
--------------------------------------------------------------------------------
/examples/react-native/android/app/BUCK:
--------------------------------------------------------------------------------
1 | # To learn about Buck see [Docs](https://buckbuild.com/).
2 | # To run your application with Buck:
3 | # - install Buck
4 | # - `npm start` - to start the packager
5 | # - `cd android`
6 | # - `keytool -genkey -v -keystore keystores/debug.keystore -storepass android -alias androiddebugkey -keypass android -dname "CN=Android Debug,O=Android,C=US"`
7 | # - `./gradlew :app:copyDownloadableDepsToLibs` - make all Gradle compile dependencies available to Buck
8 | # - `buck install -r android/app` - compile, install and run application
9 | #
10 |
11 | load(":build_defs.bzl", "create_aar_targets", "create_jar_targets")
12 |
13 | lib_deps = []
14 |
15 | create_aar_targets(glob(["libs/*.aar"]))
16 |
17 | create_jar_targets(glob(["libs/*.jar"]))
18 |
19 | android_library(
20 | name = "all-libs",
21 | exported_deps = lib_deps,
22 | )
23 |
24 | android_library(
25 | name = "app-code",
26 | srcs = glob([
27 | "src/main/java/**/*.java",
28 | ]),
29 | deps = [
30 | ":all-libs",
31 | ":build_config",
32 | ":res",
33 | ],
34 | )
35 |
36 | android_build_config(
37 | name = "build_config",
38 | package = "com.example",
39 | )
40 |
41 | android_resource(
42 | name = "res",
43 | package = "com.example",
44 | res = "src/main/res",
45 | )
46 |
47 | android_binary(
48 | name = "app",
49 | keystore = "//android/keystores:debug",
50 | manifest = "src/main/AndroidManifest.xml",
51 | package_type = "debug",
52 | deps = [
53 | ":app-code",
54 | ],
55 | )
56 |
--------------------------------------------------------------------------------
/examples/react-native/android/app/build_defs.bzl:
--------------------------------------------------------------------------------
1 | """Helper definitions to glob .aar and .jar targets"""
2 |
3 | def create_aar_targets(aarfiles):
4 | for aarfile in aarfiles:
5 | name = "aars__" + aarfile[aarfile.rindex("/") + 1:aarfile.rindex(".aar")]
6 | lib_deps.append(":" + name)
7 | android_prebuilt_aar(
8 | name = name,
9 | aar = aarfile,
10 | )
11 |
12 | def create_jar_targets(jarfiles):
13 | for jarfile in jarfiles:
14 | name = "jars__" + jarfile[jarfile.rindex("/") + 1:jarfile.rindex(".jar")]
15 | lib_deps.append(":" + name)
16 | prebuilt_jar(
17 | name = name,
18 | binary_jar = jarfile,
19 | )
20 |
--------------------------------------------------------------------------------
/examples/react-native/android/app/debug.keystore:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aksonov/react-native-router-flux/b6e8e71aaa5301740724ebbc7bf3dbad5fda0696/examples/react-native/android/app/debug.keystore
--------------------------------------------------------------------------------
/examples/react-native/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 |
--------------------------------------------------------------------------------
/examples/react-native/android/app/src/debug/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/examples/react-native/android/app/src/debug/java/com/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.example;
8 |
9 | import android.content.Context;
10 | import com.facebook.flipper.android.AndroidFlipperClient;
11 | import com.facebook.flipper.android.utils.FlipperUtils;
12 | import com.facebook.flipper.core.FlipperClient;
13 | import com.facebook.flipper.plugins.crashreporter.CrashReporterPlugin;
14 | import com.facebook.flipper.plugins.databases.DatabasesFlipperPlugin;
15 | import com.facebook.flipper.plugins.fresco.FrescoFlipperPlugin;
16 | import com.facebook.flipper.plugins.inspector.DescriptorMapping;
17 | import com.facebook.flipper.plugins.inspector.InspectorFlipperPlugin;
18 | import com.facebook.flipper.plugins.network.FlipperOkhttpInterceptor;
19 | import com.facebook.flipper.plugins.network.NetworkFlipperPlugin;
20 | import com.facebook.flipper.plugins.react.ReactFlipperPlugin;
21 | import com.facebook.flipper.plugins.sharedpreferences.SharedPreferencesFlipperPlugin;
22 | import com.facebook.react.ReactInstanceManager;
23 | import com.facebook.react.bridge.ReactContext;
24 | import com.facebook.react.modules.network.NetworkingModule;
25 | import okhttp3.OkHttpClient;
26 |
27 | public class ReactNativeFlipper {
28 | public static void initializeFlipper(Context context, ReactInstanceManager reactInstanceManager) {
29 | if (FlipperUtils.shouldEnableFlipper(context)) {
30 | final FlipperClient client = AndroidFlipperClient.getInstance(context);
31 |
32 | client.addPlugin(new InspectorFlipperPlugin(context, DescriptorMapping.withDefaults()));
33 | client.addPlugin(new ReactFlipperPlugin());
34 | client.addPlugin(new DatabasesFlipperPlugin(context));
35 | client.addPlugin(new SharedPreferencesFlipperPlugin(context));
36 | client.addPlugin(CrashReporterPlugin.getInstance());
37 |
38 | NetworkFlipperPlugin networkFlipperPlugin = new NetworkFlipperPlugin();
39 | NetworkingModule.setCustomClientBuilder(
40 | new NetworkingModule.CustomClientBuilder() {
41 | @Override
42 | public void apply(OkHttpClient.Builder builder) {
43 | builder.addNetworkInterceptor(new FlipperOkhttpInterceptor(networkFlipperPlugin));
44 | }
45 | });
46 | client.addPlugin(networkFlipperPlugin);
47 | client.start();
48 |
49 | // Fresco Plugin needs to ensure that ImagePipelineFactory is initialized
50 | // Hence we run if after all native modules have been initialized
51 | ReactContext reactContext = reactInstanceManager.getCurrentReactContext();
52 | if (reactContext == null) {
53 | reactInstanceManager.addReactInstanceEventListener(
54 | new ReactInstanceManager.ReactInstanceEventListener() {
55 | @Override
56 | public void onReactContextInitialized(ReactContext reactContext) {
57 | reactInstanceManager.removeReactInstanceEventListener(this);
58 | reactContext.runOnNativeModulesQueueThread(
59 | new Runnable() {
60 | @Override
61 | public void run() {
62 | client.addPlugin(new FrescoFlipperPlugin());
63 | }
64 | });
65 | }
66 | });
67 | } else {
68 | client.addPlugin(new FrescoFlipperPlugin());
69 | }
70 | }
71 | }
72 | }
73 |
--------------------------------------------------------------------------------
/examples/react-native/android/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
4 |
5 |
6 |
13 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
--------------------------------------------------------------------------------
/examples/react-native/android/app/src/main/java/com/example/MainActivity.java:
--------------------------------------------------------------------------------
1 | package com.example;
2 |
3 | import com.facebook.react.ReactActivity;
4 |
5 | public class MainActivity extends ReactActivity {
6 |
7 | /**
8 | * Returns the name of the main component registered from JavaScript. This is used to schedule
9 | * rendering of the component.
10 | */
11 | @Override
12 | protected String getMainComponentName() {
13 | return "Example";
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/examples/react-native/android/app/src/main/java/com/example/MainApplication.java:
--------------------------------------------------------------------------------
1 | package com.example;
2 |
3 | import android.app.Application;
4 | import android.content.Context;
5 | import com.facebook.react.PackageList;
6 | import com.facebook.react.ReactApplication;
7 | import com.facebook.react.ReactInstanceManager;
8 | import com.facebook.react.ReactNativeHost;
9 | import com.facebook.react.ReactPackage;
10 | import com.facebook.soloader.SoLoader;
11 | import java.lang.reflect.InvocationTargetException;
12 | import java.util.List;
13 |
14 | public class MainApplication extends Application implements ReactApplication {
15 |
16 | private final ReactNativeHost mReactNativeHost =
17 | new ReactNativeHost(this) {
18 | @Override
19 | public boolean getUseDeveloperSupport() {
20 | return BuildConfig.DEBUG;
21 | }
22 |
23 | @Override
24 | protected List getPackages() {
25 | @SuppressWarnings("UnnecessaryLocalVariable")
26 | List packages = new PackageList(this).getPackages();
27 | // Packages that cannot be autolinked yet can be added manually here, for example:
28 | // packages.add(new MyReactNativePackage());
29 | return packages;
30 | }
31 |
32 | @Override
33 | protected String getJSMainModuleName() {
34 | return "index";
35 | }
36 | };
37 |
38 | @Override
39 | public ReactNativeHost getReactNativeHost() {
40 | return mReactNativeHost;
41 | }
42 |
43 | @Override
44 | public void onCreate() {
45 | super.onCreate();
46 | SoLoader.init(this, /* native exopackage */ false);
47 | initializeFlipper(this, getReactNativeHost().getReactInstanceManager());
48 | }
49 |
50 | /**
51 | * Loads Flipper in React Native templates. Call this in the onCreate method with something like
52 | * initializeFlipper(this, getReactNativeHost().getReactInstanceManager());
53 | *
54 | * @param context
55 | * @param reactInstanceManager
56 | */
57 | private static void initializeFlipper(
58 | Context context, ReactInstanceManager reactInstanceManager) {
59 | if (BuildConfig.DEBUG) {
60 | try {
61 | /*
62 | We use reflection here to pick up the class that initializes Flipper,
63 | since Flipper library is not available in release mode
64 | */
65 | Class> aClass = Class.forName("com.example.ReactNativeFlipper");
66 | aClass
67 | .getMethod("initializeFlipper", Context.class, ReactInstanceManager.class)
68 | .invoke(null, context, reactInstanceManager);
69 | } catch (ClassNotFoundException e) {
70 | e.printStackTrace();
71 | } catch (NoSuchMethodException e) {
72 | e.printStackTrace();
73 | } catch (IllegalAccessException e) {
74 | e.printStackTrace();
75 | } catch (InvocationTargetException e) {
76 | e.printStackTrace();
77 | }
78 | }
79 | }
80 | }
81 |
--------------------------------------------------------------------------------
/examples/react-native/android/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aksonov/react-native-router-flux/b6e8e71aaa5301740724ebbc7bf3dbad5fda0696/examples/react-native/android/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/examples/react-native/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aksonov/react-native-router-flux/b6e8e71aaa5301740724ebbc7bf3dbad5fda0696/examples/react-native/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/examples/react-native/android/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aksonov/react-native-router-flux/b6e8e71aaa5301740724ebbc7bf3dbad5fda0696/examples/react-native/android/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/examples/react-native/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aksonov/react-native-router-flux/b6e8e71aaa5301740724ebbc7bf3dbad5fda0696/examples/react-native/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/examples/react-native/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aksonov/react-native-router-flux/b6e8e71aaa5301740724ebbc7bf3dbad5fda0696/examples/react-native/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/examples/react-native/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aksonov/react-native-router-flux/b6e8e71aaa5301740724ebbc7bf3dbad5fda0696/examples/react-native/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/examples/react-native/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aksonov/react-native-router-flux/b6e8e71aaa5301740724ebbc7bf3dbad5fda0696/examples/react-native/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/examples/react-native/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aksonov/react-native-router-flux/b6e8e71aaa5301740724ebbc7bf3dbad5fda0696/examples/react-native/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/examples/react-native/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aksonov/react-native-router-flux/b6e8e71aaa5301740724ebbc7bf3dbad5fda0696/examples/react-native/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/examples/react-native/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aksonov/react-native-router-flux/b6e8e71aaa5301740724ebbc7bf3dbad5fda0696/examples/react-native/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/examples/react-native/android/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | Example
3 |
4 |
--------------------------------------------------------------------------------
/examples/react-native/android/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/examples/react-native/android/build.gradle:
--------------------------------------------------------------------------------
1 | // Top-level build file where you can add configuration options common to all sub-projects/modules.
2 |
3 | buildscript {
4 | ext {
5 | buildToolsVersion = "29.0.2"
6 | minSdkVersion = 16
7 | compileSdkVersion = 29
8 | targetSdkVersion = 29
9 | }
10 | repositories {
11 | google()
12 | jcenter()
13 | }
14 | dependencies {
15 | classpath("com.android.tools.build:gradle:3.5.3")
16 | // NOTE: Do not place your application dependencies here; they belong
17 | // in the individual module build.gradle files
18 | }
19 | }
20 |
21 | allprojects {
22 | repositories {
23 | mavenLocal()
24 | maven {
25 | // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
26 | url("$rootDir/../node_modules/react-native/android")
27 | }
28 | maven {
29 | // Android JSC is installed from npm
30 | url("$rootDir/../node_modules/jsc-android/dist")
31 | }
32 |
33 | google()
34 | jcenter()
35 | maven { url 'https://www.jitpack.io' }
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/examples/react-native/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.37.0
29 |
--------------------------------------------------------------------------------
/examples/react-native/android/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aksonov/react-native-router-flux/b6e8e71aaa5301740724ebbc7bf3dbad5fda0696/examples/react-native/android/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/examples/react-native/android/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | distributionBase=GRADLE_USER_HOME
2 | distributionPath=wrapper/dists
3 | distributionUrl=https\://services.gradle.org/distributions/gradle-6.2-all.zip
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 |
--------------------------------------------------------------------------------
/examples/react-native/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 Resolve any "." and ".." in APP_HOME to make it shorter.
33 | for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
34 |
35 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
36 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
37 |
38 | @rem Find java.exe
39 | if defined JAVA_HOME goto findJavaFromJavaHome
40 |
41 | set JAVA_EXE=java.exe
42 | %JAVA_EXE% -version >NUL 2>&1
43 | if "%ERRORLEVEL%" == "0" goto init
44 |
45 | echo.
46 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
47 | echo.
48 | echo Please set the JAVA_HOME variable in your environment to match the
49 | echo location of your Java installation.
50 |
51 | goto fail
52 |
53 | :findJavaFromJavaHome
54 | set JAVA_HOME=%JAVA_HOME:"=%
55 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
56 |
57 | if exist "%JAVA_EXE%" goto init
58 |
59 | echo.
60 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
61 | echo.
62 | echo Please set the JAVA_HOME variable in your environment to match the
63 | echo location of your Java installation.
64 |
65 | goto fail
66 |
67 | :init
68 | @rem Get command-line arguments, handling Windows variants
69 |
70 | if not "%OS%" == "Windows_NT" goto win9xME_args
71 |
72 | :win9xME_args
73 | @rem Slurp the command line arguments.
74 | set CMD_LINE_ARGS=
75 | set _SKIP=2
76 |
77 | :win9xME_args_slurp
78 | if "x%~1" == "x" goto execute
79 |
80 | set CMD_LINE_ARGS=%*
81 |
82 | :execute
83 | @rem Setup the command line
84 |
85 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
86 |
87 | @rem Execute Gradle
88 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
89 |
90 | :end
91 | @rem End local scope for the variables with windows NT shell
92 | if "%ERRORLEVEL%"=="0" goto mainEnd
93 |
94 | :fail
95 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
96 | rem the _cmd.exe /c_ return code!
97 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
98 | exit /b 1
99 |
100 | :mainEnd
101 | if "%OS%"=="Windows_NT" endlocal
102 |
103 | :omega
104 |
--------------------------------------------------------------------------------
/examples/react-native/android/settings.gradle:
--------------------------------------------------------------------------------
1 | rootProject.name = 'Example'
2 | apply from: file("../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesSettingsGradle(settings)
3 | include ':app'
4 |
--------------------------------------------------------------------------------
/examples/react-native/app.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "Example",
3 | "displayName": "Example"
4 | }
5 |
--------------------------------------------------------------------------------
/examples/react-native/babel.config.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | presets: ['module:metro-react-native-babel-preset'],
3 | };
4 |
--------------------------------------------------------------------------------
/examples/react-native/components/CustomNavBar.js:
--------------------------------------------------------------------------------
1 | import {
2 | Image,
3 | Platform,
4 | StyleSheet,
5 | Text,
6 | TouchableOpacity,
7 | View,
8 | } from 'react-native';
9 | import React from 'react';
10 | import {Actions} from 'react-native-router-flux';
11 |
12 | const styles = StyleSheet.create({
13 | container: {
14 | height: Platform.OS === 'ios' ? 64 : 54,
15 | flexDirection: 'row',
16 | paddingTop: 20,
17 | },
18 | navBarItem: {
19 | flex: 1,
20 | justifyContent: 'center',
21 | },
22 | });
23 |
24 | export default class CustomNavBar extends React.Component {
25 | // constructor(props) {
26 | // super(props)
27 | // }
28 |
29 | _renderLeft() {
30 | if (Actions.currentScene === 'customNavBar1') {
31 | return (
32 | console.log('Hamburger button pressed')}
34 | style={[styles.navBarItem, {paddingLeft: 10}]}>
35 |
43 |
44 | );
45 | }
46 | return (
47 |
50 |
55 |
56 | );
57 | }
58 |
59 | _renderMiddle() {
60 | return (
61 |
62 | {this.props.title}
63 |
64 | );
65 | }
66 |
67 | _renderRight() {
68 | return (
69 |
74 | console.log('Share')}
76 | style={{paddingRight: 10}}>
77 |
85 |
86 | console.log('Search')}
88 | style={{paddingRight: 10}}>
89 |
97 |
98 |
99 | );
100 | }
101 |
102 | render() {
103 | let dynamicStyle = {};
104 | if (Actions.currentScene === 'customNavBar1') {
105 | dynamicStyle = {backgroundColor: 'red'};
106 | } else {
107 | dynamicStyle = {backgroundColor: 'yellow'};
108 | }
109 |
110 | return (
111 |
112 | {this._renderLeft()}
113 | {this._renderMiddle()}
114 | {this._renderRight()}
115 |
116 | );
117 | }
118 | }
119 |
--------------------------------------------------------------------------------
/examples/react-native/components/CustomNavBar2.js:
--------------------------------------------------------------------------------
1 | import {
2 | Image,
3 | Platform,
4 | StyleSheet,
5 | Text,
6 | TouchableOpacity,
7 | View,
8 | } from 'react-native';
9 | import React from 'react';
10 | import {Actions} from 'react-native-router-flux';
11 |
12 | const styles = StyleSheet.create({
13 | container: {
14 | height: Platform.OS === 'ios' ? 64 : 54,
15 | flexDirection: 'row',
16 | paddingTop: 20,
17 | backgroundColor: 'green',
18 | },
19 | navBarItem: {
20 | flex: 1,
21 | justifyContent: 'center',
22 | },
23 | });
24 |
25 | export default class CustomNavBar extends React.Component {
26 | // constructor(props) {
27 | // super(props)
28 | // }
29 |
30 | _renderLeft() {
31 | return (
32 |
35 |
40 |
41 | );
42 | }
43 |
44 | _renderMiddle() {
45 | return (
46 |
47 | {this.props.title}
48 |
49 | );
50 | }
51 |
52 | render() {
53 | return (
54 |
55 | {this._renderLeft()}
56 | {this._renderMiddle()}
57 |
58 | );
59 | }
60 | }
61 |
--------------------------------------------------------------------------------
/examples/react-native/components/CustomNavBarView.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import PropTypes from 'prop-types';
3 | import {StyleSheet, View, ViewPropTypes} from 'react-native';
4 | import Button from 'react-native-button';
5 | import {Actions} from 'react-native-router-flux';
6 |
7 | const propTypes = {
8 | name: PropTypes.string,
9 | sceneStyle: ViewPropTypes.style,
10 | title: PropTypes.string,
11 | };
12 |
13 | const styles = StyleSheet.create({
14 | container: {
15 | flex: 1,
16 | justifyContent: 'center',
17 | alignItems: 'center',
18 | backgroundColor: 'transparent',
19 | borderWidth: 2,
20 | borderColor: 'red',
21 | },
22 | });
23 |
24 | class TabView extends React.Component {
25 | render() {
26 | return (
27 |
28 |
29 |
30 |
36 |
42 |
48 |
54 |
55 | );
56 | }
57 | }
58 | TabView.propTypes = propTypes;
59 |
60 | export default TabView;
61 |
--------------------------------------------------------------------------------
/examples/react-native/components/EchoView.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import {View, Text, StyleSheet} from 'react-native';
3 | import Button from 'react-native-button';
4 | import {Actions} from 'react-native-router-flux';
5 |
6 | const styles = StyleSheet.create({
7 | container: {
8 | flex: 1,
9 | justifyContent: 'center',
10 | alignItems: 'center',
11 | backgroundColor: '#F5FCFF',
12 | borderWidth: 2,
13 | borderColor: 'red',
14 | },
15 | instructions: {
16 | textAlign: 'center',
17 | color: '#333333',
18 | marginBottom: 5,
19 | },
20 | smaller: {
21 | marginBottom: 5,
22 | fontSize: 12,
23 | },
24 | });
25 |
26 | export default class extends React.Component {
27 | onEnter() {
28 | console.log('EchoView onEnter');
29 | }
30 |
31 | render() {
32 | return (
33 |
34 | routeName: {this.props.name}
35 |
36 |
37 | );
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/examples/react-native/components/Error.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import {View, Text, StyleSheet, Animated, Dimensions} from 'react-native';
3 | import Button from 'react-native-button';
4 | import {Actions} from 'react-native-router-flux';
5 |
6 | const {height: deviceHeight} = Dimensions.get('window');
7 |
8 | const styles = StyleSheet.create({
9 | container: {
10 | position: 'absolute',
11 | top: 0,
12 | bottom: 0,
13 | left: 0,
14 | right: 0,
15 | backgroundColor: 'transparent',
16 | justifyContent: 'center',
17 | alignItems: 'center',
18 | },
19 | });
20 |
21 | export default class extends React.Component {
22 | constructor(props) {
23 | super(props);
24 |
25 | this.state = {
26 | offset: new Animated.Value(-deviceHeight),
27 | };
28 | }
29 |
30 | componentDidMount() {
31 | Animated.timing(this.state.offset, {
32 | duration: 150,
33 | toValue: 0,
34 | }).start();
35 | }
36 |
37 | closeModal() {
38 | Animated.timing(this.state.offset, {
39 | duration: 150,
40 | toValue: -deviceHeight,
41 | }).start(Actions.pop);
42 | }
43 |
44 | render() {
45 | return (
46 |
52 |
60 | {this.props.data}
61 |
62 |
63 |
64 | );
65 | }
66 | }
67 |
--------------------------------------------------------------------------------
/examples/react-native/components/Home.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import {View, Text, StyleSheet} from 'react-native';
3 | import Button from 'react-native-button';
4 | import {Actions} from 'react-native-router-flux';
5 |
6 | const styles = StyleSheet.create({
7 | container: {
8 | flex: 1,
9 | justifyContent: 'center',
10 | alignItems: 'center',
11 | backgroundColor: '#F5FCFF',
12 | },
13 | welcome: {
14 | fontSize: 20,
15 | textAlign: 'center',
16 | margin: 10,
17 | },
18 | instructions: {
19 | textAlign: 'center',
20 | color: '#333333',
21 | marginBottom: 5,
22 | },
23 | });
24 |
25 | class Home extends React.Component {
26 | render() {
27 | return (
28 |
29 | Replace screen
30 | Prop from dynamic method: {this.props.homeProp}
31 |
32 |
33 | );
34 | }
35 | }
36 |
37 | module.exports = Home;
38 |
--------------------------------------------------------------------------------
/examples/react-native/components/Launch.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import {View, Text, StyleSheet, Button} from 'react-native';
3 | import {Actions} from 'react-native-router-flux';
4 | import {MessageBarManager} from 'react-native-message-bar';
5 |
6 | const styles = StyleSheet.create({
7 | container: {
8 | flex: 1,
9 | justifyContent: 'center',
10 | alignItems: 'center',
11 | backgroundColor: 'transparent',
12 | },
13 | });
14 |
15 | class Launch extends React.Component {
16 | render() {
17 | return (
18 |
19 | Welcome
20 |
50 | );
51 | }
52 | }
53 |
54 | export default Launch;
55 |
--------------------------------------------------------------------------------
/examples/react-native/components/Login.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import {View, Text, StyleSheet} from 'react-native';
3 | import Button from 'react-native-button';
4 | import {Actions} from 'react-native-router-flux';
5 |
6 | const styles = StyleSheet.create({
7 | container: {
8 | flex: 1,
9 | justifyContent: 'center',
10 | alignItems: 'center',
11 | backgroundColor: '#F5FCFF',
12 | },
13 | welcome: {
14 | fontSize: 20,
15 | textAlign: 'center',
16 | margin: 10,
17 | },
18 | instructions: {
19 | textAlign: 'center',
20 | color: '#333333',
21 | marginBottom: 5,
22 | },
23 | });
24 |
25 | export default class extends React.Component {
26 | static onEnter = () => {
27 | Actions.refresh({
28 | title: 'Login!',
29 | rightTitle: 'rightTitle',
30 | onRight: () => {},
31 | });
32 | };
33 |
34 | render() {
35 | const title = this.props.title || 'No Title';
36 | const data = this.props.data || 'No Data';
37 | console.log('Login RENDER');
38 | return (
39 |
40 | Login page 1
41 | Title: {title}
42 | Data: {data}
43 |
45 | Actions.loginModal2({data: 'Custom data2', title: 'Custom title2'})
46 | }>
47 | Login 2
48 |
49 |
51 | Actions.refresh({title: 'Changed title', data: 'Changed data'})
52 | }>
53 | Change title
54 |
55 | Back
56 |
57 | );
58 | }
59 | }
60 |
--------------------------------------------------------------------------------
/examples/react-native/components/Login2.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import {View, Text, StyleSheet} from 'react-native';
3 | import Button from 'react-native-button';
4 | import {Actions} from 'react-native-router-flux';
5 |
6 | const styles = StyleSheet.create({
7 | container: {
8 | flex: 1,
9 | justifyContent: 'center',
10 | alignItems: 'center',
11 | backgroundColor: '#F5FCFF',
12 | },
13 | });
14 |
15 | export default class extends React.Component {
16 | render() {
17 | const title = this.props.title || 'No Title';
18 | const data = this.props.data || 'No Data';
19 | return (
20 |
21 | Login page 2
22 | Title: {title}
23 | Data: {data}
24 |
26 | Actions.loginModal3({data: 'Custom data3', title: 'Custom title3'})
27 | }>
28 | Login 3
29 |
30 |
31 | );
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/examples/react-native/components/Login3.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import {View, Text, StyleSheet} from 'react-native';
3 | import Button from 'react-native-button';
4 | import {Actions} from 'react-native-router-flux';
5 |
6 | const styles = StyleSheet.create({
7 | container: {
8 | flex: 1,
9 | justifyContent: 'center',
10 | alignItems: 'center',
11 | backgroundColor: '#F5FCFF',
12 | },
13 | });
14 |
15 | const popToRoot = () => {
16 | Actions.popTo('launch');
17 | };
18 |
19 | const popToLogin1 = () => {
20 | Actions.popTo('loginModal');
21 | };
22 |
23 | const popToLogin2 = () => {
24 | Actions.popTo('loginModal2');
25 | };
26 |
27 | const popAndRefresh = () => {
28 | Actions.pop({
29 | refresh: {data: 'Data after pop', title: 'title after pop'},
30 | key: null,
31 | });
32 | };
33 |
34 | export default class extends React.Component {
35 | render() {
36 | const title = this.props.title || 'No Title';
37 | const data = this.props.data || 'No Data';
38 | return (
39 |
40 | Login page 3
41 | Title: {title}
42 | Data: {data}
43 | Back
44 | To Login
45 | To Login2
46 | Back and refresh
47 | To Root
48 |
49 | );
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/examples/react-native/components/MessageBar.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import {MessageBar, MessageBarManager} from 'react-native-message-bar';
3 |
4 | export default class extends React.Component {
5 | componentDidMount() {
6 | // Register the alert located on this master page
7 | // This MessageBar will be accessible from the current (same) component, and from its child component
8 | // The MessageBar is then declared only once, in your main component.
9 | MessageBarManager.registerMessageBar(this.refs.alert);
10 | }
11 |
12 | componentWillUnmount() {
13 | // Remove the alert located on this master page from the manager
14 | MessageBarManager.unregisterMessageBar();
15 | }
16 |
17 | render() {
18 | return ;
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/examples/react-native/components/Register.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import {View, Text, StyleSheet} from 'react-native';
3 | import Button from 'react-native-button';
4 | import {Actions} from 'react-native-router-flux';
5 |
6 | const styles = StyleSheet.create({
7 | container: {
8 | flex: 1,
9 | justifyContent: 'center',
10 | alignItems: 'center',
11 | backgroundColor: '#F5FCFF',
12 | },
13 | });
14 |
15 | const Register = () => (
16 |
17 | Register page
18 | Actions.register2()}>Register
19 | Actions.home({homeProp: 'Test of prop refresh!'})}>
20 | Replace screen
21 |
22 | Back
23 |
24 | );
25 |
26 | export default Register;
27 |
--------------------------------------------------------------------------------
/examples/react-native/components/TabIcon.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import PropTypes from 'prop-types';
3 | import {Text} from 'react-native';
4 |
5 | const propTypes = {
6 | focused: PropTypes.bool,
7 | title: PropTypes.string,
8 | };
9 |
10 | const defaultProps = {
11 | focused: false,
12 | title: '',
13 | };
14 |
15 | const TabIcon = props => (
16 | {props.title}
17 | );
18 |
19 | TabIcon.propTypes = propTypes;
20 | TabIcon.defaultProps = defaultProps;
21 |
22 | export default TabIcon;
23 |
--------------------------------------------------------------------------------
/examples/react-native/components/TabView.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import PropTypes from 'prop-types';
3 | import {StyleSheet, Text, View, ViewPropTypes} from 'react-native';
4 | import Button from 'react-native-button';
5 | import {Actions} from 'react-native-router-flux';
6 |
7 | const propTypes = {
8 | name: PropTypes.string.isRequired,
9 | data: PropTypes.string,
10 | sceneStyle: ViewPropTypes.style,
11 | title: PropTypes.string.isRequired,
12 | };
13 |
14 | const defaultProps = {
15 | sceneStyle: null,
16 | };
17 |
18 | const styles = StyleSheet.create({
19 | container: {
20 | flex: 1,
21 | justifyContent: 'center',
22 | alignItems: 'center',
23 | backgroundColor: 'transparent',
24 | borderWidth: 2,
25 | borderColor: 'red',
26 | },
27 | });
28 |
29 | class TabView extends React.Component {
30 | state = {hideNavBar: false, hideTabBar: false};
31 |
32 | toggleNavBar = () => {
33 | this.setState(
34 | prevState => ({hideNavBar: !prevState.hideNavBar}),
35 | () => Actions.refresh({hideNavBar: this.state.hideNavBar}),
36 | );
37 | };
38 |
39 | toggleTabBar = () => {
40 | this.setState(
41 | prevState => ({hideTabBar: !prevState.hideTabBar}),
42 | () => {
43 | Actions.refresh(
44 | {
45 | hideTabBar: this.state.hideTabBar,
46 | },
47 | 'tab_2',
48 | );
49 | },
50 | );
51 | };
52 |
53 | render() {
54 | return (
55 |
56 |
57 | Tab title:
58 | {this.props.title} name:
59 | {this.props.name}
60 |
61 | Tab data: {this.props.data}
62 | {this.props.name === 'tab_1_1' && (
63 | Actions.tab_1_2()}>
64 | next screen for tab1_1
65 |
66 | )}
67 | {this.props.name === 'tab_2_1' && (
68 | Actions.tab_2_2()}>
69 | next screen for tab2_1
70 |
71 | )}
72 | Back
73 | {
75 | Actions.tab_1();
76 | }}>
77 | Switch to tab1
78 |
79 | {
81 | Actions.tab_2();
82 | }}>
83 | Switch to tab2
84 |
85 | {
87 | Actions.tab_3();
88 | }}>
89 | Switch to tab3
90 |
91 | {
93 | Actions.tab_4_1();
94 | }}>
95 | Switch to tab4
96 |
97 | {
99 | Actions.tab_5_1({data: 'test!'});
100 | }}>
101 | Switch to tab5 with data
102 |
103 | {
105 | Actions.echo();
106 | }}>
107 | push clone scene (EchoView)
108 |
109 | {
111 | this.toggleNavBar();
112 | }}>
113 | Toggle NavBar
114 |
115 | {
117 | Actions.replace('tab_2_1');
118 | }}>
119 | Replace with tab2
120 |
121 | {this.props.name === 'tab_2_1' && (
122 | Toggle TabBar
123 | )}
124 |
125 | );
126 | }
127 | }
128 | TabView.propTypes = propTypes;
129 | TabView.defaultProps = defaultProps;
130 |
131 | export default TabView;
132 |
--------------------------------------------------------------------------------
/examples/react-native/components/drawer/DrawerContent.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import PropTypes from 'prop-types';
3 | import {StyleSheet, Text, View, ViewPropTypes} from 'react-native';
4 | import Button from 'react-native-button';
5 | import {Actions} from 'react-native-router-flux';
6 |
7 | const styles = StyleSheet.create({
8 | container: {
9 | flex: 1,
10 | justifyContent: 'center',
11 | alignItems: 'center',
12 | backgroundColor: 'transparent',
13 | borderWidth: 2,
14 | borderColor: 'red',
15 | },
16 | });
17 |
18 | class DrawerContent extends React.Component {
19 | static propTypes = {
20 | name: PropTypes.string,
21 | sceneStyle: ViewPropTypes.style,
22 | title: PropTypes.string,
23 | };
24 |
25 | static contextTypes = {
26 | drawer: PropTypes.object,
27 | };
28 |
29 | render() {
30 | return (
31 |
32 | {/* Drawer Content
33 | Back */}
34 | Title: {this.props.title}
35 | {this.props.name === 'tab_1_1' && (
36 | next screen for tab1_1
37 | )}
38 | {this.props.name === 'tab_2_1' && (
39 | next screen for tab2_1
40 | )}
41 | Back
42 | Switch to tab1
43 | Switch to tab2
44 | Switch to tab3
45 | Switch to tab4
46 | {
48 | Actions.___tab_5({data: 'test!'});
49 | }}>
50 | Switch to tab5 with data
51 |
52 | Push Clone Scene (EchoView)
53 | Reset back to launch
54 |
55 | );
56 | }
57 | }
58 |
59 | export default DrawerContent;
60 |
--------------------------------------------------------------------------------
/examples/react-native/components/lightbox/BaseLightbox.js:
--------------------------------------------------------------------------------
1 | import React, {Component} from 'react';
2 | import PropTypes from 'prop-types';
3 | import {View, StyleSheet, Animated, Dimensions, Button} from 'react-native';
4 | import {Actions} from 'react-native-router-flux';
5 |
6 | const {height: deviceHeight, width: deviceWidth} = Dimensions.get('window');
7 |
8 | export default class BaseLightbox extends Component {
9 | static propTypes = {
10 | children: PropTypes.any,
11 | horizontalPercent: PropTypes.number,
12 | verticalPercent: PropTypes.number,
13 | };
14 |
15 | constructor(props) {
16 | super(props);
17 |
18 | this.state = {
19 | opacity: new Animated.Value(0),
20 | };
21 | }
22 |
23 | componentDidMount() {
24 | Animated.timing(this.state.opacity, {
25 | duration: 500,
26 | toValue: 1,
27 | }).start();
28 | }
29 |
30 | closeModal = () => {
31 | Animated.timing(this.state.opacity, {
32 | duration: 500,
33 | toValue: 0,
34 | }).start(Actions.pop);
35 | };
36 |
37 | _renderLightBox = () => {
38 | const {children, horizontalPercent = 1, verticalPercent = 1} = this.props;
39 | const height = verticalPercent
40 | ? deviceHeight * verticalPercent
41 | : deviceHeight;
42 | const width = horizontalPercent
43 | ? deviceWidth * horizontalPercent
44 | : deviceWidth;
45 | return (
46 |
54 | {children}
55 |
56 |
57 | );
58 | };
59 |
60 | render() {
61 | return (
62 |
63 | {this._renderLightBox()}
64 |
65 | );
66 | }
67 | }
68 |
69 | const styles = StyleSheet.create({
70 | container: {
71 | backgroundColor: 'rgba(52,52,52,0.5)',
72 | position: 'absolute',
73 | top: 0,
74 | bottom: 0,
75 | left: 0,
76 | right: 0,
77 | justifyContent: 'center',
78 | alignItems: 'center',
79 | },
80 | });
81 |
--------------------------------------------------------------------------------
/examples/react-native/components/lightbox/DemoLightbox.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import {Text} from 'react-native';
3 |
4 | import Lightbox from './BaseLightbox';
5 |
6 | const DemoLightbox = ({data, children}) => (
7 |
8 | Demo Lightbox: {data}
9 | Allows transparency for background
10 |
11 | );
12 |
13 | export default DemoLightbox;
14 |
--------------------------------------------------------------------------------
/examples/react-native/components/modal/BaseModal.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import PropTypes from 'prop-types';
3 | import {
4 | View,
5 | Text,
6 | TouchableOpacity,
7 | StyleSheet,
8 | Dimensions,
9 | } from 'react-native';
10 | import {Actions} from 'react-native-router-flux';
11 |
12 | const {height: deviceHeight, width: deviceWidth} = Dimensions.get('window');
13 |
14 | const BaseModal = ({
15 | children,
16 | verticalPercent,
17 | horizontalPercent,
18 | hideClose,
19 | }) => {
20 | const height = verticalPercent
21 | ? deviceHeight * verticalPercent
22 | : deviceHeight;
23 | const width = horizontalPercent
24 | ? deviceHeight * horizontalPercent
25 | : deviceWidth;
26 |
27 | const renderClose = () => {
28 | if (hideClose) {
29 | return null;
30 | }
31 | return (
32 |
33 |
34 | Close
35 |
36 |
37 | );
38 | };
39 |
40 | return (
41 |
42 | {renderClose()}
43 | {children}
44 |
45 | );
46 | };
47 |
48 | BaseModal.propTypes = {
49 | children: PropTypes.any,
50 | verticalPercent: PropTypes.number,
51 | horizontalPercent: PropTypes.number,
52 | hideClose: PropTypes.bool,
53 | };
54 |
55 | const styles = StyleSheet.create({
56 | container: {
57 | position: 'absolute',
58 | top: 0,
59 | bottom: 0,
60 | left: 0,
61 | right: 0,
62 | backgroundColor: '#FFF',
63 | },
64 | closeBtnContainer: {
65 | paddingTop: 20,
66 | flexDirection: 'row',
67 | justifyContent: 'flex-end',
68 | paddingHorizontal: 10,
69 | },
70 | });
71 |
72 | export default BaseModal;
73 |
--------------------------------------------------------------------------------
/examples/react-native/components/modal/ErrorModal.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import {StyleSheet, Text, View, Button} from 'react-native';
3 | import {Actions} from 'react-native-router-flux';
4 | import Modal from './BaseModal';
5 |
6 | const styles = StyleSheet.create({
7 | container: {
8 | justifyContent: 'center',
9 | alignItems: 'center',
10 | marginHorizontal: 20,
11 | },
12 | });
13 |
14 | const ErrorModal = () => (
15 |
16 |
17 | Error Modal
18 |
19 | Slides up from the bottom, and covers the entire screen with no
20 | transparency
21 |
22 |
23 |
24 |
25 | );
26 |
27 | export default ErrorModal;
28 |
--------------------------------------------------------------------------------
/examples/react-native/images/back_chevron.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aksonov/react-native-router-flux/b6e8e71aaa5301740724ebbc7bf3dbad5fda0696/examples/react-native/images/back_chevron.png
--------------------------------------------------------------------------------
/examples/react-native/images/menu_burger.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aksonov/react-native-router-flux/b6e8e71aaa5301740724ebbc7bf3dbad5fda0696/examples/react-native/images/menu_burger.png
--------------------------------------------------------------------------------
/examples/react-native/index.js:
--------------------------------------------------------------------------------
1 | /**
2 | * @format
3 | */
4 |
5 | import {AppRegistry} from 'react-native';
6 | import App from './App';
7 | import {name as appName} from './app.json';
8 |
9 | AppRegistry.registerComponent(appName, () => App);
10 |
--------------------------------------------------------------------------------
/examples/react-native/ios/Example-tvOS/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIdentifier
10 | $(PRODUCT_BUNDLE_IDENTIFIER)
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 | NSAppTransportSecurity
26 |
27 | NSExceptionDomains
28 |
29 | localhost
30 |
31 | NSExceptionAllowsInsecureHTTPLoads
32 |
33 |
34 |
35 |
36 | NSLocationWhenInUseUsageDescription
37 |
38 | UILaunchStoryboardName
39 | LaunchScreen
40 | UIRequiredDeviceCapabilities
41 |
42 | armv7
43 |
44 | UISupportedInterfaceOrientations
45 |
46 | UIInterfaceOrientationPortrait
47 | UIInterfaceOrientationLandscapeLeft
48 | UIInterfaceOrientationLandscapeRight
49 |
50 | UIViewControllerBasedStatusBarAppearance
51 |
52 |
53 |
54 |
--------------------------------------------------------------------------------
/examples/react-native/ios/Example-tvOSTests/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIdentifier
10 | $(PRODUCT_BUNDLE_IDENTIFIER)
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 |
--------------------------------------------------------------------------------
/examples/react-native/ios/Example.xcodeproj/xcshareddata/xcschemes/Example-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 |
--------------------------------------------------------------------------------
/examples/react-native/ios/Example.xcodeproj/xcshareddata/xcschemes/Example.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 |
--------------------------------------------------------------------------------
/examples/react-native/ios/Example.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/examples/react-native/ios/Example.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/examples/react-native/ios/Example/AppDelegate.h:
--------------------------------------------------------------------------------
1 | #import
2 | #import
3 |
4 | @interface AppDelegate : UIResponder
5 |
6 | @property (nonatomic, strong) UIWindow *window;
7 |
8 | @end
9 |
--------------------------------------------------------------------------------
/examples/react-native/ios/Example/AppDelegate.m:
--------------------------------------------------------------------------------
1 | #import "AppDelegate.h"
2 |
3 | #import
4 | #import
5 | #import
6 |
7 | #ifdef FB_SONARKIT_ENABLED
8 | #import
9 | #import
10 | #import
11 | #import
12 | #import
13 | #import
14 |
15 | static void InitializeFlipper(UIApplication *application) {
16 | FlipperClient *client = [FlipperClient sharedClient];
17 | SKDescriptorMapper *layoutDescriptorMapper = [[SKDescriptorMapper alloc] initWithDefaults];
18 | [client addPlugin:[[FlipperKitLayoutPlugin alloc] initWithRootNode:application withDescriptorMapper:layoutDescriptorMapper]];
19 | [client addPlugin:[[FKUserDefaultsPlugin alloc] initWithSuiteName:nil]];
20 | [client addPlugin:[FlipperKitReactPlugin new]];
21 | [client addPlugin:[[FlipperKitNetworkPlugin alloc] initWithNetworkAdapter:[SKIOSNetworkAdapter new]]];
22 | [client start];
23 | }
24 | #endif
25 |
26 | @implementation AppDelegate
27 |
28 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
29 | {
30 | #ifdef FB_SONARKIT_ENABLED
31 | InitializeFlipper(application);
32 | #endif
33 |
34 | RCTBridge *bridge = [[RCTBridge alloc] initWithDelegate:self launchOptions:launchOptions];
35 | RCTRootView *rootView = [[RCTRootView alloc] initWithBridge:bridge
36 | moduleName:@"Example"
37 | initialProperties:nil];
38 |
39 | rootView.backgroundColor = [[UIColor alloc] initWithRed:1.0f green:1.0f blue:1.0f alpha:1];
40 |
41 | self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
42 | UIViewController *rootViewController = [UIViewController new];
43 | rootViewController.view = rootView;
44 | self.window.rootViewController = rootViewController;
45 | [self.window makeKeyAndVisible];
46 | return YES;
47 | }
48 |
49 | - (NSURL *)sourceURLForBridge:(RCTBridge *)bridge
50 | {
51 | #if DEBUG
52 | return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index" fallbackResource:nil];
53 | #else
54 | return [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"];
55 | #endif
56 | }
57 |
58 | @end
59 |
--------------------------------------------------------------------------------
/examples/react-native/ios/Example/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 |
--------------------------------------------------------------------------------
/examples/react-native/ios/Example/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 | }
--------------------------------------------------------------------------------
/examples/react-native/ios/Example/Images.xcassets/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "info" : {
3 | "version" : 1,
4 | "author" : "xcode"
5 | }
6 | }
7 |
--------------------------------------------------------------------------------
/examples/react-native/ios/Example/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleDisplayName
8 | Example
9 | CFBundleExecutable
10 | $(EXECUTABLE_NAME)
11 | CFBundleIdentifier
12 | $(PRODUCT_BUNDLE_IDENTIFIER)
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 | NSAppTransportSecurity
28 |
29 | NSAllowsArbitraryLoads
30 |
31 | NSExceptionDomains
32 |
33 | localhost
34 |
35 | NSExceptionAllowsInsecureHTTPLoads
36 |
37 |
38 |
39 |
40 | NSLocationWhenInUseUsageDescription
41 |
42 | UILaunchStoryboardName
43 | LaunchScreen
44 | UIRequiredDeviceCapabilities
45 |
46 | armv7
47 |
48 | UISupportedInterfaceOrientations
49 |
50 | UIInterfaceOrientationPortrait
51 | UIInterfaceOrientationLandscapeLeft
52 | UIInterfaceOrientationLandscapeRight
53 |
54 | UIViewControllerBasedStatusBarAppearance
55 |
56 |
57 |
58 |
--------------------------------------------------------------------------------
/examples/react-native/ios/Example/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 |
--------------------------------------------------------------------------------
/examples/react-native/ios/ExampleTests/ExampleTests.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 ExampleTests : XCTestCase
11 |
12 | @end
13 |
14 | @implementation ExampleTests
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 |
--------------------------------------------------------------------------------
/examples/react-native/ios/ExampleTests/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIdentifier
10 | $(PRODUCT_BUNDLE_IDENTIFIER)
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 |
--------------------------------------------------------------------------------
/examples/react-native/ios/Podfile:
--------------------------------------------------------------------------------
1 | require_relative '../node_modules/react-native/scripts/react_native_pods'
2 | require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'
3 |
4 | platform :ios, '10.0'
5 |
6 | target 'Example' do
7 | config = use_native_modules!
8 |
9 | use_react_native!(:path => config["reactNativePath"])
10 |
11 | target 'ExampleTests' do
12 | inherit! :complete
13 | # Pods for testing
14 | end
15 |
16 | # Enables Flipper.
17 | #
18 | # Note that if you have use_frameworks! enabled, Flipper will not work and
19 | # you should disable these next few lines.
20 | use_flipper!
21 | post_install do |installer|
22 | flipper_post_install(installer)
23 | end
24 | end
25 |
26 | target 'Example-tvOS' do
27 | # Pods for Example-tvOS
28 |
29 | target 'Example-tvOSTests' do
30 | inherit! :search_paths
31 | # Pods for testing
32 | end
33 | end
34 |
--------------------------------------------------------------------------------
/examples/react-native/metro.config.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Metro configuration for React Native
3 | * https://github.com/facebook/react-native
4 | *
5 | * @format
6 | */
7 |
8 | module.exports = {
9 | transformer: {
10 | getTransformOptions: async () => ({
11 | transform: {
12 | experimentalImportSupport: false,
13 | inlineRequires: false,
14 | },
15 | }),
16 | },
17 | };
18 |
--------------------------------------------------------------------------------
/examples/react-native/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "Example",
3 | "version": "0.0.1",
4 | "private": true,
5 | "scripts": {
6 | "android": "react-native run-android",
7 | "ios": "react-native run-ios",
8 | "start": "react-native start",
9 | "test": "jest",
10 | "lint": "eslint ."
11 | },
12 | "dependencies": {
13 | "react": "16.13.1",
14 | "react-native": "0.63.0",
15 | "react-native-button": "^3.0.1",
16 | "react-native-gesture-handler": "^1.6.1",
17 | "react-native-message-bar": "^2.0.10",
18 | "react-native-reanimated": "^1.9.0",
19 | "react-native-router-flux": "^4.3.0",
20 | "@react-native-community/masked-view": "^0.1.10",
21 | "react-native-safe-area-context": "^3.2.0",
22 | "react-native-screens": "^2.18.1"
23 | },
24 | "devDependencies": {
25 | "@babel/core": "^7.10.4",
26 | "@babel/runtime": "^7.10.4",
27 | "@react-native-community/eslint-config": "^2.0.0",
28 | "babel-jest": "^26.1.0",
29 | "eslint": "^7.4.0",
30 | "jest": "^26.1.0",
31 | "metro-react-native-babel-preset": "^0.60.0",
32 | "react-test-renderer": "16.13.1"
33 | },
34 | "jest": {
35 | "preset": "react-native"
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/examples/redux/.buckconfig:
--------------------------------------------------------------------------------
1 |
2 | [android]
3 | target = Google Inc.:Google APIs:23
4 |
5 | [maven_repositories]
6 | central = https://repo1.maven.org/maven2
7 |
--------------------------------------------------------------------------------
/examples/redux/.flowconfig:
--------------------------------------------------------------------------------
1 | [ignore]
2 | ; We fork some components by platform
3 | .*/*[.]android.js
4 |
5 | ; Ignore "BUCK" generated dirs
6 | /\.buckd/
7 |
8 | ; Ignore unexpected extra "@providesModule"
9 | .*/node_modules/.*/node_modules/fbjs/.*
10 |
11 | ; Ignore duplicate module providers
12 | ; For RN Apps installed via npm, "Libraries" folder is inside
13 | ; "node_modules/react-native" but in the source repo it is in the root
14 | .*/Libraries/react-native/React.js
15 | .*/Libraries/react-native/ReactNative.js
16 |
17 | [include]
18 |
19 | [libs]
20 | node_modules/react-native/Libraries/react-native/react-native-interface.js
21 | node_modules/react-native/flow
22 | flow/
23 |
24 | [options]
25 | emoji=true
26 |
27 | module.system=haste
28 |
29 | munge_underscores=true
30 |
31 | 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'
32 |
33 | suppress_type=$FlowIssue
34 | suppress_type=$FlowFixMe
35 | suppress_type=$FixMe
36 |
37 | suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(>=0\\.\\(4[0-7]\\|[1-3][0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)
38 | suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(>=0\\.\\(4[0-7]\\|[1-3][0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)?:? #[0-9]+
39 | suppress_comment=\\(.\\|\n\\)*\\$FlowFixedInNextDeploy
40 | suppress_comment=\\(.\\|\n\\)*\\$FlowExpectedError
41 |
42 | unsafe.enable_getters_and_setters=true
43 |
44 | [version]
45 | ^0.47.0
46 |
--------------------------------------------------------------------------------
/examples/redux/.gitattributes:
--------------------------------------------------------------------------------
1 | *.pbxproj -text
2 |
--------------------------------------------------------------------------------
/examples/redux/.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/IntelliJ
26 | #
27 | build/
28 | .idea
29 | .gradle
30 | local.properties
31 | *.iml
32 |
33 | # node.js
34 | #
35 | node_modules/
36 | npm-debug.log
37 | yarn-error.log
38 |
39 | # BUCK
40 | buck-out/
41 | \.buckd/
42 | *.keystore
43 |
44 | # fastlane
45 | #
46 | # It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the
47 | # screenshots whenever they are needed.
48 | # For more information about the recommended setup visit:
49 | # https://github.com/fastlane/fastlane/blob/master/fastlane/docs/Gitignore.md
50 |
51 | fastlane/report.xml
52 | fastlane/Preview.html
53 | fastlane/screenshots
54 |
--------------------------------------------------------------------------------
/examples/redux/.watchmanconfig:
--------------------------------------------------------------------------------
1 | {}
--------------------------------------------------------------------------------
/examples/redux/android/.project:
--------------------------------------------------------------------------------
1 |
2 |
3 | android_
4 | Project android_ created by Buildship.
5 |
6 |
7 |
8 |
9 | org.eclipse.buildship.core.gradleprojectbuilder
10 |
11 |
12 |
13 |
14 |
15 | org.eclipse.buildship.core.gradleprojectnature
16 |
17 |
18 |
--------------------------------------------------------------------------------
/examples/redux/android/.settings/org.eclipse.buildship.core.prefs:
--------------------------------------------------------------------------------
1 | connection.project.dir=
2 | eclipse.preferences.version=1
3 |
--------------------------------------------------------------------------------
/examples/redux/android/app/BUCK:
--------------------------------------------------------------------------------
1 | # To learn about Buck see [Docs](https://buckbuild.com/).
2 | # To run your application with Buck:
3 | # - install Buck
4 | # - `npm start` - to start the packager
5 | # - `cd android`
6 | # - `keytool -genkey -v -keystore keystores/debug.keystore -storepass android -alias androiddebugkey -keypass android -dname "CN=Android Debug,O=Android,C=US"`
7 | # - `./gradlew :app:copyDownloadableDepsToLibs` - make all Gradle compile dependencies available to Buck
8 | # - `buck install -r android/app` - compile, install and run application
9 | #
10 |
11 | lib_deps = []
12 |
13 | for jarfile in glob(['libs/*.jar']):
14 | name = 'jars__' + jarfile[jarfile.rindex('/') + 1: jarfile.rindex('.jar')]
15 | lib_deps.append(':' + name)
16 | prebuilt_jar(
17 | name = name,
18 | binary_jar = jarfile,
19 | )
20 |
21 | for aarfile in glob(['libs/*.aar']):
22 | name = 'aars__' + aarfile[aarfile.rindex('/') + 1: aarfile.rindex('.aar')]
23 | lib_deps.append(':' + name)
24 | android_prebuilt_aar(
25 | name = name,
26 | aar = aarfile,
27 | )
28 |
29 | android_library(
30 | name = "all-libs",
31 | exported_deps = lib_deps,
32 | )
33 |
34 | android_library(
35 | name = "app-code",
36 | srcs = glob([
37 | "src/main/java/**/*.java",
38 | ]),
39 | deps = [
40 | ":all-libs",
41 | ":build_config",
42 | ":res",
43 | ],
44 | )
45 |
46 | android_build_config(
47 | name = "build_config",
48 | package = "com.rnrfreduxsample",
49 | )
50 |
51 | android_resource(
52 | name = "res",
53 | package = "com.rnrfreduxsample",
54 | res = "src/main/res",
55 | )
56 |
57 | android_binary(
58 | name = "app",
59 | keystore = "//android/keystores:debug",
60 | manifest = "src/main/AndroidManifest.xml",
61 | package_type = "debug",
62 | deps = [
63 | ":app-code",
64 | ],
65 | )
66 |
--------------------------------------------------------------------------------
/examples/redux/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 |
--------------------------------------------------------------------------------
/examples/redux/android/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
4 |
5 |
6 |
7 |
13 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/examples/redux/android/app/src/main/java/com/rnrfreduxsample/MainActivity.java:
--------------------------------------------------------------------------------
1 | package com.rnrfreduxsample;
2 |
3 | import com.facebook.react.ReactActivity;
4 |
5 | public class MainActivity extends ReactActivity {
6 |
7 | /**
8 | * Returns the name of the main component registered from JavaScript.
9 | * This is used to schedule rendering of the component.
10 | */
11 | @Override
12 | protected String getMainComponentName() {
13 | return "rnrfReduxSample";
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/examples/redux/android/app/src/main/java/com/rnrfreduxsample/MainApplication.java:
--------------------------------------------------------------------------------
1 | package com.rnrfreduxsample;
2 |
3 | import android.app.Application;
4 |
5 | import com.facebook.react.ReactApplication;
6 | import com.facebook.react.ReactNativeHost;
7 | import com.facebook.react.ReactPackage;
8 | import com.facebook.react.shell.MainReactPackage;
9 | import com.facebook.soloader.SoLoader;
10 |
11 | import java.util.Arrays;
12 | import java.util.List;
13 |
14 | public class MainApplication extends Application implements ReactApplication {
15 |
16 | private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) {
17 | @Override
18 | public boolean getUseDeveloperSupport() {
19 | return BuildConfig.DEBUG;
20 | }
21 |
22 | @Override
23 | protected List getPackages() {
24 | return Arrays.asList(
25 | new MainReactPackage()
26 | );
27 | }
28 |
29 | @Override
30 | protected String getJSMainModuleName() {
31 | return "index";
32 | }
33 | };
34 |
35 | @Override
36 | public ReactNativeHost getReactNativeHost() {
37 | return mReactNativeHost;
38 | }
39 |
40 | @Override
41 | public void onCreate() {
42 | super.onCreate();
43 | SoLoader.init(this, /* native exopackage */ false);
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/examples/redux/android/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aksonov/react-native-router-flux/b6e8e71aaa5301740724ebbc7bf3dbad5fda0696/examples/redux/android/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/examples/redux/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aksonov/react-native-router-flux/b6e8e71aaa5301740724ebbc7bf3dbad5fda0696/examples/redux/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/examples/redux/android/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aksonov/react-native-router-flux/b6e8e71aaa5301740724ebbc7bf3dbad5fda0696/examples/redux/android/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/examples/redux/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aksonov/react-native-router-flux/b6e8e71aaa5301740724ebbc7bf3dbad5fda0696/examples/redux/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/examples/redux/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aksonov/react-native-router-flux/b6e8e71aaa5301740724ebbc7bf3dbad5fda0696/examples/redux/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/examples/redux/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aksonov/react-native-router-flux/b6e8e71aaa5301740724ebbc7bf3dbad5fda0696/examples/redux/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/examples/redux/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aksonov/react-native-router-flux/b6e8e71aaa5301740724ebbc7bf3dbad5fda0696/examples/redux/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/examples/redux/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aksonov/react-native-router-flux/b6e8e71aaa5301740724ebbc7bf3dbad5fda0696/examples/redux/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/examples/redux/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aksonov/react-native-router-flux/b6e8e71aaa5301740724ebbc7bf3dbad5fda0696/examples/redux/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/examples/redux/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aksonov/react-native-router-flux/b6e8e71aaa5301740724ebbc7bf3dbad5fda0696/examples/redux/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/examples/redux/android/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | RNRF Redux Sample
3 |
4 |
--------------------------------------------------------------------------------
/examples/redux/android/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/examples/redux/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 | jcenter()
6 | maven {
7 | url 'https://maven.google.com/'
8 | name 'Google'
9 | }
10 | }
11 | dependencies {
12 | classpath 'com.android.tools.build:gradle:2.3.3'
13 |
14 | // NOTE: Do not place your application dependencies here; they belong
15 | // in the individual module build.gradle files
16 | }
17 | }
18 |
19 | allprojects {
20 | repositories {
21 | mavenLocal()
22 | jcenter()
23 | maven {
24 | // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
25 | url "$rootDir/../node_modules/react-native/android"
26 | }
27 | maven {
28 | url 'https://maven.google.com/'
29 | name 'Google'
30 | }
31 | }
32 | }
33 |
34 | ext {
35 | buildToolsVersion = "26.0.3"
36 | minSdkVersion = 16
37 | compileSdkVersion = 26
38 | targetSdkVersion = 26
39 | supportLibVersion = "26.1.0"
40 | }
41 |
--------------------------------------------------------------------------------
/examples/redux/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 | android.useDeprecatedNdk=true
21 |
--------------------------------------------------------------------------------
/examples/redux/android/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aksonov/react-native-router-flux/b6e8e71aaa5301740724ebbc7bf3dbad5fda0696/examples/redux/android/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/examples/redux/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-3.5.1-all.zip
6 |
--------------------------------------------------------------------------------
/examples/redux/android/gradlew.bat:
--------------------------------------------------------------------------------
1 | @if "%DEBUG%" == "" @echo off
2 | @rem ##########################################################################
3 | @rem
4 | @rem Gradle startup script for Windows
5 | @rem
6 | @rem ##########################################################################
7 |
8 | @rem Set local scope for the variables with windows NT shell
9 | if "%OS%"=="Windows_NT" setlocal
10 |
11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
12 | set DEFAULT_JVM_OPTS=
13 |
14 | set DIRNAME=%~dp0
15 | if "%DIRNAME%" == "" set DIRNAME=.
16 | set APP_BASE_NAME=%~n0
17 | set APP_HOME=%DIRNAME%
18 |
19 | @rem Find java.exe
20 | if defined JAVA_HOME goto findJavaFromJavaHome
21 |
22 | set JAVA_EXE=java.exe
23 | %JAVA_EXE% -version >NUL 2>&1
24 | if "%ERRORLEVEL%" == "0" goto init
25 |
26 | echo.
27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
28 | echo.
29 | echo Please set the JAVA_HOME variable in your environment to match the
30 | echo location of your Java installation.
31 |
32 | goto fail
33 |
34 | :findJavaFromJavaHome
35 | set JAVA_HOME=%JAVA_HOME:"=%
36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
37 |
38 | if exist "%JAVA_EXE%" goto init
39 |
40 | echo.
41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
42 | echo.
43 | echo Please set the JAVA_HOME variable in your environment to match the
44 | echo location of your Java installation.
45 |
46 | goto fail
47 |
48 | :init
49 | @rem Get command-line arguments, handling Windowz variants
50 |
51 | if not "%OS%" == "Windows_NT" goto win9xME_args
52 | if "%@eval[2+2]" == "4" goto 4NT_args
53 |
54 | :win9xME_args
55 | @rem Slurp the command line arguments.
56 | set CMD_LINE_ARGS=
57 | set _SKIP=2
58 |
59 | :win9xME_args_slurp
60 | if "x%~1" == "x" goto execute
61 |
62 | set CMD_LINE_ARGS=%*
63 | goto execute
64 |
65 | :4NT_args
66 | @rem Get arguments from the 4NT Shell from JP Software
67 | set CMD_LINE_ARGS=%$
68 |
69 | :execute
70 | @rem Setup the command line
71 |
72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
73 |
74 | @rem Execute Gradle
75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
76 |
77 | :end
78 | @rem End local scope for the variables with windows NT shell
79 | if "%ERRORLEVEL%"=="0" goto mainEnd
80 |
81 | :fail
82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
83 | rem the _cmd.exe /c_ return code!
84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
85 | exit /b 1
86 |
87 | :mainEnd
88 | if "%OS%"=="Windows_NT" endlocal
89 |
90 | :omega
91 |
--------------------------------------------------------------------------------
/examples/redux/android/keystores/BUCK:
--------------------------------------------------------------------------------
1 | keystore(
2 | name = "debug",
3 | properties = "debug.keystore.properties",
4 | store = "debug.keystore",
5 | visibility = [
6 | "PUBLIC",
7 | ],
8 | )
9 |
--------------------------------------------------------------------------------
/examples/redux/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 |
--------------------------------------------------------------------------------
/examples/redux/android/settings.gradle:
--------------------------------------------------------------------------------
1 | rootProject.name = 'rnrfReduxSample'
2 |
3 | include ':app'
4 |
--------------------------------------------------------------------------------
/examples/redux/app.json:
--------------------------------------------------------------------------------
1 | {
2 | "displayName": "RNRF Redux Sample",
3 | "name": "rnrfReduxSample"
4 | }
--------------------------------------------------------------------------------
/examples/redux/babel.config.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | presets: [
3 | "babel-preset-react-native"
4 | ],
5 | plugins: [
6 | ['@babel/plugin-proposal-decorators', { legacy: true }],
7 | ],
8 | };
9 |
--------------------------------------------------------------------------------
/examples/redux/index.android.js:
--------------------------------------------------------------------------------
1 | import { AppRegistry } from 'react-native';
2 | import App from './src/app';
3 |
4 | AppRegistry.registerComponent('rnrfReduxSample', () => App);
--------------------------------------------------------------------------------
/examples/redux/index.ios.js:
--------------------------------------------------------------------------------
1 | import { AppRegistry } from 'react-native';
2 | import App from './src/app';
3 |
4 | AppRegistry.registerComponent('rnrfReduxSample', () => App);
--------------------------------------------------------------------------------
/examples/redux/ios/rnrfReduxSample-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 |
--------------------------------------------------------------------------------
/examples/redux/ios/rnrfReduxSample-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 |
--------------------------------------------------------------------------------
/examples/redux/ios/rnrfReduxSample/AppDelegate.h:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2015-present, Facebook, Inc.
3 | *
4 | * This source code is licensed under the MIT license found in the
5 | * LICENSE file in the root directory of this source tree.
6 | */
7 |
8 | #import
9 |
10 | @interface AppDelegate : UIResponder
11 |
12 | @property (nonatomic, strong) UIWindow *window;
13 |
14 | @end
15 |
--------------------------------------------------------------------------------
/examples/redux/ios/rnrfReduxSample/AppDelegate.m:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2015-present, Facebook, Inc.
3 | *
4 | * This source code is licensed under the MIT license found in the
5 | * LICENSE file in the root directory of this source tree.
6 | */
7 |
8 | #import "AppDelegate.h"
9 |
10 | #import
11 | #import
12 |
13 | @implementation AppDelegate
14 |
15 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
16 | {
17 | NSURL *jsCodeLocation;
18 |
19 | jsCodeLocation = [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index" fallbackResource:nil];
20 |
21 | RCTRootView *rootView = [[RCTRootView alloc] initWithBundleURL:jsCodeLocation
22 | moduleName:@"rnrfReduxSample"
23 | initialProperties:nil
24 | launchOptions:launchOptions];
25 | rootView.backgroundColor = [[UIColor alloc] initWithRed:1.0f green:1.0f blue:1.0f alpha:1];
26 |
27 | self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
28 | UIViewController *rootViewController = [UIViewController new];
29 | rootViewController.view = rootView;
30 | self.window.rootViewController = rootViewController;
31 | [self.window makeKeyAndVisible];
32 | return YES;
33 | }
34 |
35 | @end
36 |
--------------------------------------------------------------------------------
/examples/redux/ios/rnrfReduxSample/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 |
--------------------------------------------------------------------------------
/examples/redux/ios/rnrfReduxSample/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 | }
--------------------------------------------------------------------------------
/examples/redux/ios/rnrfReduxSample/Images.xcassets/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "info" : {
3 | "version" : 1,
4 | "author" : "xcode"
5 | }
6 | }
7 |
--------------------------------------------------------------------------------
/examples/redux/ios/rnrfReduxSample/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleDisplayName
8 | RNRF Redux Sample
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 |
--------------------------------------------------------------------------------
/examples/redux/ios/rnrfReduxSample/main.m:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2015-present, Facebook, Inc.
3 | *
4 | * This source code is licensed under the MIT license found in the
5 | * LICENSE file in the root directory of this source tree.
6 | */
7 |
8 | #import
9 |
10 | #import "AppDelegate.h"
11 |
12 | int main(int argc, char * argv[]) {
13 | @autoreleasepool {
14 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/examples/redux/ios/rnrfReduxSampleTests/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 |
--------------------------------------------------------------------------------
/examples/redux/ios/rnrfReduxSampleTests/rnrfReduxSampleTests.m:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2015-present, Facebook, Inc.
3 | *
4 | * This source code is licensed under the MIT license found in the
5 | * LICENSE file in the root directory of this source tree.
6 | */
7 |
8 | #import
9 | #import
10 |
11 | #import
12 | #import
13 |
14 | #define TIMEOUT_SECONDS 600
15 | #define TEXT_TO_LOOK_FOR @"Welcome to React Native!"
16 |
17 | @interface rnrfReduxSampleTests : XCTestCase
18 |
19 | @end
20 |
21 | @implementation rnrfReduxSampleTests
22 |
23 | - (BOOL)findSubviewInView:(UIView *)view matching:(BOOL(^)(UIView *view))test
24 | {
25 | if (test(view)) {
26 | return YES;
27 | }
28 | for (UIView *subview in [view subviews]) {
29 | if ([self findSubviewInView:subview matching:test]) {
30 | return YES;
31 | }
32 | }
33 | return NO;
34 | }
35 |
36 | - (void)testRendersWelcomeScreen
37 | {
38 | UIViewController *vc = [[[RCTSharedApplication() delegate] window] rootViewController];
39 | NSDate *date = [NSDate dateWithTimeIntervalSinceNow:TIMEOUT_SECONDS];
40 | BOOL foundElement = NO;
41 |
42 | __block NSString *redboxError = nil;
43 | RCTSetLogFunction(^(RCTLogLevel level, RCTLogSource source, NSString *fileName, NSNumber *lineNumber, NSString *message) {
44 | if (level >= RCTLogLevelError) {
45 | redboxError = message;
46 | }
47 | });
48 |
49 | while ([date timeIntervalSinceNow] > 0 && !foundElement && !redboxError) {
50 | [[NSRunLoop mainRunLoop] runMode:NSDefaultRunLoopMode beforeDate:[NSDate dateWithTimeIntervalSinceNow:0.1]];
51 | [[NSRunLoop mainRunLoop] runMode:NSRunLoopCommonModes beforeDate:[NSDate dateWithTimeIntervalSinceNow:0.1]];
52 |
53 | foundElement = [self findSubviewInView:vc.view matching:^BOOL(UIView *view) {
54 | if ([view.accessibilityLabel isEqualToString:TEXT_TO_LOOK_FOR]) {
55 | return YES;
56 | }
57 | return NO;
58 | }];
59 | }
60 |
61 | RCTSetLogFunction(RCTDefaultLogFunction);
62 |
63 | XCTAssertNil(redboxError, @"RedBox error: %@", redboxError);
64 | XCTAssertTrue(foundElement, @"Couldn't find element with text '%@' in %d seconds", TEXT_TO_LOOK_FOR, TIMEOUT_SECONDS);
65 | }
66 |
67 |
68 | @end
69 |
--------------------------------------------------------------------------------
/examples/redux/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "rnrfReduxSample",
3 | "version": "0.0.1",
4 | "private": true,
5 | "scripts": {
6 | "start": "node node_modules/react-native/local-cli/cli.js start",
7 | "ios": "react-native run-ios",
8 | "android": "react-native run-android",
9 | "dev:ios": "yarn dev && yarn ios",
10 | "dev:android": "yarn dev && yarn android",
11 | "dev": "cp ../../src/* node_modules/react-native-router-flux/src/",
12 | "test": "jest",
13 | "postinstall": "./node_modules/.bin/rnrf dedup"
14 | },
15 | "resolutions": {
16 | "*/@babel/cli": "7.0.0-beta.47",
17 | "*/@babel/core": "7.0.0-beta.47",
18 | "*/@babel/code-frame": "7.0.0-beta.47",
19 | "*/@babel/highlight": "7.0.0-beta.47"
20 | },
21 | "dependencies": {
22 | "prop-types": "^15.6.2",
23 | "react": "16.4.1",
24 | "react-native": "0.56.0",
25 | "react-native-router-flux": "file:../../",
26 | "react-native-router-flux-cli": "file:../../packages/react-native-router-flux-cli",
27 | "react-navigation": "2.13.x",
28 | "react-navigation-redux-helpers": "^2.0.5",
29 | "react-redux": "^5.0.5",
30 | "redux": "4.0.x"
31 | },
32 | "devDependencies": {
33 | "@babel/core": "7.0.0-beta.47",
34 | "@babel/plugin-proposal-decorators": "7.0.0-beta.47",
35 | "autobind-decorator": "^2.1.0",
36 | "babel-core": "^7.0.0-0",
37 | "babel-jest": "23.4.0",
38 | "babel-preset-react-native": "5.0.2",
39 | "jest": "^23.4.1",
40 | "react-test-renderer": "^16.4.1"
41 | },
42 | "jest": {
43 | "preset": "react-native"
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/examples/redux/readme.md:
--------------------------------------------------------------------------------
1 | # RNRF Sample project
2 |
3 | This project presents a bug in the current Redux integration of `react-native-router-flux` library.
4 | The project is *NOT* ment as a demonstration of the library's capabilities.
5 |
6 | [The library can be found here](https://github.com/aksonov/react-native-router-flux)
7 |
8 |
--------------------------------------------------------------------------------
/examples/redux/src/a-reducer.js:
--------------------------------------------------------------------------------
1 | import { ActionConst } from 'react-native-router-flux';
2 |
3 | const INITIAL_STATE = { data: null, currentScene: 'home' };
4 |
5 | export default (state = INITIAL_STATE, { type, payload, routeName }) => {
6 | switch (type) {
7 | case ActionConst.FOCUS:
8 | console.log('FOCUS event fired with scene parameter: ', routeName);
9 | return { ...state, currentScene: routeName };
10 | case 'data':
11 | return { ...state, data: payload };
12 |
13 | default:
14 | return state;
15 | }
16 | };
17 |
--------------------------------------------------------------------------------
/examples/redux/src/app.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import { createStore, applyMiddleware, combineReducers } from 'redux';
3 | import { Provider, connect } from 'react-redux';
4 | import { Scene, Actions, Router } from 'react-native-router-flux';
5 | import { reduxifyNavigator, createReactNavigationReduxMiddleware, createNavigationReducer } from 'react-navigation-redux-helpers';
6 |
7 | import Home from './home';
8 | import Page from './page';
9 | import reducer from './a-reducer';
10 |
11 | const AppNavigator = Actions.create(
12 |
13 |
14 |
15 | ,
16 | );
17 |
18 | // default nav reducer
19 | const initialState = AppNavigator.router.getStateForAction(AppNavigator.router.getActionForPathAndParams('home'));
20 | const navReducer = (state = initialState, action) => {
21 | const nextState = AppNavigator.router.getStateForAction(action, state);
22 | // Simply return the original `state` if `nextState` is null or undefined.
23 | return nextState || state;
24 | };
25 |
26 | const appReducer = combineReducers({
27 | nav: navReducer,
28 | reducer,
29 | });
30 |
31 | const middleware = createReactNavigationReduxMiddleware('root', state => state.nav);
32 | const ReduxNavigator = reduxifyNavigator(AppNavigator, 'root');
33 | const mapStateToProps = state => ({
34 | state: state.nav,
35 | });
36 | const ReduxRouter = connect(mapStateToProps)(Router);
37 | const store = createStore(appReducer, applyMiddleware(middleware));
38 |
39 | export default class App extends React.Component {
40 | render() {
41 | return (
42 |
43 |
44 |
45 | );
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/examples/redux/src/home.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import { View, Text, TouchableOpacity } from 'react-native';
3 | import { connect } from 'react-redux';
4 | import { Actions } from 'react-native-router-flux';
5 |
6 | class Home extends React.Component {
7 | render() {
8 | return (
9 |
10 |
11 | Current scene: "{this.props.currentScene}"
12 | Welcome to the home scene.
13 | {this.props.data ? this.props.data : 'No data...'}
14 |
15 | {
18 | Actions.page();
19 | }}
20 | >
21 | Go to "page" -->
22 |
23 |
24 | );
25 | }
26 | }
27 |
28 | const styles = {
29 | fill: {
30 | flex: 1,
31 | },
32 | header: {
33 | flex: 2,
34 | padding: 20,
35 | },
36 | text: {
37 | fontSize: 20,
38 | textAlign: 'center',
39 | justifyContent: 'center',
40 | },
41 | data: {
42 | marginTop: 100,
43 | fontSize: 30,
44 | textAlign: 'center',
45 | },
46 | button: {
47 | flex: 1,
48 | backgroundColor: 'green',
49 | justifyContent: 'center',
50 | },
51 | };
52 |
53 | const mapStateToProps = ({ reducer }) => ({ data } = reducer);
54 |
55 | export default connect(
56 | mapStateToProps,
57 | {},
58 | )(Home);
59 |
--------------------------------------------------------------------------------
/examples/redux/src/page.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import { View, Text, TouchableOpacity } from 'react-native';
3 | import { connect } from 'react-redux';
4 | import { Actions } from 'react-native-router-flux';
5 |
6 | class Page extends React.Component {
7 | render() {
8 | return (
9 |
10 |
11 | Current scene: "{this.props.currentScene}"
12 | This is an arbitrary page.
13 |
14 | {
17 | this.props.action('This is your data: [1, 2, 3]');
18 | }}
19 | >
20 | Get data
21 |
22 | {
25 | Actions.home();
26 | }}
27 | >
28 |
29 | {' '}
30 | {'<'}
31 | -- Go to "home"{' '}
32 |
33 |
34 |
35 | );
36 | }
37 | }
38 |
39 | const action = data => ({
40 | type: 'data',
41 | payload: data,
42 | });
43 |
44 | const styles = {
45 | fill: {
46 | flex: 1,
47 | },
48 | header: {
49 | flex: 4,
50 | padding: 20,
51 | },
52 | text: {
53 | fontSize: 20,
54 | textAlign: 'center',
55 | justifyContent: 'center',
56 | },
57 | data: {
58 | flex: 1,
59 | backgroundColor: 'cyan',
60 | justifyContent: 'center',
61 | },
62 | button: {
63 | flex: 1,
64 | backgroundColor: 'yellow',
65 | justifyContent: 'center',
66 | },
67 | };
68 |
69 | const mapStateToProps = ({ reducer }) => ({ data } = reducer);
70 |
71 | export default connect(
72 | mapStateToProps,
73 | { action },
74 | )(Page);
75 |
--------------------------------------------------------------------------------
/images/back_chevron.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aksonov/react-native-router-flux/b6e8e71aaa5301740724ebbc7bf3dbad5fda0696/images/back_chevron.png
--------------------------------------------------------------------------------
/images/menu_burger.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aksonov/react-native-router-flux/b6e8e71aaa5301740724ebbc7bf3dbad5fda0696/images/menu_burger.png
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "react-native-router-flux",
3 | "version": "4.3.1",
4 | "description": "React Native Router using Flux architecture",
5 | "repository": {
6 | "type": "git",
7 | "url": "https://github.com/aksonov/react-native-router-flux"
8 | },
9 | "bugs": {
10 | "url": "https://github.com/aksonov/react-native-router-flux"
11 | },
12 | "homepage": "https://github.com/aksonov/react-native-router-flux#readme",
13 | "license": "MIT",
14 | "main": "src/index.js",
15 | "types": "index.d.ts",
16 | "scripts": {
17 | "start": "node node_modules/react-native/local-cli/cli.js start",
18 | "postinstall": "./node_modules/.bin/opencollective postinstall || exit 0",
19 | "build": "./node_modules/.bin/babel src -d dist",
20 | "lint": "prettier-eslint $PWD/'src/**/*.js' $PWD/'__tests__/**/*.js' --list-different",
21 | "fix": "prettier-eslint $PWD/'src/**/*.js' $PWD/'__tests__/**/*.js' --write",
22 | "test": "jest"
23 | },
24 | "dependencies": {
25 | "@babel/runtime": "^7.6.0",
26 | "add": "^2.0.6",
27 | "lodash": "^4.17.15",
28 | "opencollective": "^1.0.3",
29 | "path-to-regexp": "^2.4.0",
30 | "prop-types": "^15.6.2",
31 | "react-navigation": "^4.x",
32 | "react-navigation-drawer": "^2.2.1",
33 | "react-navigation-stack": "^2.10.2",
34 | "react-navigation-tabs": "^2.10.1",
35 | "remove": "^0.1.5"
36 | },
37 | "devDependencies": {
38 | "@babel/cli": "7.0.0-beta.47",
39 | "@babel/code-frame": "7.0.0-beta.47",
40 | "@babel/core": "^7.6.0",
41 | "@babel/plugin-proposal-decorators": "7.0.0-beta.47",
42 | "@babel/plugin-proposal-optional-chaining": "7.0.0-beta.47",
43 | "@types/react": "16.4.12",
44 | "@types/react-native": "0.56.14",
45 | "babel-core": "^7.0.0-0",
46 | "babel-eslint": "9.0.0-beta.1",
47 | "babel-jest": "^25.1.0",
48 | "babel-preset-react-native": "5.0.2",
49 | "eslint": "^6.7.0",
50 | "eslint-config-airbnb": "17.1.0",
51 | "eslint-config-prettier": "3.0.1",
52 | "eslint-plugin-eslint-comments": "3.0.1",
53 | "eslint-plugin-import": "2.14.0",
54 | "eslint-plugin-jest": "21.22.0",
55 | "eslint-plugin-jsx-a11y": "6.1.1",
56 | "eslint-plugin-react": "7.11.0",
57 | "estraverse-fb": "1.3.2",
58 | "jest": "^25.1.0",
59 | "prettier-eslint": "8.8.2",
60 | "prettier-eslint-cli": "5.0.0-beta.0",
61 | "react": "16.4.1",
62 | "react-native": "0.56.0",
63 | "react-native-gesture-handler": "^1.4.1",
64 | "react-native-jest-mocks": "1.4.0",
65 | "react-test-renderer": "16.4.1"
66 | },
67 | "peerDependencies": {
68 | "react": "*",
69 | "react-native": "*"
70 | },
71 | "jest": {
72 | "preset": "react-native",
73 | "modulePathIgnorePatterns": [
74 | "/examples/"
75 | ],
76 | "transformIgnorePatterns": [
77 | "node_modules/(?!(jest-)?react-native|react-navigation|@react-navigation|react-navigation-(tabs|drawer|deprecated-tab-navigator|stack))"
78 | ],
79 | "setupFiles": [
80 | "./test/setup.js"
81 | ]
82 | },
83 | "eslintConfig": {
84 | "filePath": "./eslintrc.js"
85 | },
86 | "collective": {
87 | "type": "opencollective",
88 | "url": "https://opencollective.com/react-native-router-flux",
89 | "logo": "https://opencollective.com/opencollective/logo.txt"
90 | }
91 | }
92 |
--------------------------------------------------------------------------------
/packages/react-native-router-flux-cli/README.md:
--------------------------------------------------------------------------------
1 | # React Native Router Flux CLI tools
2 |
--------------------------------------------------------------------------------
/packages/react-native-router-flux-cli/index.js:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env node
2 |
3 | 'use strict';
4 |
5 | const path = require('path');
6 | const rimraf = require('rimraf');
7 |
8 | const [,, command, ...args] = process.argv;
9 |
10 | const commands = {
11 | dedup: function () {
12 | const blacklisted = [
13 | 'node_modules/react-native-router-flux/node_modules',
14 | 'node_modules/react-native-router-flux/examples'
15 | ];
16 |
17 | blacklisted.map(function (part) {
18 | const current = path.join(process.env.PWD, part);
19 | rimraf(current, function (err) {
20 | if (err) throw err
21 | console.log(`${current} removed!`);
22 | });
23 | });
24 | }
25 | };
26 |
27 | commands[command](...args);
28 |
--------------------------------------------------------------------------------
/packages/react-native-router-flux-cli/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "react-native-router-flux-cli",
3 | "version": "0.0.1",
4 | "license": "MIT",
5 | "description": "The React Native Router Flux CLI tools",
6 | "main": "index.js",
7 | "engines": {
8 | "node": ">=4"
9 | },
10 | "repository": {
11 | "type": "git",
12 | "url": "https://github.com/aksonov/react-native-router-flux.git"
13 | },
14 | "scripts": {
15 | "test": "mocha"
16 | },
17 | "bin": {
18 | "rnrf": "index.js"
19 | },
20 | "dependencies": {
21 | "rimraf": "^2.6.2"
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/packages/react-native-router-flux-cli/yarn.lock:
--------------------------------------------------------------------------------
1 | # THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
2 | # yarn lockfile v1
3 |
4 |
5 | balanced-match@^1.0.0:
6 | version "1.0.0"
7 | resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.0.tgz#89b4d199ab2bee49de164ea02b89ce462d71b767"
8 |
9 | brace-expansion@^1.1.7:
10 | version "1.1.11"
11 | resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-1.1.11.tgz#3c7fcbf529d87226f3d2f52b966ff5271eb441dd"
12 | dependencies:
13 | balanced-match "^1.0.0"
14 | concat-map "0.0.1"
15 |
16 | concat-map@0.0.1:
17 | version "0.0.1"
18 | resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b"
19 |
20 | fs.realpath@^1.0.0:
21 | version "1.0.0"
22 | resolved "https://registry.yarnpkg.com/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f"
23 |
24 | glob@^7.0.5:
25 | version "7.1.3"
26 | resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.3.tgz#3960832d3f1574108342dafd3a67b332c0969df1"
27 | dependencies:
28 | fs.realpath "^1.0.0"
29 | inflight "^1.0.4"
30 | inherits "2"
31 | minimatch "^3.0.4"
32 | once "^1.3.0"
33 | path-is-absolute "^1.0.0"
34 |
35 | inflight@^1.0.4:
36 | version "1.0.6"
37 | resolved "https://registry.yarnpkg.com/inflight/-/inflight-1.0.6.tgz#49bd6331d7d02d0c09bc910a1075ba8165b56df9"
38 | dependencies:
39 | once "^1.3.0"
40 | wrappy "1"
41 |
42 | inherits@2:
43 | version "2.0.3"
44 | resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.3.tgz#633c2c83e3da42a502f52466022480f4208261de"
45 |
46 | minimatch@^3.0.4:
47 | version "3.0.4"
48 | resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.0.4.tgz#5166e286457f03306064be5497e8dbb0c3d32083"
49 | dependencies:
50 | brace-expansion "^1.1.7"
51 |
52 | once@^1.3.0:
53 | version "1.4.0"
54 | resolved "https://registry.yarnpkg.com/once/-/once-1.4.0.tgz#583b1aa775961d4b113ac17d9c50baef9dd76bd1"
55 | dependencies:
56 | wrappy "1"
57 |
58 | path-is-absolute@^1.0.0:
59 | version "1.0.1"
60 | resolved "https://registry.yarnpkg.com/path-is-absolute/-/path-is-absolute-1.0.1.tgz#174b9268735534ffbc7ace6bf53a5a9e1b5c5f5f"
61 |
62 | rimraf@^2.6.2:
63 | version "2.6.2"
64 | resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-2.6.2.tgz#2ed8150d24a16ea8651e6d6ef0f47c4158ce7a36"
65 | dependencies:
66 | glob "^7.0.5"
67 |
68 | wrappy@1:
69 | version "1.0.2"
70 | resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f"
71 |
--------------------------------------------------------------------------------
/src/.watchmanconfig:
--------------------------------------------------------------------------------
1 | {
2 | "ignore_dirs": []
3 | }
4 |
--------------------------------------------------------------------------------
/src/ActionConst.js:
--------------------------------------------------------------------------------
1 | export const JUMP = 'REACT_NATIVE_ROUTER_FLUX_JUMP';
2 | export const PUSH = 'REACT_NATIVE_ROUTER_FLUX_PUSH';
3 | export const PUSH_OR_POP = 'REACT_NATIVE_ROUTER_FLUX_PUSH_OR_POP';
4 | export const REPLACE = 'REACT_NATIVE_ROUTER_FLUX_REPLACE';
5 | export const BACK = 'REACT_NATIVE_ROUTER_FLUX_BACK';
6 | export const BACK_ACTION = 'REACT_NATIVE_ROUTER_FLUX_BACK_ACTION';
7 | export const POP_TO = 'REACT_NATIVE_ROUTER_FLUX_POP_TO';
8 | export const REFRESH = 'REACT_NATIVE_ROUTER_FLUX_REFRESH';
9 | export const RESET = 'REACT_NATIVE_ROUTER_FLUX_RESET';
10 | export const FOCUS = 'REACT_NATIVE_ROUTER_FLUX_FOCUS';
11 | export const BLUR = 'REACT_NATIVE_ROUTER_FLUX_BLUR';
12 | export const ANDROID_BACK = 'REACT_NATIVE_ROUTER_FLUX_ANDROID_BACK';
13 |
--------------------------------------------------------------------------------
/src/Drawer.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2015-present, Pavel Aksonov
3 | * All rights reserved.
4 | *
5 | * This source code is licensed under the BSD-style license found in the
6 | * LICENSE file in the root directory of this source tree.
7 | *
8 | */
9 | export default () => null;
10 |
--------------------------------------------------------------------------------
/src/LegacyTabs.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2015-present, Pavel Aksonov
3 | * All rights reserved.
4 | *
5 | * This source code is licensed under the BSD-style license found in the
6 | * LICENSE file in the root directory of this source tree.
7 | *
8 | */
9 | export default () => null;
10 |
--------------------------------------------------------------------------------
/src/Lightbox.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2015-present, Pavel Aksonov
3 | * All rights reserved.
4 | *
5 | * This source code is licensed under the BSD-style license found in the
6 | * LICENSE file in the root directory of this source tree.
7 | *
8 | */
9 | export default () => null;
10 |
--------------------------------------------------------------------------------
/src/LightboxRenderer.js:
--------------------------------------------------------------------------------
1 | /* @flow */
2 |
3 | import React from 'react';
4 | import { View } from 'react-native';
5 |
6 | export default ({ navigation, descriptors }) => {
7 | const { state } = navigation;
8 | const descriptor = descriptors[state.routes[0].key]; // base component to render
9 | const Component = descriptor.getComponent();
10 | const popupDescriptor = descriptors[state.routes[state.index].key];
11 | const Popup = state.index !== 0 ? popupDescriptor.getComponent() : null;
12 | return (
13 |
14 |
15 | {Popup && }
16 |
17 | );
18 | };
19 |
--------------------------------------------------------------------------------
/src/Modal.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2015-present, Pavel Aksonov
3 | * All rights reserved.
4 | *
5 | * This source code is licensed under the BSD-style license found in the
6 | * LICENSE file in the root directory of this source tree.
7 | *
8 | */
9 | export default () => null;
10 |
--------------------------------------------------------------------------------
/src/Overlay.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2015-present, Pavel Aksonov
3 | * All rights reserved.
4 | *
5 | * This source code is licensed under the BSD-style license found in the
6 | * LICENSE file in the root directory of this source tree.
7 | *
8 | */
9 | export default () => null;
10 |
--------------------------------------------------------------------------------
/src/OverlayRenderer.js:
--------------------------------------------------------------------------------
1 | /* @flow */
2 |
3 | import React from 'react';
4 | import { View } from 'react-native';
5 |
6 | export default ({ navigationConfig, descriptors }) => {
7 | const { initialRouteName, order, contentComponent } = navigationConfig;
8 | const ContentComponent = contentComponent || View;
9 | const descriptor = descriptors[initialRouteName];
10 | const Component = descriptor.getComponent();
11 |
12 | const overlays = [];
13 | for (let i = 0; i < order.length; i += 1) {
14 | const routeName = order[i];
15 | if (initialRouteName !== routeName) {
16 | const Overlay = descriptors[routeName].getComponent();
17 | overlays.push();
18 | }
19 | }
20 | return (
21 |
22 |
23 | {overlays}
24 |
25 | );
26 | };
27 |
--------------------------------------------------------------------------------
/src/Reducer.js:
--------------------------------------------------------------------------------
1 | import _ from 'lodash';
2 | import { NavigationActions, StackActions } from 'react-navigation';
3 | import * as ActionConst from './ActionConst';
4 | import { getActiveState, popPrevious } from './State';
5 |
6 | export default function createReducer(store) {
7 | return (state, action) => {
8 | const NavigationStore = require('./Store').default;
9 | const navigationStore = store || new NavigationStore();
10 | const { type, routeName } = action;
11 | if (type === ActionConst.POP_TO) {
12 | let nextScene = '';
13 | let newState = state;
14 | let currentState = state;
15 | while (newState && nextScene !== routeName) {
16 | newState = navigationStore.getStateForAction(StackActions.pop(), currentState);
17 | if (newState) {
18 | nextScene = getActiveState(newState).routeName;
19 | if (nextScene !== routeName && _.isEqual(currentState, newState)) {
20 | console.warn(`popTo called with an unknown routeName: ${routeName}, current scene: ${nextScene}`);
21 | break;
22 | }
23 | if (nextScene !== routeName) {
24 | currentState = newState;
25 | }
26 | }
27 | }
28 | return nextScene === routeName ? newState : state;
29 | }
30 | if (type === ActionConst.REPLACE) {
31 | const newState = navigationStore.getStateForAction(
32 | NavigationActions.navigate({
33 | routeName,
34 | params: action.params,
35 | }),
36 | state,
37 | );
38 | const res = popPrevious(newState, routeName);
39 | return res;
40 | }
41 | return navigationStore.getStateForAction(action, state) || state;
42 | };
43 | }
44 |
--------------------------------------------------------------------------------
/src/Scene.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2015-present, Pavel Aksonov
3 | * All rights reserved.
4 | *
5 | * This source code is licensed under the BSD-style license found in the
6 | * LICENSE file in the root directory of this source tree.
7 | *
8 | */
9 | export default () => null;
10 |
--------------------------------------------------------------------------------
/src/Stack.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2015-present, Pavel Aksonov
3 | * All rights reserved.
4 | *
5 | * This source code is licensed under the BSD-style license found in the
6 | * LICENSE file in the root directory of this source tree.
7 | *
8 | */
9 | export default () => null;
10 |
--------------------------------------------------------------------------------
/src/State.js:
--------------------------------------------------------------------------------
1 | export function getActiveStateExceptDrawer(param) {
2 | const state = param;
3 | if (!state.routes) {
4 | return state;
5 | }
6 | if (state.routes[state.index].routeName === 'DrawerOpen') {
7 | return getActiveState(state.routes[0]);
8 | }
9 | return getActiveState(state.routes[state.index]);
10 | }
11 |
12 | export function isActiveRoute(state, routeName) {
13 | if (state.routeName === routeName) {
14 | return true;
15 | }
16 | if (!state.routes) {
17 | return state.routeName === routeName;
18 | }
19 | if (state.routes[state.index].routeName === 'DrawerOpen') {
20 | return isActiveRoute(state.routes[0], routeName);
21 | }
22 | return isActiveRoute(state.routes[state.index], routeName);
23 | }
24 |
25 | export function getRouteNameByKey(state, key) {
26 | if (state.key === key) {
27 | return state.routeName;
28 | }
29 | if (!state.routes) {
30 | return state.routeName;
31 | }
32 | if (state.routes[state.index].key === key) {
33 | return state.routes[state.index].routeName;
34 | }
35 | return getRouteNameByKey(state.routes[state.index], key);
36 | }
37 |
38 | export function getActiveState(param, parent) {
39 | const state = param;
40 | if (!state.routes) {
41 | return { ...state, parent };
42 | }
43 | return getActiveState(state.routes[state.index], { ...state, parent });
44 | }
45 |
46 | export function getParent(state, routeName, parent) {
47 | if (state.routeName === routeName) {
48 | return parent;
49 | }
50 | if (!state.routes) {
51 | return null;
52 | }
53 | for (let i = 0; i < state.routes.length; i += 1) {
54 | const res = getParent(state.routes[i], routeName, state);
55 | if (res) {
56 | return res;
57 | }
58 | }
59 | return null;
60 | }
61 |
62 | export function inject(state, key, index, routes) {
63 | if (!state.routes) {
64 | return state;
65 | }
66 | if (state.key === key) {
67 | if (routes) {
68 | return { ...state, routes, index };
69 | }
70 | return { ...state, index };
71 | }
72 | return { ...state, routes: state.routes.map(x => inject(x, key, index, routes)) };
73 | }
74 |
75 | export function popPrevious(state, routeName) {
76 | const parent = getParent(state, routeName);
77 | // console.log('FOUND PARENT:', JSON.stringify(parent));
78 | const { key, index } = parent;
79 | if (index) {
80 | const routes = [...parent.routes.slice(0, index - 1), ...parent.routes.slice(index)];
81 | const newState = inject(state, key, index - 1, routes);
82 | return newState;
83 | }
84 | return state;
85 | }
86 |
--------------------------------------------------------------------------------
/src/Tabs.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2015-present, Pavel Aksonov
3 | * All rights reserved.
4 | *
5 | * This source code is licensed under the BSD-style license found in the
6 | * LICENSE file in the root directory of this source tree.
7 | *
8 | */
9 | export default () => null;
10 |
--------------------------------------------------------------------------------
/src/Util.js:
--------------------------------------------------------------------------------
1 | // searches for the deepest explicitly set value for a key
2 | // in a navigationState tree.
3 | export function deepestExplicitValueForKey(navigationState, key) {
4 | let current;
5 | let selected = navigationState;
6 |
7 | while ({}.hasOwnProperty.call(selected, 'children')) {
8 | if (!selected.tabs) {
9 | // for pushed children, iterate through each, recording key value,
10 | // until reaching the selected child
11 | for (let i = 0; i < selected.index; i += 1) {
12 | if (typeof selected.children[i][key] !== 'undefined') {
13 | current = selected.children[i][key];
14 | }
15 | }
16 | }
17 | // set the new selected child and check for a key value
18 | selected = selected.children[selected.index];
19 | if (typeof selected[key] !== 'undefined') {
20 | current = selected[key];
21 | }
22 | }
23 |
24 | // fallback to the root key value
25 | if (typeof current === 'undefined') {
26 | current = navigationState[key];
27 | }
28 |
29 | return current;
30 | }
31 |
32 | export function assert(expr, failDescription) {
33 | if (!expr) {
34 | throw new Error(`[react-native-router-flux] ${failDescription}`);
35 | }
36 | }
37 |
38 | export const OnEnter = 'onEnter';
39 | export const OnExit = 'onExit';
40 |
--------------------------------------------------------------------------------
/src/createStackNavigatorHOC.js:
--------------------------------------------------------------------------------
1 | /* @flow */
2 |
3 | import { createNavigator, StackRouter } from 'react-navigation';
4 |
5 | export default NavigationView => (routeConfigs, navigationConfig = {}) => {
6 | const router = StackRouter(routeConfigs, navigationConfig);
7 | return createNavigator(NavigationView, router, navigationConfig);
8 | };
9 |
--------------------------------------------------------------------------------
/src/createTabNavigatorHOC.js:
--------------------------------------------------------------------------------
1 | /* @flow */
2 |
3 | import { createNavigator, TabRouter } from 'react-navigation';
4 |
5 | export default NavigationView => (routeConfigs, navigationConfig = {}) => {
6 | const router = TabRouter(routeConfigs, navigationConfig);
7 | return createNavigator(NavigationView, router, navigationConfig);
8 | };
9 |
--------------------------------------------------------------------------------
/src/defaultStore.js:
--------------------------------------------------------------------------------
1 | import NavigationStore from './Store';
2 |
3 | const defaultStore = new NavigationStore();
4 |
5 | export default defaultStore;
6 |
--------------------------------------------------------------------------------
/src/index.js:
--------------------------------------------------------------------------------
1 | import * as ActionConst from './ActionConst';
2 | import Router from './Router';
3 | import Reducer from './Reducer';
4 | import Scene from './Scene';
5 | import NavigationStore from './Store';
6 | import defaultStore from './defaultStore';
7 | import Modal from './Modal';
8 | import Lightbox from './Lightbox';
9 | import Stack from './Stack';
10 | import Drawer from './Drawer';
11 | import Tabs from './Tabs';
12 | import Overlay from './Overlay';
13 | import pathParser from './pathParser';
14 |
15 | const Actions = defaultStore;
16 |
17 | export {
18 | Reducer, ActionConst, Router, Scene, NavigationStore, Actions, Modal, Lightbox, Stack, Drawer, Tabs, Overlay, pathParser,
19 | };
20 |
--------------------------------------------------------------------------------
/src/pathParser.js:
--------------------------------------------------------------------------------
1 | import pathToRegexp from 'path-to-regexp';
2 |
3 | /**
4 | *
5 | * This set of functions are used to match a url with a uri path.
6 | * This functionality is based on the internals of React-Router's matchPath.
7 | * - https://github.com/ReactTraining/react-router/blob/master/packages/react-router/docs/api/matchPath.md
8 | *
9 | */
10 |
11 | /**
12 | * This function accepts a uri path and returns a regex to match that path
13 | * against a url and an array of the keys extracted from that uri path
14 | *
15 | * @param {String} path - a uri path in standard template (https://tools.ietf.org/html/rfc6570)
16 | *
17 | * Sample Input: "/user/:id/"
18 | *
19 | * Sample Output:
20 | * {
21 | * re: /^\/user\/([^\/]+?)\/(?:\/(?=$))?/i,
22 | * keys: [
23 | * name: "id"
24 | * delimiter: "/"
25 | * optional: false
26 | * partial: false
27 | * path: "[^\/]+?"
28 | * prefix: "/"
29 | * repeat: false,
30 | * ]
31 | * }
32 | */
33 | const compilePathToRegex = (path) => {
34 | const keys = [];
35 | const re = pathToRegexp(path, keys);
36 | // Returns the regex path to match a uri path to an actual url
37 | // and the keys that can be used to pull values from the url.
38 | return { re, keys };
39 | };
40 |
41 | /**
42 | * This function accepts a uri path and an actual url. It determines whether
43 | * or not they match one another. If they do not match, the funtion returns null.
44 | * If they do match, then the function returns the path and the params parsed
45 | * from the url.
46 | *
47 | * @param {String} path - a uri path in standard template (https://tools.ietf.org/html/rfc6570)
48 | * @param {String} url - a url that may or may not match the given path
49 | *
50 | * Case 1 - path Does Not Match Url:
51 | * Sample Input: (path: "/edit/organization/(:id)", url: "/user/300002/")
52 | *
53 | * Sample Output: null
54 | *
55 | * Case 2 - path Does Match Url:
56 | * Sample Input: (path: "/user/:id/", url: "/user/300002/")
57 | *
58 | * Sample Output:
59 | * {
60 | * path: "/user/:id/",
61 | * params: {
62 | * id: "300002",
63 | * }
64 | * }
65 | *
66 | */
67 | export const matchPath = (path, url) => {
68 | // Remove possible query fragments, which are not supported by iOS and some
69 | // versions of Anroid.
70 | const [urlCleaned] = url.split('?');
71 |
72 | // Append trailing slash for compatibility with pathToRegexp
73 | const urlToMatch = !urlCleaned.endsWith('/') ? `${urlCleaned}/` : urlCleaned;
74 |
75 | // Return the regex and the keys that can be parsed from a uri path.
76 | const { re, keys } = compilePathToRegex(path);
77 |
78 | // Check if the given url matches the uri path.
79 | const match = re.exec(urlToMatch);
80 |
81 | // If there is no match, then return null.
82 | if (!match) {
83 | return null;
84 | }
85 |
86 | // Destructure to return the compiled url (aka the reconstructed url based
87 | // on the regex and the url parameters.
88 | const [compiledUrl, ...values] = match;
89 |
90 | // If there is an inexact match (aka the compiled path does not match the
91 | // given url, then return null)
92 | if (urlToMatch !== compiledUrl) {
93 | return null;
94 | }
95 |
96 | const params = keys.reduce((acc, key, index) => Object.assign({}, acc, { [key.name]: values[index] }), {});
97 |
98 | return { path, params };
99 | };
100 |
101 | /**
102 | * This function accepts an array of uri paths and a url. If there are no paths
103 | * in the array that match the given url, then the function will return null.
104 | * If there is at least one matching uri path, it will return the first
105 | * matching path and the parsed url parameters (the output from matchPath()).
106 | *
107 | * @param {Array} possibleMatchingpaths - an array of uri paths in standard template (https://tools.ietf.org/html/rfc6570)
108 | * @param {String} url - a url that may or may not match a given path
109 | *
110 | */
111 | const pathParser = (url, possibleMatchingpaths = []) => possibleMatchingpaths.map(path => matchPath(path, url)).find(obj => obj);
112 |
113 | export default pathParser;
114 |
--------------------------------------------------------------------------------
/test/setup.js:
--------------------------------------------------------------------------------
1 | import mocks from 'react-native-jest-mocks';
2 |
3 | jest.mock('react-native-reanimated', () => {
4 | const View = require('react-native/Libraries/Components/View/View');
5 | return {
6 | Value: jest.fn(),
7 | event: jest.fn(),
8 | add: jest.fn(),
9 | eq: jest.fn(),
10 | set: jest.fn(),
11 | cond: jest.fn(),
12 | interpolate: jest.fn(),
13 | View,
14 | Extrapolate: { CLAMP: jest.fn() },
15 | Clock: jest.fn(),
16 | greaterThan: jest.fn(),
17 | lessThan: jest.fn(),
18 | startClock: jest.fn(),
19 | stopClock: jest.fn(),
20 | clockRunning: jest.fn(),
21 | not: jest.fn(),
22 | or: jest.fn(),
23 | and: jest.fn(),
24 | spring: jest.fn(),
25 | decay: jest.fn(),
26 | defined: jest.fn(),
27 | call: jest.fn(),
28 | Code: View,
29 | block: jest.fn(),
30 | abs: jest.fn(),
31 | greaterOrEq: jest.fn(),
32 | lessOrEq: jest.fn(),
33 | debug: jest.fn(),
34 | Easing: {
35 | in: jest.fn(),
36 | out: jest.fn(),
37 | },
38 | Transition: {
39 | Out: 'Out',
40 | },
41 | };
42 | });
43 |
44 | jest.mock('react-native-gesture-handler', () => {
45 | const View = require('react-native/Libraries/Components/View/View');
46 | return {
47 | Swipeable: View,
48 | DrawerLayout: View,
49 | State: {},
50 | ScrollView: View,
51 | Slider: View,
52 | Switch: View,
53 | TextInput: View,
54 | ToolbarAndroid: View,
55 | ViewPagerAndroid: View,
56 | DrawerLayoutAndroid: View,
57 | WebView: View,
58 | NativeViewGestureHandler: View,
59 | TapGestureHandler: View,
60 | FlingGestureHandler: View,
61 | ForceTouchGestureHandler: View,
62 | LongPressGestureHandler: View,
63 | PanGestureHandler: View,
64 | PinchGestureHandler: View,
65 | RotationGestureHandler: View,
66 | /* Buttons */
67 | RawButton: View,
68 | BaseButton: View,
69 | RectButton: View,
70 | BorderlessButton: View,
71 | /* Other */
72 | FlatList: View,
73 | gestureHandlerRootHOC: jest.fn(),
74 | Directions: {},
75 | };
76 | });
77 |
78 | mocks.initAll();
79 |
--------------------------------------------------------------------------------