Browse Source

chore(example): Added three test examples: Alerts, Scrolling, and Background.

Tom Underhill 4 years ago
parent
commit
bf1d645716

+ 1
- 0
babel.config.js View File

@@ -6,5 +6,6 @@ module.exports = function(api) {
6 6
         presets: ['module:metro-react-native-babel-preset'],
7 7
       },
8 8
     },
9
+    presets: ['module:metro-react-native-babel-preset'],
9 10
   };
10 11
 };

+ 155
- 13
example/App.tsx View File

@@ -1,17 +1,159 @@
1
-import React from 'react';
2
-import {SafeAreaView, StyleSheet} from 'react-native';
3
-import {WebView} from 'react-native-webview';
1
+import React, {Component} from 'react';
2
+import {
3
+  StyleSheet,
4
+  SafeAreaView,
5
+  Text,
6
+  TouchableOpacity,
7
+  View,
8
+  Keyboard,
9
+  Button,
10
+} from 'react-native';
4 11
 
5
-const styles = StyleSheet.create({
6
-  container: {flex: 1, backgroundColor: '#20232a'},
7
-});
12
+import Alerts from './examples/Alerts';
13
+import Scrolling from './examples/Scrolling';
14
+import Background from './examples/Background';
8 15
 
9
-const App = () => {
10
-  return (
11
-    <SafeAreaView style={styles.container}>
12
-      <WebView source={{uri: 'https://facebook.github.io/react-native/'}} />
13
-    </SafeAreaView>
14
-  );
16
+const TESTS = {
17
+  Alerts: {
18
+    title: 'Alerts',
19
+    testId: 'alerts',
20
+    description: 'Alerts tests',
21
+    render() {
22
+      return <Alerts />;
23
+    },
24
+  },
25
+  Scrolling: {
26
+    title: 'Scrolling',
27
+    testId: 'scrolling',
28
+    description: 'Scrolling event test',
29
+    render() {
30
+      return <Scrolling />;
31
+    },
32
+  },
33
+  Background: {
34
+    title: 'Background',
35
+    testId: 'background',
36
+    description: 'Background color test',
37
+    render() {
38
+      return <Background />;
39
+    },
40
+  },
15 41
 };
16 42
 
17
-export default App;
43
+type Props = {};
44
+type State = {restarting: boolean, currentTest: Object};
45
+
46
+export default class App extends Component<Props, State> {
47
+  state = {
48
+    restarting: false,
49
+    currentTest: TESTS.Alerts,
50
+  };
51
+
52
+  _simulateRestart = () => {
53
+    this.setState({restarting: true}, () => this.setState({restarting: false}));
54
+  };
55
+
56
+  _changeTest = testName => {
57
+    this.setState({currentTest: TESTS[testName]});
58
+  };
59
+
60
+  render() {
61
+    const {restarting, currentTest} = this.state;
62
+    return (
63
+      <SafeAreaView style={styles.container}>
64
+        <TouchableOpacity
65
+          style={styles.closeKeyboardView}
66
+          onPress={() => Keyboard.dismiss()}
67
+          testID="closeKeyboard"
68
+        />
69
+
70
+        <TouchableOpacity
71
+          testID="restart_button"
72
+          onPress={this._simulateRestart}
73
+          style={styles.restartButton}
74
+          activeOpacity={0.6}>
75
+          <Text>Simulate Restart</Text>
76
+        </TouchableOpacity>
77
+
78
+        <View style={styles.testPickerContainer}>
79
+          <Button
80
+            testID="testType_alerts"
81
+            title="Alerts"
82
+            onPress={() => this._changeTest('Alerts')}
83
+          />
84
+          <Button
85
+            testID="testType_scrolling"
86
+            title="Scrolling"
87
+            onPress={() => this._changeTest('Scrolling')}
88
+          />
89
+          <Button
90
+            testID="testType_background"
91
+            title="Background"
92
+            onPress={() => this._changeTest('Background')}
93
+          />
94
+        </View>
95
+
96
+        {restarting ? null : (
97
+          <View
98
+            testID={`example-${currentTest.testId}`}
99
+            key={currentTest.title}
100
+            style={styles.exampleContainer}>
101
+            <Text style={styles.exampleTitle}>{currentTest.title}</Text>
102
+            <Text style={styles.exampleDescription}>
103
+              {currentTest.description}
104
+            </Text>
105
+            <View style={styles.exampleInnerContainer}>
106
+              {currentTest.render()}
107
+            </View>
108
+          </View>
109
+        )}
110
+      </SafeAreaView>
111
+    );
112
+  }
113
+}
114
+
115
+const styles = StyleSheet.create({
116
+  container: {
117
+    flex: 1,
118
+    backgroundColor: '#F5FCFF',
119
+    padding: 8,
120
+  },
121
+  exampleContainer: {
122
+    padding: 16,
123
+    backgroundColor: '#FFF',
124
+    borderColor: '#EEE',
125
+    borderTopWidth: 1,
126
+    borderBottomWidth: 1,
127
+    flex: 1,
128
+  },
129
+  exampleTitle: {
130
+    fontSize: 18,
131
+  },
132
+  exampleDescription: {
133
+    color: '#333333',
134
+    marginBottom: 16,
135
+  },
136
+  exampleInnerContainer: {
137
+    borderColor: '#EEE',
138
+    borderTopWidth: 1,
139
+    paddingTop: 10,
140
+    flex: 1,
141
+  },
142
+  restartButton: {
143
+    padding: 6,
144
+    fontSize: 16,
145
+    borderRadius: 5,
146
+    backgroundColor: '#F3F3F3',
147
+    alignItems: 'center',
148
+    justifyContent: 'center',
149
+    alignSelf: 'flex-end',
150
+  },
151
+  closeKeyboardView: {
152
+    width: 5,
153
+    height: 5,
154
+  },
155
+  testPickerContainer: {
156
+    flexDirection: 'row',
157
+    flexWrap: 'wrap',
158
+  },
159
+});

+ 7
- 4
example/android/app/build.gradle View File

@@ -76,11 +76,13 @@ import com.android.build.OutputFile
76 76
  */
77 77
 
78 78
 project.ext.react = [
79
-    entryFile: "index.js",
79
+    cliPath: "../../../node_modules/react-native/local-cli/cli.js",
80
+    entryFile: "./example/index.js",
81
+    root: "../../../",
80 82
     enableHermes: false,  // clean and rebuild if changing
81 83
 ]
82 84
 
83
-apply from: "../../node_modules/react-native/react.gradle"
85
+apply from: "../../../node_modules/react-native/react.gradle"
84 86
 
85 87
 /**
86 88
  * Set this to true to create two separate APKs instead of one:
@@ -179,11 +181,12 @@ android {
179 181
 }
180 182
 
181 183
 dependencies {
184
+    implementation project(':rnWebView')
182 185
     implementation fileTree(dir: "libs", include: ["*.jar"])
183 186
     implementation "com.facebook.react:react-native:+"  // From node_modules
184 187
 
185 188
     if (enableHermes) {
186
-        def hermesPath = "../../node_modules/hermes-engine/android/";
189
+        def hermesPath = "../../../node_modules/hermes-engine/android/";
187 190
         debugImplementation files(hermesPath + "hermes-debug.aar")
188 191
         releaseImplementation files(hermesPath + "hermes-release.aar")
189 192
     } else {
@@ -198,4 +201,4 @@ task copyDownloadableDepsToLibs(type: Copy) {
198 201
     into 'libs'
199 202
 }
200 203
 
201
-apply from: file("../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesAppBuildGradle(project)
204
+apply from: file("../../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesAppBuildGradle(project)

+ 3
- 1
example/android/app/src/main/java/com/example/MainApplication.java View File

@@ -7,6 +7,7 @@ import com.facebook.react.ReactApplication;
7 7
 import com.facebook.react.ReactNativeHost;
8 8
 import com.facebook.react.ReactPackage;
9 9
 import com.facebook.soloader.SoLoader;
10
+import com.reactnativecommunity.webview.RNCWebViewPackage;
10 11
 import java.lang.reflect.InvocationTargetException;
11 12
 import java.util.List;
12 13
 
@@ -25,12 +26,13 @@ public class MainApplication extends Application implements ReactApplication {
25 26
           List<ReactPackage> packages = new PackageList(this).getPackages();
26 27
           // Packages that cannot be autolinked yet can be added manually here, for example:
27 28
           // packages.add(new MyReactNativePackage());
29
+          packages.add(new RNCWebViewPackage());
28 30
           return packages;
29 31
         }
30 32
 
31 33
         @Override
32 34
         protected String getJSMainModuleName() {
33
-          return "index";
35
+          return "example/index";
34 36
         }
35 37
       };
36 38
 

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

@@ -24,11 +24,11 @@ allprojects {
24 24
         mavenLocal()
25 25
         maven {
26 26
             // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
27
-            url("$rootDir/../node_modules/react-native/android")
27
+            url("$rootDir/../../node_modules/react-native/android")
28 28
         }
29 29
         maven {
30 30
             // Android JSC is installed from npm
31
-            url("$rootDir/../node_modules/jsc-android/dist")
31
+            url("$rootDir/../../node_modules/jsc-android/dist")
32 32
         }
33 33
 
34 34
         google()

+ 3
- 1
example/android/settings.gradle View File

@@ -1,3 +1,5 @@
1 1
 rootProject.name = 'example'
2
-apply from: file("../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesSettingsGradle(settings)
2
+apply from: file("../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesSettingsGradle(settings)
3 3
 include ':app'
4
+include ':rnWebView'
5
+project(':rnWebView').projectDir = new File(rootProject.projectDir, '../../android')

+ 72
- 0
example/examples/Alerts.tsx View File

@@ -0,0 +1,72 @@
1
+import React, {Component} from 'react';
2
+import {Text, View} from 'react-native';
3
+
4
+import WebView from 'react-native-webview';
5
+
6
+const HTML = `
7
+<!DOCTYPE html>\n
8
+<html>
9
+  <head>
10
+    <title>Alerts</title>
11
+    <meta http-equiv="content-type" content="text/html; charset=utf-8">
12
+    <meta name="viewport" content="width=320, user-scalable=no">
13
+    <style type="text/css">
14
+      body {
15
+        margin: 0;
16
+        padding: 0;
17
+        font: 62.5% arial, sans-serif;
18
+        background: #ccc;
19
+      }
20
+    </style>
21
+  </head>
22
+  <body>
23
+    <button onclick="showAlert()">Show alert</button>
24
+    <button onclick="showConfirm()">Show confirm</button>
25
+    <button onclick="showPrompt()">Show prompt</button>
26
+    <p id="demo"></p>    
27
+    <script>
28
+      function showAlert() {
29
+        alert("Hello! I am an alert box!");
30
+        document.getElementById("demo").innerHTML = "Alert dismissed!";
31
+      }
32
+      function showConfirm() {
33
+        var response;
34
+        if (confirm("Press a button!")) {
35
+          response = "You pressed OK on confirm!";
36
+        } else {
37
+          response = "You pressed Cancel on confirm!";
38
+        }
39
+        document.getElementById("demo").innerHTML = response;
40
+      }
41
+      function showPrompt() {
42
+        var message;
43
+        const name = prompt("Please enter your name", "Name");
44
+        if (name !== null) {
45
+          message = "Hello " + name;
46
+        } else {
47
+          message = "You pressed Cancel on prompt!";
48
+        }
49
+        document.getElementById("demo").innerHTML = message;
50
+      }
51
+    </script>
52
+  </body>
53
+</html>
54
+`;
55
+
56
+type Props = {};
57
+type State = {};
58
+
59
+export default class Alerts extends Component<Props, State> {
60
+  state = {};
61
+
62
+  render() {
63
+    return (
64
+      <View style={{ height: 120 }}>
65
+        <WebView
66
+          source={{html: HTML}}
67
+          automaticallyAdjustContentInsets={false}
68
+        />
69
+      </View>
70
+    );
71
+  }
72
+}

+ 54
- 0
example/examples/Background.tsx View File

@@ -0,0 +1,54 @@
1
+import React, {Component} from 'react';
2
+import {Text, View} from 'react-native';
3
+
4
+import WebView from 'react-native-webview';
5
+
6
+const HTML = `
7
+<!DOCTYPE html>\n
8
+<html>
9
+  <head>
10
+    <title>Hello World</title>
11
+    <meta http-equiv="content-type" content="text/html; charset=utf-8">
12
+    <meta name="viewport" content="width=320, user-scalable=no">
13
+    <style type="text/css">
14
+      body {
15
+        margin: 0;
16
+        padding: 0;
17
+        font: 62.5% arial, sans-serif;
18
+        background: transparent;
19
+      }
20
+    </style>
21
+  </head>
22
+  <body>
23
+    <p>HTML content in transparent body.</p>
24
+  </body>
25
+</html>
26
+`;
27
+
28
+type Props = {};
29
+type State = {
30
+  backgroundColor: string,
31
+};
32
+
33
+export default class Background extends Component<Props, State> {
34
+  state = {
35
+    backgroundColor: '#FF00FF00'
36
+  };
37
+
38
+  render() {
39
+    return (
40
+      <View>
41
+        <View style={{backgroundColor:'red'}}>
42
+          <View style={{ height: 120 }}>
43
+            <WebView
44
+              source={{html: HTML}}
45
+              automaticallyAdjustContentInsets={false}
46
+              style={{backgroundColor:'#00000000'}}
47
+            />
48
+          </View>
49
+        </View>
50
+        <Text>WebView is transparent contained in a View with a red backgroundColor</Text>
51
+      </View>
52
+    );
53
+  }
54
+}

+ 68
- 0
example/examples/Scrolling.tsx View File

@@ -0,0 +1,68 @@
1
+import React, {Component} from 'react';
2
+import {Button, Text, View} from 'react-native';
3
+
4
+import WebView from 'react-native-webview';
5
+
6
+const HTML = `
7
+<!DOCTYPE html>\n
8
+<html>
9
+  <head>
10
+    <title>Hello World</title>
11
+    <meta http-equiv="content-type" content="text/html; charset=utf-8">
12
+    <meta name="viewport" content="width=320, user-scalable=no">
13
+    <style type="text/css">
14
+      body {
15
+        margin: 0;
16
+        padding: 0;
17
+        font: 62.5% arial, sans-serif;
18
+        background: #ccc;
19
+      }
20
+    </style>
21
+  </head>
22
+  <body>
23
+    <p>Lorem ipsum dolor sit amet, virtute utroque voluptaria et duo, probo aeque partiendo pri at. Mea ut stet aliquip deterruisset. Inani erroribus principes ei mel, no dicit recteque delicatissimi usu. Ne has dolore nominavi, feugait hendrerit interesset vis ea, amet regione ne pri. Te cum amet etiam.</p>
24
+    <p>Ut adipiscing neglegentur mediocritatem sea, suas abhorreant ius cu, ne nostrud feugiat per. Nam paulo facete iudicabit an, an brute mundi suavitate has, ex utamur numquam duo. Sea platonem argumentum instructior in, quo no prima inani perfecto. Ex illum postea copiosae has, ei mea sonet ocurreret.</p>
25
+    <p>Has convenire erroribus cu, quo homero facilisis inciderint ea. Vix choro gloriatur definitionem an, te exerci debitis voluptaria pri, mea admodum antiopam neglegentur te. His ea iisque splendide, nam id malorum pertinacia. Iusto tempor in eos, vis debet erant an. An nostrum rationibus sit, et sed dicta delenit suscipiantur. Est dolore vituperatoribus in, ubique explicari est cu. Legere tractatos ut usu, probo atqui vituperata in usu, mazim nemore praesent pro no.</p>
26
+    <p>Ei pri facilisi accusamus. Ut partem quaestio sit, an usu audiam quaerendum, ei qui hinc soleat. Fabulas phaedrum erroribus ut est. Intellegebat delicatissimi vis cu. His ea vidit libris facilis. Usu ne scripta legimus intellegam. Hendrerit urbanitas accommodare mei in.</p>
27
+    <p>Brute appetere efficiendi has ne. Ei ornatus labores vis. Vel harum fierent no, ad erat partiendo vis, harum democritum duo at. Has no labitur vulputate. Has cu autem aperiam hendrerit, sed eu justo verear menandri.</p>
28
+  </body>
29
+</html>
30
+`;
31
+
32
+type Props = {};
33
+type State = {
34
+  scrollEnabled: boolean,
35
+  lastScrollEvent: string
36
+};
37
+
38
+export default class Scrolling extends Component<Props, State> {
39
+  state = {
40
+    scrollEnabled: true,
41
+    lastScrollEvent: ''
42
+  };
43
+
44
+  render() {
45
+    return (
46
+      <View>
47
+        <View style={{ height: 120 }}>
48
+          <WebView
49
+            source={{html: HTML}}
50
+            automaticallyAdjustContentInsets={false}
51
+            onScroll={this._onScroll}
52
+            scrollEnabled={this.state.scrollEnabled}
53
+          />
54
+        </View>
55
+        <Button
56
+          title={this.state.scrollEnabled ? 'Scroll enabled' : 'Scroll disabled'}
57
+          onPress={() => this.setState({scrollEnabled: !this.state.scrollEnabled})}
58
+        />
59
+        <Text>Last scroll event:</Text>
60
+        <Text>{this.state.lastScrollEvent}</Text>
61
+      </View>
62
+    );
63
+  }
64
+
65
+  _onScroll = event => {
66
+    this.setState({lastScrollEvent: JSON.stringify(event.nativeEvent)});
67
+  }
68
+}

+ 34
- 31
example/ios/Podfile View File

@@ -1,38 +1,41 @@
1 1
 platform :ios, '9.0'
2
-require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'
2
+require_relative '../../node_modules/@react-native-community/cli-platform-ios/native_modules'
3
+
4
+project './example.xcodeproj'
3 5
 
4 6
 target 'example' do
5 7
   # Pods for example
6
-  pod 'FBLazyVector', :path => "../node_modules/react-native/Libraries/FBLazyVector"
7
-  pod 'FBReactNativeSpec', :path => "../node_modules/react-native/Libraries/FBReactNativeSpec"
8
-  pod 'RCTRequired', :path => "../node_modules/react-native/Libraries/RCTRequired"
9
-  pod 'RCTTypeSafety', :path => "../node_modules/react-native/Libraries/TypeSafety"
10
-  pod 'React', :path => '../node_modules/react-native/'
11
-  pod 'React-Core', :path => '../node_modules/react-native/'
12
-  pod 'React-CoreModules', :path => '../node_modules/react-native/React/CoreModules'
13
-  pod 'React-Core/DevSupport', :path => '../node_modules/react-native/'
14
-  pod 'React-RCTActionSheet', :path => '../node_modules/react-native/Libraries/ActionSheetIOS'
15
-  pod 'React-RCTAnimation', :path => '../node_modules/react-native/Libraries/NativeAnimation'
16
-  pod 'React-RCTBlob', :path => '../node_modules/react-native/Libraries/Blob'
17
-  pod 'React-RCTImage', :path => '../node_modules/react-native/Libraries/Image'
18
-  pod 'React-RCTLinking', :path => '../node_modules/react-native/Libraries/LinkingIOS'
19
-  pod 'React-RCTNetwork', :path => '../node_modules/react-native/Libraries/Network'
20
-  pod 'React-RCTSettings', :path => '../node_modules/react-native/Libraries/Settings'
21
-  pod 'React-RCTText', :path => '../node_modules/react-native/Libraries/Text'
22
-  pod 'React-RCTVibration', :path => '../node_modules/react-native/Libraries/Vibration'
23
-  pod 'React-Core/RCTWebSocket', :path => '../node_modules/react-native/'
24
-
25
-  pod 'React-cxxreact', :path => '../node_modules/react-native/ReactCommon/cxxreact'
26
-  pod 'React-jsi', :path => '../node_modules/react-native/ReactCommon/jsi'
27
-  pod 'React-jsiexecutor', :path => '../node_modules/react-native/ReactCommon/jsiexecutor'
28
-  pod 'React-jsinspector', :path => '../node_modules/react-native/ReactCommon/jsinspector'
29
-  pod 'ReactCommon/jscallinvoker', :path => "../node_modules/react-native/ReactCommon"
30
-  pod 'ReactCommon/turbomodule/core', :path => "../node_modules/react-native/ReactCommon"
31
-  pod 'Yoga', :path => '../node_modules/react-native/ReactCommon/yoga'
32
-
33
-  pod 'DoubleConversion', :podspec => '../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec'
34
-  pod 'glog', :podspec => '../node_modules/react-native/third-party-podspecs/glog.podspec'
35
-  pod 'Folly', :podspec => '../node_modules/react-native/third-party-podspecs/Folly.podspec'
8
+  pod 'react-native-webview', :path => "../.."
9
+  pod 'FBLazyVector', :path => "../../node_modules/react-native/Libraries/FBLazyVector"
10
+  pod 'FBReactNativeSpec', :path => "../../node_modules/react-native/Libraries/FBReactNativeSpec"
11
+  pod 'RCTRequired', :path => "../../node_modules/react-native/Libraries/RCTRequired"
12
+  pod 'RCTTypeSafety', :path => "../../node_modules/react-native/Libraries/TypeSafety"
13
+  pod 'React', :path => '../../node_modules/react-native/'
14
+  pod 'React-Core', :path => '../../node_modules/react-native/'
15
+  pod 'React-CoreModules', :path => '../../node_modules/react-native/React/CoreModules'
16
+  pod 'React-Core/DevSupport', :path => '../../node_modules/react-native/'
17
+  pod 'React-RCTActionSheet', :path => '../../node_modules/react-native/Libraries/ActionSheetIOS'
18
+  pod 'React-RCTAnimation', :path => '../../node_modules/react-native/Libraries/NativeAnimation'
19
+  pod 'React-RCTBlob', :path => '../../node_modules/react-native/Libraries/Blob'
20
+  pod 'React-RCTImage', :path => '../../node_modules/react-native/Libraries/Image'
21
+  pod 'React-RCTLinking', :path => '../../node_modules/react-native/Libraries/LinkingIOS'
22
+  pod 'React-RCTNetwork', :path => '../../node_modules/react-native/Libraries/Network'
23
+  pod 'React-RCTSettings', :path => '../../node_modules/react-native/Libraries/Settings'
24
+  pod 'React-RCTText', :path => '../../node_modules/react-native/Libraries/Text'
25
+  pod 'React-RCTVibration', :path => '../../node_modules/react-native/Libraries/Vibration'
26
+  pod 'React-Core/RCTWebSocket', :path => '../../node_modules/react-native/'
27
+
28
+  pod 'React-cxxreact', :path => '../../node_modules/react-native/ReactCommon/cxxreact'
29
+  pod 'React-jsi', :path => '../../node_modules/react-native/ReactCommon/jsi'
30
+  pod 'React-jsiexecutor', :path => '../../node_modules/react-native/ReactCommon/jsiexecutor'
31
+  pod 'React-jsinspector', :path => '../../node_modules/react-native/ReactCommon/jsinspector'
32
+  pod 'ReactCommon/jscallinvoker', :path => "../../node_modules/react-native/ReactCommon"
33
+  pod 'ReactCommon/turbomodule/core', :path => "../../node_modules/react-native/ReactCommon"
34
+  pod 'Yoga', :path => '../../node_modules/react-native/ReactCommon/yoga'
35
+
36
+  pod 'DoubleConversion', :podspec => '../../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec'
37
+  pod 'glog', :podspec => '../../node_modules/react-native/third-party-podspecs/glog.podspec'
38
+  pod 'Folly', :podspec => '../../node_modules/react-native/third-party-podspecs/Folly.podspec'
36 39
 
37 40
   target 'exampleTests' do
38 41
     inherit! :search_paths

+ 59
- 59
example/ios/Podfile.lock View File

@@ -182,7 +182,7 @@ PODS:
182 182
     - React-cxxreact (= 0.61.5)
183 183
     - React-jsi (= 0.61.5)
184 184
   - React-jsinspector (0.61.5)
185
-  - react-native-webview (8.0.2):
185
+  - react-native-webview (8.0.4):
186 186
     - React
187 187
   - React-RCTActionSheet (0.61.5):
188 188
     - React-Core/RCTActionSheetHeaders (= 0.61.5)
@@ -222,35 +222,35 @@ PODS:
222 222
   - Yoga (1.14.0)
223 223
 
224 224
 DEPENDENCIES:
225
-  - DoubleConversion (from `../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec`)
226
-  - FBLazyVector (from `../node_modules/react-native/Libraries/FBLazyVector`)
227
-  - FBReactNativeSpec (from `../node_modules/react-native/Libraries/FBReactNativeSpec`)
228
-  - Folly (from `../node_modules/react-native/third-party-podspecs/Folly.podspec`)
229
-  - glog (from `../node_modules/react-native/third-party-podspecs/glog.podspec`)
230
-  - RCTRequired (from `../node_modules/react-native/Libraries/RCTRequired`)
231
-  - RCTTypeSafety (from `../node_modules/react-native/Libraries/TypeSafety`)
232
-  - React (from `../node_modules/react-native/`)
233
-  - React-Core (from `../node_modules/react-native/`)
234
-  - React-Core/DevSupport (from `../node_modules/react-native/`)
235
-  - React-Core/RCTWebSocket (from `../node_modules/react-native/`)
236
-  - React-CoreModules (from `../node_modules/react-native/React/CoreModules`)
237
-  - React-cxxreact (from `../node_modules/react-native/ReactCommon/cxxreact`)
238
-  - React-jsi (from `../node_modules/react-native/ReactCommon/jsi`)
239
-  - React-jsiexecutor (from `../node_modules/react-native/ReactCommon/jsiexecutor`)
240
-  - React-jsinspector (from `../node_modules/react-native/ReactCommon/jsinspector`)
241
-  - react-native-webview (from `../node_modules/react-native-webview`)
242
-  - React-RCTActionSheet (from `../node_modules/react-native/Libraries/ActionSheetIOS`)
243
-  - React-RCTAnimation (from `../node_modules/react-native/Libraries/NativeAnimation`)
244
-  - React-RCTBlob (from `../node_modules/react-native/Libraries/Blob`)
245
-  - React-RCTImage (from `../node_modules/react-native/Libraries/Image`)
246
-  - React-RCTLinking (from `../node_modules/react-native/Libraries/LinkingIOS`)
247
-  - React-RCTNetwork (from `../node_modules/react-native/Libraries/Network`)
248
-  - React-RCTSettings (from `../node_modules/react-native/Libraries/Settings`)
249
-  - React-RCTText (from `../node_modules/react-native/Libraries/Text`)
250
-  - React-RCTVibration (from `../node_modules/react-native/Libraries/Vibration`)
251
-  - ReactCommon/jscallinvoker (from `../node_modules/react-native/ReactCommon`)
252
-  - ReactCommon/turbomodule/core (from `../node_modules/react-native/ReactCommon`)
253
-  - Yoga (from `../node_modules/react-native/ReactCommon/yoga`)
225
+  - DoubleConversion (from `../../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec`)
226
+  - FBLazyVector (from `../../node_modules/react-native/Libraries/FBLazyVector`)
227
+  - FBReactNativeSpec (from `../../node_modules/react-native/Libraries/FBReactNativeSpec`)
228
+  - Folly (from `../../node_modules/react-native/third-party-podspecs/Folly.podspec`)
229
+  - glog (from `../../node_modules/react-native/third-party-podspecs/glog.podspec`)
230
+  - RCTRequired (from `../../node_modules/react-native/Libraries/RCTRequired`)
231
+  - RCTTypeSafety (from `../../node_modules/react-native/Libraries/TypeSafety`)
232
+  - React (from `../../node_modules/react-native/`)
233
+  - React-Core (from `../../node_modules/react-native/`)
234
+  - React-Core/DevSupport (from `../../node_modules/react-native/`)
235
+  - React-Core/RCTWebSocket (from `../../node_modules/react-native/`)
236
+  - React-CoreModules (from `../../node_modules/react-native/React/CoreModules`)
237
+  - React-cxxreact (from `../../node_modules/react-native/ReactCommon/cxxreact`)
238
+  - React-jsi (from `../../node_modules/react-native/ReactCommon/jsi`)
239
+  - React-jsiexecutor (from `../../node_modules/react-native/ReactCommon/jsiexecutor`)
240
+  - React-jsinspector (from `../../node_modules/react-native/ReactCommon/jsinspector`)
241
+  - react-native-webview (from `../..`)
242
+  - React-RCTActionSheet (from `../../node_modules/react-native/Libraries/ActionSheetIOS`)
243
+  - React-RCTAnimation (from `../../node_modules/react-native/Libraries/NativeAnimation`)
244
+  - React-RCTBlob (from `../../node_modules/react-native/Libraries/Blob`)
245
+  - React-RCTImage (from `../../node_modules/react-native/Libraries/Image`)
246
+  - React-RCTLinking (from `../../node_modules/react-native/Libraries/LinkingIOS`)
247
+  - React-RCTNetwork (from `../../node_modules/react-native/Libraries/Network`)
248
+  - React-RCTSettings (from `../../node_modules/react-native/Libraries/Settings`)
249
+  - React-RCTText (from `../../node_modules/react-native/Libraries/Text`)
250
+  - React-RCTVibration (from `../../node_modules/react-native/Libraries/Vibration`)
251
+  - ReactCommon/jscallinvoker (from `../../node_modules/react-native/ReactCommon`)
252
+  - ReactCommon/turbomodule/core (from `../../node_modules/react-native/ReactCommon`)
253
+  - Yoga (from `../../node_modules/react-native/ReactCommon/yoga`)
254 254
 
255 255
 SPEC REPOS:
256 256
   trunk:
@@ -258,57 +258,57 @@ SPEC REPOS:
258 258
 
259 259
 EXTERNAL SOURCES:
260 260
   DoubleConversion:
261
-    :podspec: "../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec"
261
+    :podspec: "../../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec"
262 262
   FBLazyVector:
263
-    :path: "../node_modules/react-native/Libraries/FBLazyVector"
263
+    :path: "../../node_modules/react-native/Libraries/FBLazyVector"
264 264
   FBReactNativeSpec:
265
-    :path: "../node_modules/react-native/Libraries/FBReactNativeSpec"
265
+    :path: "../../node_modules/react-native/Libraries/FBReactNativeSpec"
266 266
   Folly:
267
-    :podspec: "../node_modules/react-native/third-party-podspecs/Folly.podspec"
267
+    :podspec: "../../node_modules/react-native/third-party-podspecs/Folly.podspec"
268 268
   glog:
269
-    :podspec: "../node_modules/react-native/third-party-podspecs/glog.podspec"
269
+    :podspec: "../../node_modules/react-native/third-party-podspecs/glog.podspec"
270 270
   RCTRequired:
271
-    :path: "../node_modules/react-native/Libraries/RCTRequired"
271
+    :path: "../../node_modules/react-native/Libraries/RCTRequired"
272 272
   RCTTypeSafety:
273
-    :path: "../node_modules/react-native/Libraries/TypeSafety"
273
+    :path: "../../node_modules/react-native/Libraries/TypeSafety"
274 274
   React:
275
-    :path: "../node_modules/react-native/"
275
+    :path: "../../node_modules/react-native/"
276 276
   React-Core:
277
-    :path: "../node_modules/react-native/"
277
+    :path: "../../node_modules/react-native/"
278 278
   React-CoreModules:
279
-    :path: "../node_modules/react-native/React/CoreModules"
279
+    :path: "../../node_modules/react-native/React/CoreModules"
280 280
   React-cxxreact:
281
-    :path: "../node_modules/react-native/ReactCommon/cxxreact"
281
+    :path: "../../node_modules/react-native/ReactCommon/cxxreact"
282 282
   React-jsi:
283
-    :path: "../node_modules/react-native/ReactCommon/jsi"
283
+    :path: "../../node_modules/react-native/ReactCommon/jsi"
284 284
   React-jsiexecutor:
285
-    :path: "../node_modules/react-native/ReactCommon/jsiexecutor"
285
+    :path: "../../node_modules/react-native/ReactCommon/jsiexecutor"
286 286
   React-jsinspector:
287
-    :path: "../node_modules/react-native/ReactCommon/jsinspector"
287
+    :path: "../../node_modules/react-native/ReactCommon/jsinspector"
288 288
   react-native-webview:
289
-    :path: "../node_modules/react-native-webview"
289
+    :path: "../.."
290 290
   React-RCTActionSheet:
291
-    :path: "../node_modules/react-native/Libraries/ActionSheetIOS"
291
+    :path: "../../node_modules/react-native/Libraries/ActionSheetIOS"
292 292
   React-RCTAnimation:
293
-    :path: "../node_modules/react-native/Libraries/NativeAnimation"
293
+    :path: "../../node_modules/react-native/Libraries/NativeAnimation"
294 294
   React-RCTBlob:
295
-    :path: "../node_modules/react-native/Libraries/Blob"
295
+    :path: "../../node_modules/react-native/Libraries/Blob"
296 296
   React-RCTImage:
297
-    :path: "../node_modules/react-native/Libraries/Image"
297
+    :path: "../../node_modules/react-native/Libraries/Image"
298 298
   React-RCTLinking:
299
-    :path: "../node_modules/react-native/Libraries/LinkingIOS"
299
+    :path: "../../node_modules/react-native/Libraries/LinkingIOS"
300 300
   React-RCTNetwork:
301
-    :path: "../node_modules/react-native/Libraries/Network"
301
+    :path: "../../node_modules/react-native/Libraries/Network"
302 302
   React-RCTSettings:
303
-    :path: "../node_modules/react-native/Libraries/Settings"
303
+    :path: "../../node_modules/react-native/Libraries/Settings"
304 304
   React-RCTText:
305
-    :path: "../node_modules/react-native/Libraries/Text"
305
+    :path: "../../node_modules/react-native/Libraries/Text"
306 306
   React-RCTVibration:
307
-    :path: "../node_modules/react-native/Libraries/Vibration"
307
+    :path: "../../node_modules/react-native/Libraries/Vibration"
308 308
   ReactCommon:
309
-    :path: "../node_modules/react-native/ReactCommon"
309
+    :path: "../../node_modules/react-native/ReactCommon"
310 310
   Yoga:
311
-    :path: "../node_modules/react-native/ReactCommon/yoga"
311
+    :path: "../../node_modules/react-native/ReactCommon/yoga"
312 312
 
313 313
 SPEC CHECKSUMS:
314 314
   boost-for-react-native: 39c7adb57c4e60d6c5479dd8623128eb5b3f0f2c
@@ -326,7 +326,7 @@ SPEC CHECKSUMS:
326 326
   React-jsi: cb2cd74d7ccf4cffb071a46833613edc79cdf8f7
327 327
   React-jsiexecutor: d5525f9ed5f782fdbacb64b9b01a43a9323d2386
328 328
   React-jsinspector: fa0ecc501688c3c4c34f28834a76302233e29dc0
329
-  react-native-webview: 99bdfd6c189772b0f15494f728430c23b18b93e4
329
+  react-native-webview: 3f5aa91c3cb083ea4762e006b9653291a96a777a
330 330
   React-RCTActionSheet: 600b4d10e3aea0913b5a92256d2719c0cdd26d76
331 331
   React-RCTAnimation: 791a87558389c80908ed06cc5dfc5e7920dfa360
332 332
   React-RCTBlob: d89293cc0236d9cb0933d85e430b0bbe81ad1d72
@@ -339,6 +339,6 @@ SPEC CHECKSUMS:
339 339
   ReactCommon: 198c7c8d3591f975e5431bec1b0b3b581aa1c5dd
340 340
   Yoga: f2a7cd4280bfe2cca5a7aed98ba0eb3d1310f18b
341 341
 
342
-PODFILE CHECKSUM: 79310af6b976c356911a8a833e9b99c3399fdda3
342
+PODFILE CHECKSUM: 2b0bdb79b803eefe541da6f9be6b06e99063bbfd
343 343
 
344
-COCOAPODS: 1.8.3
344
+COCOAPODS: 1.8.4

+ 4
- 4
example/ios/example.xcodeproj/project.pbxproj View File

@@ -371,7 +371,7 @@
371 371
 			);
372 372
 			runOnlyForDeploymentPostprocessing = 0;
373 373
 			shellPath = /bin/sh;
374
-			shellScript = "export NODE_BINARY=node\n../node_modules/react-native/scripts/react-native-xcode.sh";
374
+			shellScript = "export NODE_BINARY=node\n../../node_modules/react-native/scripts/react-native-xcode.sh\n";
375 375
 		};
376 376
 		2D02E4CB1E0B4B27006451C7 /* Bundle React Native Code And Images */ = {
377 377
 			isa = PBXShellScriptBuildPhase;
@@ -385,7 +385,7 @@
385 385
 			);
386 386
 			runOnlyForDeploymentPostprocessing = 0;
387 387
 			shellPath = /bin/sh;
388
-			shellScript = "export NODE_BINARY=node\n../node_modules/react-native/scripts/react-native-xcode.sh";
388
+			shellScript = "export NODE_BINARY=node\n../../node_modules/react-native/scripts/react-native-xcode.sh\n";
389 389
 		};
390 390
 		56202D3091BCA37A2C594528 /* [CP] Check Pods Manifest.lock */ = {
391 391
 			isa = PBXShellScriptBuildPhase;
@@ -491,7 +491,7 @@
491 491
 			);
492 492
 			runOnlyForDeploymentPostprocessing = 0;
493 493
 			shellPath = /bin/sh;
494
-			shellScript = "export RCT_METRO_PORT=\"${RCT_METRO_PORT:=8081}\"\necho \"export RCT_METRO_PORT=${RCT_METRO_PORT}\" > \"${SRCROOT}/../node_modules/react-native/scripts/.packager.env\"\nif [ -z \"${RCT_NO_LAUNCH_PACKAGER+xxx}\" ] ; then\n  if nc -w 5 -z localhost ${RCT_METRO_PORT} ; then\n    if ! curl -s \"http://localhost:${RCT_METRO_PORT}/status\" | grep -q \"packager-status:running\" ; then\n      echo \"Port ${RCT_METRO_PORT} already in use, packager is either not running or not running correctly\"\n      exit 2\n    fi\n  else\n    open \"$SRCROOT/../node_modules/react-native/scripts/launchPackager.command\" || echo \"Can't start packager automatically\"\n  fi\nfi\n";
494
+			shellScript = "export RCT_METRO_PORT=\"${RCT_METRO_PORT:=8081}\"\necho \"export RCT_METRO_PORT=${RCT_METRO_PORT}\" > \"${SRCROOT}/../../node_modules/react-native/scripts/.packager.env\"\nif [ -z \"${RCT_NO_LAUNCH_PACKAGER+xxx}\" ] ; then\n  if nc -w 5 -z localhost ${RCT_METRO_PORT} ; then\n    if ! curl -s \"http://localhost:${RCT_METRO_PORT}/status\" | grep -q \"packager-status:running\" ; then\n      echo \"Port ${RCT_METRO_PORT} already in use, packager is either not running or not running correctly\"\n      exit 2\n    fi\n  else\n    open \"$SRCROOT/../../node_modules/react-native/scripts/launchPackager.command\" || echo \"Can't start packager automatically\"\n  fi\nfi\n";
495 495
 			showEnvVarsInLog = 0;
496 496
 		};
497 497
 		FD10A7F122414F3F0027D42C /* Start Packager */ = {
@@ -510,7 +510,7 @@
510 510
 			);
511 511
 			runOnlyForDeploymentPostprocessing = 0;
512 512
 			shellPath = /bin/sh;
513
-			shellScript = "export RCT_METRO_PORT=\"${RCT_METRO_PORT:=8081}\"\necho \"export RCT_METRO_PORT=${RCT_METRO_PORT}\" > \"${SRCROOT}/../node_modules/react-native/scripts/.packager.env\"\nif [ -z \"${RCT_NO_LAUNCH_PACKAGER+xxx}\" ] ; then\n  if nc -w 5 -z localhost ${RCT_METRO_PORT} ; then\n    if ! curl -s \"http://localhost:${RCT_METRO_PORT}/status\" | grep -q \"packager-status:running\" ; then\n      echo \"Port ${RCT_METRO_PORT} already in use, packager is either not running or not running correctly\"\n      exit 2\n    fi\n  else\n    open \"$SRCROOT/../node_modules/react-native/scripts/launchPackager.command\" || echo \"Can't start packager automatically\"\n  fi\nfi\n";
513
+			shellScript = "export RCT_METRO_PORT=\"${RCT_METRO_PORT:=8081}\"\necho \"export RCT_METRO_PORT=${RCT_METRO_PORT}\" > \"${SRCROOT}/../../node_modules/react-native/scripts/.packager.env\"\nif [ -z \"${RCT_NO_LAUNCH_PACKAGER+xxx}\" ] ; then\n  if nc -w 5 -z localhost ${RCT_METRO_PORT} ; then\n    if ! curl -s \"http://localhost:${RCT_METRO_PORT}/status\" | grep -q \"packager-status:running\" ; then\n      echo \"Port ${RCT_METRO_PORT} already in use, packager is either not running or not running correctly\"\n      exit 2\n    fi\n  else\n    open \"$SRCROOT/../../node_modules/react-native/scripts/launchPackager.command\" || echo \"Can't start packager automatically\"\n  fi\nfi\n";
514 514
 			showEnvVarsInLog = 0;
515 515
 		};
516 516
 /* End PBXShellScriptBuildPhase section */

+ 1
- 1
example/ios/example/AppDelegate.m View File

@@ -33,7 +33,7 @@
33 33
 - (NSURL *)sourceURLForBridge:(RCTBridge *)bridge
34 34
 {
35 35
 #if DEBUG
36
-  return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index" fallbackResource:nil];
36
+  return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"example/index" fallbackResource:nil];
37 37
 #else
38 38
   return [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"];
39 39
 #endif

+ 0
- 39
example/package.json View File

@@ -1,39 +0,0 @@
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 . --ext .js,.jsx,.ts,.tsx"
11
-  },
12
-  "dependencies": {
13
-    "react": "16.9.0",
14
-    "react-native": "0.61.5",
15
-    "react-native-webview": "file:../"
16
-  },
17
-  "devDependencies": {
18
-    "@babel/core": "^7.6.2",
19
-    "@babel/runtime": "^7.6.2",
20
-    "@types/react-native": "^0.60.25",
21
-    "@types/react-test-renderer": "16.9.1",
22
-    "@typescript-eslint/eslint-plugin": "^2.12.0",
23
-    "@typescript-eslint/parser": "^2.12.0",
24
-    "babel-jest": "^24.9.0",
25
-    "metro-react-native-babel-preset": "^0.56.0",
26
-    "typescript": "^3.7.3"
27
-  },
28
-  "jest": {
29
-    "preset": "react-native",
30
-    "moduleFileExtensions": [
31
-      "ts",
32
-      "tsx",
33
-      "js",
34
-      "jsx",
35
-      "json",
36
-      "node"
37
-    ]
38
-  }
39
-}

+ 0
- 6591
example/yarn.lock
File diff suppressed because it is too large
View File


+ 12
- 7
package.json View File

@@ -11,6 +11,9 @@
11 11
   "version": "8.0.4",
12 12
   "homepage": "https://github.com/react-native-community/react-native-webview#readme",
13 13
   "scripts": {
14
+    "start": "node node_modules/react-native/local-cli/cli.js start",
15
+    "start:android": "react-native run-android --root example/",
16
+    "start:ios": "react-native run-ios --project-path example/ios --scheme example",
14 17
     "ci": "CI=true && yarn lint && yarn test",
15 18
     "ci:publish": "yarn semantic-release",
16 19
     "lint": "yarn tsc --noEmit && yarn eslint ./src --ext .ts,.tsx",
@@ -23,7 +26,7 @@
23 26
     "type": "Component"
24 27
   },
25 28
   "peerDependencies": {
26
-    "react": "^16.0",
29
+    "react": "^16.9",
27 30
     "react-native": ">=0.60 <0.62"
28 31
   },
29 32
   "dependencies": {
@@ -31,7 +34,8 @@
31 34
     "invariant": "2.2.4"
32 35
   },
33 36
   "devDependencies": {
34
-    "@babel/core": "7.5.5",
37
+    "@babel/core": "7.4.5",
38
+    "@babel/runtime": "7.4.5",
35 39
     "@semantic-release/git": "7.0.16",
36 40
     "@types/invariant": "^2.2.30",
37 41
     "@types/jest": "24.0.18",
@@ -40,7 +44,8 @@
40 44
     "@typescript-eslint/eslint-plugin": "2.1.0",
41 45
     "@typescript-eslint/parser": "2.1.0",
42 46
     "babel-eslint": "10.0.3",
43
-    "babel-jest": "^24.9.0",
47
+    "babel-jest": "24.8.0",
48
+    "babel-plugin-module-resolver": "3.1.3",
44 49
     "eslint": "6.3.0",
45 50
     "eslint-config-airbnb": "18.0.1",
46 51
     "eslint-config-prettier": "6.2.0",
@@ -49,9 +54,9 @@
49 54
     "eslint-plugin-react": "7.14.3",
50 55
     "eslint-plugin-react-native": "3.7.0",
51 56
     "jest": "24.9.0",
52
-    "metro-react-native-babel-preset": "0.53.1",
53
-    "react": "16.8.3",
54
-    "react-native": "0.60.5",
57
+    "metro-react-native-babel-preset": "0.54.1",
58
+    "react": "16.9.0",
59
+    "react-native": "0.61.5",
55 60
     "semantic-release": "15.13.24",
56 61
     "typescript": "3.6.2"
57 62
   },
@@ -67,4 +72,4 @@
67 72
     "index.d.ts",
68 73
     "react-native-webview.podspec"
69 74
   ]
70
-}
75
+}

+ 361
- 211
yarn.lock
File diff suppressed because it is too large
View File