Browse Source

Reinit example app

Eden Gottlieb 7 years ago
parent
commit
484d2bca3c
51 changed files with 1593 additions and 173 deletions
  1. 3
    0
      example/.babelrc
  2. 6
    0
      example/.buckconfig
  3. 48
    0
      example/.flowconfig
  4. 1
    0
      example/.gitattributes
  5. 53
    0
      example/.gitignore
  6. 1
    0
      example/.watchmanconfig
  7. 12
    0
      example/__tests__/App.js
  8. 17
    0
      example/android/.project
  9. 2
    0
      example/android/.settings/org.eclipse.buildship.core.prefs
  10. 6
    0
      example/android/app/.classpath
  11. 23
    0
      example/android/app/.project
  12. 2
    0
      example/android/app/.settings/org.eclipse.buildship.core.prefs
  13. 26
    27
      example/android/app/BUCK
  14. 13
    2
      example/android/app/build.gradle
  15. 7
    10
      example/android/app/proguard-rules.pro
  16. 3
    3
      example/android/app/src/main/AndroidManifest.xml
  17. 0
    0
      example/android/app/src/main/java/com/example/MainActivity.java
  18. 28
    16
      example/android/app/src/main/java/com/example/MainApplication.java
  19. 0
    0
      example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png
  20. 0
    0
      example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png
  21. 0
    0
      example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png
  22. 0
    0
      example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
  23. 0
    0
      example/android/app/src/main/res/values/strings.xml
  24. 0
    0
      example/android/app/src/main/res/values/styles.xml
  25. 1
    1
      example/android/build.gradle
  26. 0
    0
      example/android/gradle.properties
  27. 0
    0
      example/android/gradle/wrapper/gradle-wrapper.jar
  28. 1
    2
      example/android/gradle/wrapper/gradle-wrapper.properties
  29. 0
    0
      example/android/gradlew.bat
  30. 6
    6
      example/android/keystores/BUCK
  31. 0
    0
      example/android/keystores/debug.keystore.properties
  32. 0
    0
      example/android/settings.gradle
  33. 4
    0
      example/app.json
  34. 0
    4
      example/index.android.js
  35. 0
    4
      example/index.ios.js
  36. 4
    0
      example/index.js
  37. 54
    0
      example/ios/example-tvOS/Info.plist
  38. 24
    0
      example/ios/example-tvOSTests/Info.plist
  39. 850
    64
      example/ios/example.xcodeproj/project.pbxproj
  40. 129
    0
      example/ios/example.xcodeproj/xcshareddata/xcschemes/example-tvOS.xcscheme
  41. 129
    0
      example/ios/example.xcodeproj/xcshareddata/xcschemes/example.xcscheme
  42. 0
    0
      example/ios/example/AppDelegate.h
  43. 6
    11
      example/ios/example/AppDelegate.m
  44. 4
    4
      example/ios/example/Base.lproj/LaunchScreen.xib
  45. 0
    0
      example/ios/example/Images.xcassets/AppIcon.appiconset/Contents.json
  46. 6
    0
      example/ios/example/Images.xcassets/Contents.json
  47. 16
    15
      example/ios/example/Info.plist
  48. 0
    0
      example/ios/example/main.m
  49. 24
    0
      example/ios/exampleTests/Info.plist
  50. 70
    0
      example/ios/exampleTests/exampleTests.m
  51. 14
    4
      example/package.json

+ 3
- 0
example/.babelrc View File

@@ -0,0 +1,3 @@
1
+{
2
+  "presets": ["react-native"]
3
+}

+ 6
- 0
example/.buckconfig View File

@@ -0,0 +1,6 @@
1
+
2
+[android]
3
+  target = Google Inc.:Google APIs:23
4
+
5
+[maven_repositories]
6
+  central = https://repo1.maven.org/maven2

+ 48
- 0
example/.flowconfig View File

@@ -0,0 +1,48 @@
1
+[ignore]
2
+; We fork some components by platform
3
+.*/*[.]android.js
4
+
5
+; Ignore "BUCK" generated dirs
6
+<PROJECT_ROOT>/\.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
+
16
+; Ignore polyfills
17
+.*/Libraries/polyfills/.*
18
+
19
+[include]
20
+
21
+[libs]
22
+node_modules/react-native/Libraries/react-native/react-native-interface.js
23
+node_modules/react-native/flow/
24
+
25
+[options]
26
+emoji=true
27
+
28
+module.system=haste
29
+
30
+munge_underscores=true
31
+
32
+module.name_mapper='^[./a-zA-Z0-9$_-]+\.\(bmp\|gif\|jpg\|jpeg\|png\|psd\|svg\|webp\|m4v\|mov\|mp4\|mpeg\|mpg\|webm\|aac\|aiff\|caf\|m4a\|mp3\|wav\|html\|pdf\)$' -> 'RelativeImageStub'
33
+
34
+suppress_type=$FlowIssue
35
+suppress_type=$FlowFixMe
36
+suppress_type=$FlowFixMeProps
37
+suppress_type=$FlowFixMeState
38
+suppress_type=$FixMe
39
+
40
+suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(>=0\\.\\(5[0-7]\\|[1-4][0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)
41
+suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(>=0\\.\\(5[0-7]\\|[1-4][0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)?:? #[0-9]+
42
+suppress_comment=\\(.\\|\n\\)*\\$FlowFixedInNextDeploy
43
+suppress_comment=\\(.\\|\n\\)*\\$FlowExpectedError
44
+
45
+unsafe.enable_getters_and_setters=true
46
+
47
+[version]
48
+^0.57.0

+ 1
- 0
example/.gitattributes View File

@@ -0,0 +1 @@
1
+*.pbxproj -text

+ 53
- 0
example/.gitignore View File

@@ -0,0 +1,53 @@
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://docs.fastlane.tools/best-practices/source-control/
50
+
51
+*/fastlane/report.xml
52
+*/fastlane/Preview.html
53
+*/fastlane/screenshots

+ 1
- 0
example/.watchmanconfig View File

@@ -0,0 +1 @@
1
+{}

+ 12
- 0
example/__tests__/App.js View File

@@ -0,0 +1,12 @@
1
+import 'react-native';
2
+import React from 'react';
3
+import App from '../App';
4
+
5
+// Note: test renderer must be required after react-native.
6
+import renderer from 'react-test-renderer';
7
+
8
+it('renders correctly', () => {
9
+  const tree = renderer.create(
10
+    <App />
11
+  );
12
+});

+ 17
- 0
example/android/.project View File

@@ -0,0 +1,17 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<projectDescription>
3
+	<name>example</name>
4
+	<comment>Project example created by Buildship.</comment>
5
+	<projects>
6
+	</projects>
7
+	<buildSpec>
8
+		<buildCommand>
9
+			<name>org.eclipse.buildship.core.gradleprojectbuilder</name>
10
+			<arguments>
11
+			</arguments>
12
+		</buildCommand>
13
+	</buildSpec>
14
+	<natures>
15
+		<nature>org.eclipse.buildship.core.gradleprojectnature</nature>
16
+	</natures>
17
+</projectDescription>

+ 2
- 0
example/android/.settings/org.eclipse.buildship.core.prefs View File

@@ -0,0 +1,2 @@
1
+#Wed Jan 10 18:03:52 IST 2018
2
+connection.project.dir=

+ 6
- 0
example/android/app/.classpath View File

@@ -0,0 +1,6 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<classpath>
3
+	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
4
+	<classpathentry kind="con" path="org.eclipse.buildship.core.gradleclasspathcontainer"/>
5
+	<classpathentry kind="output" path="bin"/>
6
+</classpath>

+ 23
- 0
example/android/app/.project View File

@@ -0,0 +1,23 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<projectDescription>
3
+	<name>app</name>
4
+	<comment>Project app created by Buildship.</comment>
5
+	<projects>
6
+	</projects>
7
+	<buildSpec>
8
+		<buildCommand>
9
+			<name>org.eclipse.jdt.core.javabuilder</name>
10
+			<arguments>
11
+			</arguments>
12
+		</buildCommand>
13
+		<buildCommand>
14
+			<name>org.eclipse.buildship.core.gradleprojectbuilder</name>
15
+			<arguments>
16
+			</arguments>
17
+		</buildCommand>
18
+	</buildSpec>
19
+	<natures>
20
+		<nature>org.eclipse.jdt.core.javanature</nature>
21
+		<nature>org.eclipse.buildship.core.gradleprojectnature</nature>
22
+	</natures>
23
+</projectDescription>

+ 2
- 0
example/android/app/.settings/org.eclipse.buildship.core.prefs View File

@@ -0,0 +1,2 @@
1
+#Wed Jan 10 18:03:52 IST 2018
2
+connection.project.dir=..

+ 26
- 27
example/android/app/BUCK View File

@@ -1,5 +1,3 @@
1
-import re
2
-
3 1
 # To learn about Buck see [Docs](https://buckbuild.com/).
4 2
 # To run your application with Buck:
5 3
 # - install Buck
@@ -11,8 +9,9 @@ import re
11 9
 #
12 10
 
13 11
 lib_deps = []
12
+
14 13
 for jarfile in glob(['libs/*.jar']):
15
-  name = 'jars__' + re.sub(r'^.*/([^/]+)\.jar$', r'\1', jarfile)
14
+  name = 'jars__' + jarfile[jarfile.rindex('/') + 1: jarfile.rindex('.jar')]
16 15
   lib_deps.append(':' + name)
17 16
   prebuilt_jar(
18 17
     name = name,
@@ -20,7 +19,7 @@ for jarfile in glob(['libs/*.jar']):
20 19
   )
21 20
 
22 21
 for aarfile in glob(['libs/*.aar']):
23
-  name = 'aars__' + re.sub(r'^.*/([^/]+)\.aar$', r'\1', aarfile)
22
+  name = 'aars__' + aarfile[aarfile.rindex('/') + 1: aarfile.rindex('.aar')]
24 23
   lib_deps.append(':' + name)
25 24
   android_prebuilt_aar(
26 25
     name = name,
@@ -28,39 +27,39 @@ for aarfile in glob(['libs/*.aar']):
28 27
   )
29 28
 
30 29
 android_library(
31
-  name = 'all-libs',
32
-  exported_deps = lib_deps
30
+    name = "all-libs",
31
+    exported_deps = lib_deps,
33 32
 )
34 33
 
35 34
 android_library(
36
-  name = 'app-code',
37
-  srcs = glob([
38
-    'src/main/java/**/*.java',
39
-  ]),
40
-  deps = [
41
-    ':all-libs',
42
-    ':build_config',
43
-    ':res',
44
-  ],
35
+    name = "app-code",
36
+    srcs = glob([
37
+        "src/main/java/**/*.java",
38
+    ]),
39
+    deps = [
40
+        ":all-libs",
41
+        ":build_config",
42
+        ":res",
43
+    ],
45 44
 )
46 45
 
47 46
 android_build_config(
48
-  name = 'build_config',
49
-  package = 'com.react_native_navigation_bootstrap',
47
+    name = "build_config",
48
+    package = "com.example",
50 49
 )
51 50
 
52 51
 android_resource(
53
-  name = 'res',
54
-  res = 'src/main/res',
55
-  package = 'com.react_native_navigation_bootstrap',
52
+    name = "res",
53
+    package = "com.example",
54
+    res = "src/main/res",
56 55
 )
57 56
 
58 57
 android_binary(
59
-  name = 'app',
60
-  package_type = 'debug',
61
-  manifest = 'src/main/AndroidManifest.xml',
62
-  keystore = '//android/keystores:debug',
63
-  deps = [
64
-    ':app-code',
65
-  ],
58
+    name = "app",
59
+    keystore = "//android/keystores:debug",
60
+    manifest = "src/main/AndroidManifest.xml",
61
+    package_type = "debug",
62
+    deps = [
63
+        ":app-code",
64
+    ],
66 65
 )

+ 13
- 2
example/android/app/build.gradle View File

@@ -33,6 +33,13 @@ import com.android.build.OutputFile
33 33
  *   // bundleInPaidRelease: true,
34 34
  *   // bundleInBeta: true,
35 35
  *
36
+ *   // whether to disable dev mode in custom build variants (by default only disabled in release)
37
+ *   // for example: to disable dev mode in the staging build type (if configured)
38
+ *   devDisabledInStaging: true,
39
+ *   // The configuration property can be in the following formats
40
+ *   //         'devDisabledIn${productFlavor}${buildType}'
41
+ *   //         'devDisabledIn${buildType}'
42
+ *
36 43
  *   // the root of your project, i.e. where "package.json" lives
37 44
  *   root: "../../",
38 45
  *
@@ -58,13 +65,17 @@ import com.android.build.OutputFile
58 65
  *   inputExcludes: ["android/**", "ios/**"],
59 66
  *
60 67
  *   // override which node gets called and with what additional arguments
61
- *   nodeExecutableAndArgs: ["node"]
68
+ *   nodeExecutableAndArgs: ["node"],
62 69
  *
63 70
  *   // supply additional arguments to the packager
64 71
  *   extraPackagerArgs: []
65 72
  * ]
66 73
  */
67 74
 
75
+project.ext.react = [
76
+    entryFile: "index.js"
77
+]
78
+
68 79
 apply from: "../../node_modules/react-native/react.gradle"
69 80
 
70 81
 /**
@@ -87,7 +98,7 @@ android {
87 98
     buildToolsVersion "23.0.1"
88 99
 
89 100
     defaultConfig {
90
-        applicationId "com.react_native_navigation_bootstrap"
101
+        applicationId "com.example"
91 102
         minSdkVersion 16
92 103
         targetSdkVersion 22
93 104
         versionCode 1

+ 7
- 10
example/android/app/proguard-rules.pro View File

@@ -12,9 +12,9 @@
12 12
 # If your project uses WebView with JS, uncomment the following
13 13
 # and specify the fully qualified class name to the JavaScript interface
14 14
 # class:
15
--keepclassmembers class fqcn.of.javascript.interface.for.webview {
16
-   public *;
17
-}
15
+#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
16
+#   public *;
17
+#}
18 18
 
19 19
 # Disabling obfuscation is useful if you collect stack traces from production crashes
20 20
 # (unless you are using a system that supports de-obfuscate the stack traces).
@@ -50,6 +50,10 @@
50 50
 
51 51
 -dontwarn com.facebook.react.**
52 52
 
53
+# TextLayoutBuilder uses a non-public Android constructor within StaticLayout.
54
+# See libs/proxy/src/main/java/com/facebook/fbui/textlayoutbuilder/proxy for details.
55
+-dontwarn android.text.StaticLayout
56
+
53 57
 # okhttp
54 58
 
55 59
 -keepattributes Signature
@@ -64,10 +68,3 @@
64 68
 -dontwarn java.nio.file.*
65 69
 -dontwarn org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement
66 70
 -dontwarn okio.**
67
-
68
-# react-native-webview-bridge
69
--keepattributes JavascriptInterface
70
--keep class com.github.alinz.reactnativewebviewbridge.**
71
--keepclassmembers class ** {
72
-    @android.webkit.JavascriptInterface <methods>;
73
-}

+ 3
- 3
example/android/app/src/main/AndroidManifest.xml View File

@@ -11,16 +11,16 @@
11 11
         android:targetSdkVersion="22" />
12 12
 
13 13
     <application
14
-    android:name=".MainApplication"
14
+      android:name=".MainApplication"
15 15
       android:allowBackup="true"
16 16
       android:label="@string/app_name"
17 17
       android:icon="@mipmap/ic_launcher"
18 18
       android:theme="@style/AppTheme">
19 19
       <activity
20 20
         android:name=".MainActivity"
21
-        android:windowSoftInputMode="adjustResize"
22 21
         android:label="@string/app_name"
23
-        android:configChanges="keyboard|keyboardHidden|orientation|screenSize">
22
+        android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
23
+        android:windowSoftInputMode="adjustResize">
24 24
         <intent-filter>
25 25
             <action android:name="android.intent.action.MAIN" />
26 26
             <category android:name="android.intent.category.LAUNCHER" />

+ 0
- 0
example/android/app/src/main/java/com/example/MainActivity.java View File


+ 28
- 16
example/android/app/src/main/java/com/example/MainApplication.java View File

@@ -6,6 +6,7 @@ import com.facebook.react.ReactApplication;
6 6
 import com.facebook.react.ReactNativeHost;
7 7
 import com.facebook.react.ReactPackage;
8 8
 import com.facebook.react.shell.MainReactPackage;
9
+import com.facebook.soloader.SoLoader;
9 10
 import com.github.alinz.reactnativewebviewbridge.WebViewBridgePackage;
10 11
 
11 12
 import java.util.Arrays;
@@ -13,23 +14,34 @@ import java.util.List;
13 14
 
14 15
 public class MainApplication extends Application implements ReactApplication {
15 16
 
16
-    private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) {
17
-        @Override
18
-        protected boolean getUseDeveloperSupport() {
19
-            return BuildConfig.DEBUG;
20
-        }
21
-
22
-        @Override
23
-        protected List<ReactPackage> getPackages() {
24
-            return Arrays.<ReactPackage>asList(
25
-                    new MainReactPackage(),
26
-                    new WebViewBridgePackage()
27
-            );
28
-        }
29
-    };
17
+  private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) {
18
+    @Override
19
+    public boolean getUseDeveloperSupport() {
20
+      return BuildConfig.DEBUG;
21
+    }
30 22
 
31 23
     @Override
32
-    public ReactNativeHost getReactNativeHost() {
33
-        return mReactNativeHost;
24
+    protected List<ReactPackage> getPackages() {
25
+      return Arrays.<ReactPackage>asList(
26
+          new MainReactPackage(),
27
+          new WebViewBridgePackage()
28
+      );
34 29
     }
30
+
31
+    @Override
32
+    protected String getJSMainModuleName() {
33
+      return "index";
34
+    }
35
+  };
36
+
37
+  @Override
38
+  public ReactNativeHost getReactNativeHost() {
39
+    return mReactNativeHost;
40
+  }
41
+
42
+  @Override
43
+  public void onCreate() {
44
+    super.onCreate();
45
+    SoLoader.init(this, /* native exopackage */ false);
46
+  }
35 47
 }

+ 0
- 0
example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png View File


+ 0
- 0
example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png View File


+ 0
- 0
example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png View File


+ 0
- 0
example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png View File


+ 0
- 0
example/android/app/src/main/res/values/strings.xml View File


+ 0
- 0
example/android/app/src/main/res/values/styles.xml View File


+ 1
- 1
example/android/build.gradle View File

@@ -5,7 +5,7 @@ buildscript {
5 5
         jcenter()
6 6
     }
7 7
     dependencies {
8
-        classpath 'com.android.tools.build:gradle:1.3.1'
8
+        classpath 'com.android.tools.build:gradle:2.2.3'
9 9
 
10 10
         // NOTE: Do not place your application dependencies here; they belong
11 11
         // in the individual module build.gradle files

+ 0
- 0
example/android/gradle.properties View File


+ 0
- 0
example/android/gradle/wrapper/gradle-wrapper.jar View File


+ 1
- 2
example/android/gradle/wrapper/gradle-wrapper.properties View File

@@ -1,6 +1,5 @@
1
-#Wed Aug 17 16:46:17 IDT 2016
2 1
 distributionBase=GRADLE_USER_HOME
3 2
 distributionPath=wrapper/dists
4 3
 zipStoreBase=GRADLE_USER_HOME
5 4
 zipStorePath=wrapper/dists
6
-distributionUrl=https\://services.gradle.org/distributions/gradle-2.2-all.zip
5
+distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip

+ 0
- 0
example/android/gradlew.bat View File


+ 6
- 6
example/android/keystores/BUCK View File

@@ -1,8 +1,8 @@
1 1
 keystore(
2
-  name = 'debug',
3
-  store = 'debug.keystore',
4
-  properties = 'debug.keystore.properties',
5
-  visibility = [
6
-    'PUBLIC',
7
-  ],
2
+    name = "debug",
3
+    properties = "debug.keystore.properties",
4
+    store = "debug.keystore",
5
+    visibility = [
6
+        "PUBLIC",
7
+    ],
8 8
 )

+ 0
- 0
example/android/keystores/debug.keystore.properties View File


+ 0
- 0
example/android/settings.gradle View File


+ 4
- 0
example/app.json View File

@@ -0,0 +1,4 @@
1
+{
2
+  "name": "example",
3
+  "displayName": "example"
4
+}

+ 0
- 4
example/index.android.js View File

@@ -1,4 +0,0 @@
1
-import RichTextExample from './app';
2
-import {AppRegistry} from 'react-native';
3
-
4
-AppRegistry.registerComponent('example', () => RichTextExample);

+ 0
- 4
example/index.ios.js View File

@@ -1,4 +0,0 @@
1
-import RichTextExample from './app';
2
-import {AppRegistry} from 'react-native';
3
-
4
-AppRegistry.registerComponent('example', () => RichTextExample);

+ 4
- 0
example/index.js View File

@@ -0,0 +1,4 @@
1
+import { AppRegistry } from 'react-native';
2
+import App from './App';
3
+
4
+AppRegistry.registerComponent('example', () => App);

+ 54
- 0
example/ios/example-tvOS/Info.plist View File

@@ -0,0 +1,54 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3
+<plist version="1.0">
4
+<dict>
5
+	<key>CFBundleDevelopmentRegion</key>
6
+	<string>en</string>
7
+	<key>CFBundleExecutable</key>
8
+	<string>$(EXECUTABLE_NAME)</string>
9
+	<key>CFBundleIdentifier</key>
10
+	<string>org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier)</string>
11
+	<key>CFBundleInfoDictionaryVersion</key>
12
+	<string>6.0</string>
13
+	<key>CFBundleName</key>
14
+	<string>$(PRODUCT_NAME)</string>
15
+	<key>CFBundlePackageType</key>
16
+	<string>APPL</string>
17
+	<key>CFBundleShortVersionString</key>
18
+	<string>1.0</string>
19
+	<key>CFBundleSignature</key>
20
+	<string>????</string>
21
+	<key>CFBundleVersion</key>
22
+	<string>1</string>
23
+	<key>LSRequiresIPhoneOS</key>
24
+	<true/>
25
+	<key>UILaunchStoryboardName</key>
26
+	<string>LaunchScreen</string>
27
+	<key>UIRequiredDeviceCapabilities</key>
28
+	<array>
29
+		<string>armv7</string>
30
+	</array>
31
+	<key>UISupportedInterfaceOrientations</key>
32
+	<array>
33
+		<string>UIInterfaceOrientationPortrait</string>
34
+		<string>UIInterfaceOrientationLandscapeLeft</string>
35
+		<string>UIInterfaceOrientationLandscapeRight</string>
36
+	</array>
37
+	<key>UIViewControllerBasedStatusBarAppearance</key>
38
+	<false/>
39
+	<key>NSLocationWhenInUseUsageDescription</key>
40
+	<string></string>
41
+	<key>NSAppTransportSecurity</key>
42
+	<!--See http://ste.vn/2015/06/10/configuring-app-transport-security-ios-9-osx-10-11/ -->
43
+	<dict>
44
+		<key>NSExceptionDomains</key>
45
+		<dict>
46
+			<key>localhost</key>
47
+			<dict>
48
+				<key>NSExceptionAllowsInsecureHTTPLoads</key>
49
+				<true/>
50
+			</dict>
51
+		</dict>
52
+	</dict>
53
+</dict>
54
+</plist>

+ 24
- 0
example/ios/example-tvOSTests/Info.plist View File

@@ -0,0 +1,24 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3
+<plist version="1.0">
4
+<dict>
5
+	<key>CFBundleDevelopmentRegion</key>
6
+	<string>en</string>
7
+	<key>CFBundleExecutable</key>
8
+	<string>$(EXECUTABLE_NAME)</string>
9
+	<key>CFBundleIdentifier</key>
10
+	<string>org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier)</string>
11
+	<key>CFBundleInfoDictionaryVersion</key>
12
+	<string>6.0</string>
13
+	<key>CFBundleName</key>
14
+	<string>$(PRODUCT_NAME)</string>
15
+	<key>CFBundlePackageType</key>
16
+	<string>BNDL</string>
17
+	<key>CFBundleShortVersionString</key>
18
+	<string>1.0</string>
19
+	<key>CFBundleSignature</key>
20
+	<string>????</string>
21
+	<key>CFBundleVersion</key>
22
+	<string>1</string>
23
+</dict>
24
+</plist>

+ 850
- 64
example/ios/example.xcodeproj/project.pbxproj
File diff suppressed because it is too large
View File


+ 129
- 0
example/ios/example.xcodeproj/xcshareddata/xcschemes/example-tvOS.xcscheme View File

@@ -0,0 +1,129 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<Scheme
3
+   LastUpgradeVersion = "0820"
4
+   version = "1.3">
5
+   <BuildAction
6
+      parallelizeBuildables = "NO"
7
+      buildImplicitDependencies = "YES">
8
+      <BuildActionEntries>
9
+         <BuildActionEntry
10
+            buildForTesting = "YES"
11
+            buildForRunning = "YES"
12
+            buildForProfiling = "YES"
13
+            buildForArchiving = "YES"
14
+            buildForAnalyzing = "YES">
15
+            <BuildableReference
16
+               BuildableIdentifier = "primary"
17
+               BlueprintIdentifier = "2D2A28121D9B038B00D4039D"
18
+               BuildableName = "libReact.a"
19
+               BlueprintName = "React-tvOS"
20
+               ReferencedContainer = "container:../node_modules/react-native/React/React.xcodeproj">
21
+            </BuildableReference>
22
+         </BuildActionEntry>
23
+         <BuildActionEntry
24
+            buildForTesting = "YES"
25
+            buildForRunning = "YES"
26
+            buildForProfiling = "YES"
27
+            buildForArchiving = "YES"
28
+            buildForAnalyzing = "YES">
29
+            <BuildableReference
30
+               BuildableIdentifier = "primary"
31
+               BlueprintIdentifier = "2D02E47A1E0B4A5D006451C7"
32
+               BuildableName = "example-tvOS.app"
33
+               BlueprintName = "example-tvOS"
34
+               ReferencedContainer = "container:example.xcodeproj">
35
+            </BuildableReference>
36
+         </BuildActionEntry>
37
+         <BuildActionEntry
38
+            buildForTesting = "YES"
39
+            buildForRunning = "YES"
40
+            buildForProfiling = "NO"
41
+            buildForArchiving = "NO"
42
+            buildForAnalyzing = "YES">
43
+            <BuildableReference
44
+               BuildableIdentifier = "primary"
45
+               BlueprintIdentifier = "2D02E48F1E0B4A5D006451C7"
46
+               BuildableName = "example-tvOSTests.xctest"
47
+               BlueprintName = "example-tvOSTests"
48
+               ReferencedContainer = "container:example.xcodeproj">
49
+            </BuildableReference>
50
+         </BuildActionEntry>
51
+      </BuildActionEntries>
52
+   </BuildAction>
53
+   <TestAction
54
+      buildConfiguration = "Debug"
55
+      selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
56
+      selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
57
+      shouldUseLaunchSchemeArgsEnv = "YES">
58
+      <Testables>
59
+         <TestableReference
60
+            skipped = "NO">
61
+            <BuildableReference
62
+               BuildableIdentifier = "primary"
63
+               BlueprintIdentifier = "2D02E48F1E0B4A5D006451C7"
64
+               BuildableName = "example-tvOSTests.xctest"
65
+               BlueprintName = "example-tvOSTests"
66
+               ReferencedContainer = "container:example.xcodeproj">
67
+            </BuildableReference>
68
+         </TestableReference>
69
+      </Testables>
70
+      <MacroExpansion>
71
+         <BuildableReference
72
+            BuildableIdentifier = "primary"
73
+            BlueprintIdentifier = "2D02E47A1E0B4A5D006451C7"
74
+            BuildableName = "example-tvOS.app"
75
+            BlueprintName = "example-tvOS"
76
+            ReferencedContainer = "container:example.xcodeproj">
77
+         </BuildableReference>
78
+      </MacroExpansion>
79
+      <AdditionalOptions>
80
+      </AdditionalOptions>
81
+   </TestAction>
82
+   <LaunchAction
83
+      buildConfiguration = "Debug"
84
+      selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
85
+      selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
86
+      launchStyle = "0"
87
+      useCustomWorkingDirectory = "NO"
88
+      ignoresPersistentStateOnLaunch = "NO"
89
+      debugDocumentVersioning = "YES"
90
+      debugServiceExtension = "internal"
91
+      allowLocationSimulation = "YES">
92
+      <BuildableProductRunnable
93
+         runnableDebuggingMode = "0">
94
+         <BuildableReference
95
+            BuildableIdentifier = "primary"
96
+            BlueprintIdentifier = "2D02E47A1E0B4A5D006451C7"
97
+            BuildableName = "example-tvOS.app"
98
+            BlueprintName = "example-tvOS"
99
+            ReferencedContainer = "container:example.xcodeproj">
100
+         </BuildableReference>
101
+      </BuildableProductRunnable>
102
+      <AdditionalOptions>
103
+      </AdditionalOptions>
104
+   </LaunchAction>
105
+   <ProfileAction
106
+      buildConfiguration = "Release"
107
+      shouldUseLaunchSchemeArgsEnv = "YES"
108
+      savedToolIdentifier = ""
109
+      useCustomWorkingDirectory = "NO"
110
+      debugDocumentVersioning = "YES">
111
+      <BuildableProductRunnable
112
+         runnableDebuggingMode = "0">
113
+         <BuildableReference
114
+            BuildableIdentifier = "primary"
115
+            BlueprintIdentifier = "2D02E47A1E0B4A5D006451C7"
116
+            BuildableName = "example-tvOS.app"
117
+            BlueprintName = "example-tvOS"
118
+            ReferencedContainer = "container:example.xcodeproj">
119
+         </BuildableReference>
120
+      </BuildableProductRunnable>
121
+   </ProfileAction>
122
+   <AnalyzeAction
123
+      buildConfiguration = "Debug">
124
+   </AnalyzeAction>
125
+   <ArchiveAction
126
+      buildConfiguration = "Release"
127
+      revealArchiveInOrganizer = "YES">
128
+   </ArchiveAction>
129
+</Scheme>

+ 129
- 0
example/ios/example.xcodeproj/xcshareddata/xcschemes/example.xcscheme View File

@@ -0,0 +1,129 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<Scheme
3
+   LastUpgradeVersion = "0620"
4
+   version = "1.3">
5
+   <BuildAction
6
+      parallelizeBuildables = "NO"
7
+      buildImplicitDependencies = "YES">
8
+      <BuildActionEntries>
9
+         <BuildActionEntry
10
+            buildForTesting = "YES"
11
+            buildForRunning = "YES"
12
+            buildForProfiling = "YES"
13
+            buildForArchiving = "YES"
14
+            buildForAnalyzing = "YES">
15
+            <BuildableReference
16
+               BuildableIdentifier = "primary"
17
+               BlueprintIdentifier = "83CBBA2D1A601D0E00E9B192"
18
+               BuildableName = "libReact.a"
19
+               BlueprintName = "React"
20
+               ReferencedContainer = "container:../node_modules/react-native/React/React.xcodeproj">
21
+            </BuildableReference>
22
+         </BuildActionEntry>
23
+         <BuildActionEntry
24
+            buildForTesting = "YES"
25
+            buildForRunning = "YES"
26
+            buildForProfiling = "YES"
27
+            buildForArchiving = "YES"
28
+            buildForAnalyzing = "YES">
29
+            <BuildableReference
30
+               BuildableIdentifier = "primary"
31
+               BlueprintIdentifier = "13B07F861A680F5B00A75B9A"
32
+               BuildableName = "example.app"
33
+               BlueprintName = "example"
34
+               ReferencedContainer = "container:example.xcodeproj">
35
+            </BuildableReference>
36
+         </BuildActionEntry>
37
+         <BuildActionEntry
38
+            buildForTesting = "YES"
39
+            buildForRunning = "YES"
40
+            buildForProfiling = "NO"
41
+            buildForArchiving = "NO"
42
+            buildForAnalyzing = "YES">
43
+            <BuildableReference
44
+               BuildableIdentifier = "primary"
45
+               BlueprintIdentifier = "00E356ED1AD99517003FC87E"
46
+               BuildableName = "exampleTests.xctest"
47
+               BlueprintName = "exampleTests"
48
+               ReferencedContainer = "container:example.xcodeproj">
49
+            </BuildableReference>
50
+         </BuildActionEntry>
51
+      </BuildActionEntries>
52
+   </BuildAction>
53
+   <TestAction
54
+      buildConfiguration = "Debug"
55
+      selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
56
+      selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
57
+      shouldUseLaunchSchemeArgsEnv = "YES">
58
+      <Testables>
59
+         <TestableReference
60
+            skipped = "NO">
61
+            <BuildableReference
62
+               BuildableIdentifier = "primary"
63
+               BlueprintIdentifier = "00E356ED1AD99517003FC87E"
64
+               BuildableName = "exampleTests.xctest"
65
+               BlueprintName = "exampleTests"
66
+               ReferencedContainer = "container:example.xcodeproj">
67
+            </BuildableReference>
68
+         </TestableReference>
69
+      </Testables>
70
+      <MacroExpansion>
71
+         <BuildableReference
72
+            BuildableIdentifier = "primary"
73
+            BlueprintIdentifier = "13B07F861A680F5B00A75B9A"
74
+            BuildableName = "example.app"
75
+            BlueprintName = "example"
76
+            ReferencedContainer = "container:example.xcodeproj">
77
+         </BuildableReference>
78
+      </MacroExpansion>
79
+      <AdditionalOptions>
80
+      </AdditionalOptions>
81
+   </TestAction>
82
+   <LaunchAction
83
+      buildConfiguration = "Debug"
84
+      selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
85
+      selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
86
+      launchStyle = "0"
87
+      useCustomWorkingDirectory = "NO"
88
+      ignoresPersistentStateOnLaunch = "NO"
89
+      debugDocumentVersioning = "YES"
90
+      debugServiceExtension = "internal"
91
+      allowLocationSimulation = "YES">
92
+      <BuildableProductRunnable
93
+         runnableDebuggingMode = "0">
94
+         <BuildableReference
95
+            BuildableIdentifier = "primary"
96
+            BlueprintIdentifier = "13B07F861A680F5B00A75B9A"
97
+            BuildableName = "example.app"
98
+            BlueprintName = "example"
99
+            ReferencedContainer = "container:example.xcodeproj">
100
+         </BuildableReference>
101
+      </BuildableProductRunnable>
102
+      <AdditionalOptions>
103
+      </AdditionalOptions>
104
+   </LaunchAction>
105
+   <ProfileAction
106
+      buildConfiguration = "Release"
107
+      shouldUseLaunchSchemeArgsEnv = "YES"
108
+      savedToolIdentifier = ""
109
+      useCustomWorkingDirectory = "NO"
110
+      debugDocumentVersioning = "YES">
111
+      <BuildableProductRunnable
112
+         runnableDebuggingMode = "0">
113
+         <BuildableReference
114
+            BuildableIdentifier = "primary"
115
+            BlueprintIdentifier = "13B07F861A680F5B00A75B9A"
116
+            BuildableName = "example.app"
117
+            BlueprintName = "example"
118
+            ReferencedContainer = "container:example.xcodeproj">
119
+         </BuildableReference>
120
+      </BuildableProductRunnable>
121
+   </ProfileAction>
122
+   <AnalyzeAction
123
+      buildConfiguration = "Debug">
124
+   </AnalyzeAction>
125
+   <ArchiveAction
126
+      buildConfiguration = "Release"
127
+      revealArchiveInOrganizer = "YES">
128
+   </ArchiveAction>
129
+</Scheme>

+ 0
- 0
example/ios/example/AppDelegate.h View File


+ 6
- 11
example/ios/example/AppDelegate.m View File

@@ -8,34 +8,29 @@
8 8
  */
9 9
 
10 10
 #import "AppDelegate.h"
11
-#import "RCTBundleURLProvider.h"
12
-#import "RCTRootView.h"
13 11
 
14
-// IMPORTANT: if you're getting an Xcode error that RCCManager.h isn't found, you've probably ran "npm install"
15
-// with npm ver 2. You'll need to "npm install" with npm 3 (see https://github.com/wix/react-native-navigation/issues/1)
16
-
17
-#import "RCTRootView.h"
12
+#import <React/RCTBundleURLProvider.h>
13
+#import <React/RCTRootView.h>
18 14
 
19 15
 @implementation AppDelegate
20 16
 
21 17
 - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
22 18
 {
23 19
   NSURL *jsCodeLocation;
24
-  
25
-  jsCodeLocation = [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index.ios" fallbackResource:nil];
26
-  
20
+
21
+  jsCodeLocation = [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index" fallbackResource:nil];
22
+
27 23
   RCTRootView *rootView = [[RCTRootView alloc] initWithBundleURL:jsCodeLocation
28 24
                                                       moduleName:@"example"
29 25
                                                initialProperties:nil
30 26
                                                    launchOptions:launchOptions];
31 27
   rootView.backgroundColor = [[UIColor alloc] initWithRed:1.0f green:1.0f blue:1.0f alpha:1];
32
-  
28
+
33 29
   self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
34 30
   UIViewController *rootViewController = [UIViewController new];
35 31
   rootViewController.view = rootView;
36 32
   self.window.rootViewController = rootViewController;
37 33
   [self.window makeKeyAndVisible];
38
-  
39 34
   return YES;
40 35
 }
41 36
 

+ 4
- 4
example/ios/example/Base.lproj/LaunchScreen.xib View File

@@ -1,8 +1,8 @@
1 1
 <?xml version="1.0" encoding="UTF-8" standalone="no"?>
2
-<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="11201" systemVersion="15G1004" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" colorMatched="NO">
2
+<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="7702" systemVersion="14D136" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES">
3 3
     <dependencies>
4
-        <development version="7000" identifier="xcode"/>
5
-        <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="11161"/>
4
+        <deployment identifier="iOS"/>
5
+        <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="7701"/>
6 6
         <capability name="Constraints with non-1.0 multipliers" minToolsVersion="5.1"/>
7 7
     </dependencies>
8 8
     <objects>
@@ -25,7 +25,7 @@
25 25
                     <nil key="highlightedColor"/>
26 26
                 </label>
27 27
             </subviews>
28
-            <color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="calibratedRGB"/>
28
+            <color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
29 29
             <constraints>
30 30
                 <constraint firstItem="kId-c2-rCX" firstAttribute="centerY" secondItem="iN0-l3-epB" secondAttribute="bottom" multiplier="1/3" constant="1" id="5cJ-9S-tgC"/>
31 31
                 <constraint firstAttribute="centerX" secondItem="kId-c2-rCX" secondAttribute="centerX" id="Koa-jz-hwk"/>

+ 0
- 0
example/ios/example/Images.xcassets/AppIcon.appiconset/Contents.json View File


+ 6
- 0
example/ios/example/Images.xcassets/Contents.json View File

@@ -0,0 +1,6 @@
1
+{
2
+  "info" : {
3
+    "version" : 1,
4
+    "author" : "xcode"
5
+  }
6
+}

+ 16
- 15
example/ios/example/Info.plist View File

@@ -4,6 +4,8 @@
4 4
 <dict>
5 5
 	<key>CFBundleDevelopmentRegion</key>
6 6
 	<string>en</string>
7
+	<key>CFBundleDisplayName</key>
8
+	<string>example</string>
7 9
 	<key>CFBundleExecutable</key>
8 10
 	<string>$(EXECUTABLE_NAME)</string>
9 11
 	<key>CFBundleIdentifier</key>
@@ -22,21 +24,6 @@
22 24
 	<string>1</string>
23 25
 	<key>LSRequiresIPhoneOS</key>
24 26
 	<true/>
25
-	<key>NSAppTransportSecurity</key>
26
-	<dict>
27
-		<key>NSAllowsArbitraryLoads</key>
28
-		<true/>
29
-		<key>NSExceptionDomains</key>
30
-		<dict>
31
-			<key>localhost</key>
32
-			<dict>
33
-				<key>NSTemporaryExceptionAllowsInsecureHTTPLoads</key>
34
-				<true/>
35
-			</dict>
36
-		</dict>
37
-	</dict>
38
-	<key>NSLocationWhenInUseUsageDescription</key>
39
-	<string></string>
40 27
 	<key>UILaunchStoryboardName</key>
41 28
 	<string>LaunchScreen</string>
42 29
 	<key>UIRequiredDeviceCapabilities</key>
@@ -51,5 +38,19 @@
51 38
 	</array>
52 39
 	<key>UIViewControllerBasedStatusBarAppearance</key>
53 40
 	<false/>
41
+	<key>NSLocationWhenInUseUsageDescription</key>
42
+	<string></string>
43
+	<key>NSAppTransportSecurity</key>
44
+	<!--See http://ste.vn/2015/06/10/configuring-app-transport-security-ios-9-osx-10-11/ -->
45
+	<dict>
46
+		<key>NSExceptionDomains</key>
47
+		<dict>
48
+			<key>localhost</key>
49
+			<dict>
50
+				<key>NSExceptionAllowsInsecureHTTPLoads</key>
51
+				<true/>
52
+			</dict>
53
+		</dict>
54
+	</dict>
54 55
 </dict>
55 56
 </plist>

+ 0
- 0
example/ios/example/main.m View File


+ 24
- 0
example/ios/exampleTests/Info.plist View File

@@ -0,0 +1,24 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3
+<plist version="1.0">
4
+<dict>
5
+	<key>CFBundleDevelopmentRegion</key>
6
+	<string>en</string>
7
+	<key>CFBundleExecutable</key>
8
+	<string>$(EXECUTABLE_NAME)</string>
9
+	<key>CFBundleIdentifier</key>
10
+	<string>org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier)</string>
11
+	<key>CFBundleInfoDictionaryVersion</key>
12
+	<string>6.0</string>
13
+	<key>CFBundleName</key>
14
+	<string>$(PRODUCT_NAME)</string>
15
+	<key>CFBundlePackageType</key>
16
+	<string>BNDL</string>
17
+	<key>CFBundleShortVersionString</key>
18
+	<string>1.0</string>
19
+	<key>CFBundleSignature</key>
20
+	<string>????</string>
21
+	<key>CFBundleVersion</key>
22
+	<string>1</string>
23
+</dict>
24
+</plist>

+ 70
- 0
example/ios/exampleTests/exampleTests.m View File

@@ -0,0 +1,70 @@
1
+/**
2
+ * Copyright (c) 2015-present, Facebook, Inc.
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. An additional grant
7
+ * of patent rights can be found in the PATENTS file in the same directory.
8
+ */
9
+
10
+#import <UIKit/UIKit.h>
11
+#import <XCTest/XCTest.h>
12
+
13
+#import <React/RCTLog.h>
14
+#import <React/RCTRootView.h>
15
+
16
+#define TIMEOUT_SECONDS 600
17
+#define TEXT_TO_LOOK_FOR @"Welcome to React Native!"
18
+
19
+@interface exampleTests : XCTestCase
20
+
21
+@end
22
+
23
+@implementation exampleTests
24
+
25
+- (BOOL)findSubviewInView:(UIView *)view matching:(BOOL(^)(UIView *view))test
26
+{
27
+  if (test(view)) {
28
+    return YES;
29
+  }
30
+  for (UIView *subview in [view subviews]) {
31
+    if ([self findSubviewInView:subview matching:test]) {
32
+      return YES;
33
+    }
34
+  }
35
+  return NO;
36
+}
37
+
38
+- (void)testRendersWelcomeScreen
39
+{
40
+  UIViewController *vc = [[[RCTSharedApplication() delegate] window] rootViewController];
41
+  NSDate *date = [NSDate dateWithTimeIntervalSinceNow:TIMEOUT_SECONDS];
42
+  BOOL foundElement = NO;
43
+
44
+  __block NSString *redboxError = nil;
45
+  RCTSetLogFunction(^(RCTLogLevel level, RCTLogSource source, NSString *fileName, NSNumber *lineNumber, NSString *message) {
46
+    if (level >= RCTLogLevelError) {
47
+      redboxError = message;
48
+    }
49
+  });
50
+
51
+  while ([date timeIntervalSinceNow] > 0 && !foundElement && !redboxError) {
52
+    [[NSRunLoop mainRunLoop] runMode:NSDefaultRunLoopMode beforeDate:[NSDate dateWithTimeIntervalSinceNow:0.1]];
53
+    [[NSRunLoop mainRunLoop] runMode:NSRunLoopCommonModes beforeDate:[NSDate dateWithTimeIntervalSinceNow:0.1]];
54
+
55
+    foundElement = [self findSubviewInView:vc.view matching:^BOOL(UIView *view) {
56
+      if ([view.accessibilityLabel isEqualToString:TEXT_TO_LOOK_FOR]) {
57
+        return YES;
58
+      }
59
+      return NO;
60
+    }];
61
+  }
62
+
63
+  RCTSetLogFunction(RCTDefaultLogFunction);
64
+
65
+  XCTAssertNil(redboxError, @"RedBox error: %@", redboxError);
66
+  XCTAssertTrue(foundElement, @"Couldn't find element with text '%@' in %d seconds", TEXT_TO_LOOK_FOR, TIMEOUT_SECONDS);
67
+}
68
+
69
+
70
+@end

+ 14
- 4
example/package.json View File

@@ -3,12 +3,22 @@
3 3
   "version": "0.0.1",
4 4
   "private": true,
5 5
   "scripts": {
6
-    "start": "react-native start"
6
+    "start": "node node_modules/react-native/local-cli/cli.js start",
7
+    "test": "jest"
7 8
   },
8 9
   "dependencies": {
9
-    "react": "*",
10
-    "react-native": "*",
10
+    "react": "16.0.0",
11
+    "react-native": "0.51.0",
11 12
     "react-native-zss-rich-text-editor": "file:../",
12
-    "react-native-keyboard-spacer": "^0.3.0"
13
+    "react-native-keyboard-spacer": "*"
14
+  },
15
+  "devDependencies": {
16
+    "babel-jest": "22.0.4",
17
+    "babel-preset-react-native": "4.0.0",
18
+    "jest": "22.0.5",
19
+    "react-test-renderer": "16.0.0"
20
+  },
21
+  "jest": {
22
+    "preset": "react-native"
13 23
   }
14 24
 }