瀏覽代碼

use yarn to install local package (remove demo folder manually) for demo; react-native link react-native-webview for demo

iou90 5 年之前
父節點
當前提交
ad644e162e

+ 1
- 0
demo/android/app/build.gradle 查看文件

@@ -134,6 +134,7 @@ android {
134 134
 }
135 135
 
136 136
 dependencies {
137
+    implementation project(':react-native-webview')
137 138
     implementation fileTree(dir: "libs", include: ["*.jar"])
138 139
     implementation "com.android.support:appcompat-v7:${rootProject.ext.supportLibVersion}"
139 140
     implementation "com.facebook.react:react-native:+"  // From node_modules

+ 3
- 1
demo/android/app/src/main/java/com/demo/MainApplication.java 查看文件

@@ -3,6 +3,7 @@ package com.demo;
3 3
 import android.app.Application;
4 4
 
5 5
 import com.facebook.react.ReactApplication;
6
+import com.reactnativecommunity.webview.RNCWebViewPackage;
6 7
 import com.facebook.react.ReactNativeHost;
7 8
 import com.facebook.react.ReactPackage;
8 9
 import com.facebook.react.shell.MainReactPackage;
@@ -22,7 +23,8 @@ public class MainApplication extends Application implements ReactApplication {
22 23
     @Override
23 24
     protected List<ReactPackage> getPackages() {
24 25
       return Arrays.<ReactPackage>asList(
25
-          new MainReactPackage()
26
+          new MainReactPackage(),
27
+            new RNCWebViewPackage()
26 28
       );
27 29
     }
28 30
 

+ 2
- 0
demo/android/settings.gradle 查看文件

@@ -1,3 +1,5 @@
1 1
 rootProject.name = 'demo'
2
+include ':react-native-webview'
3
+project(':react-native-webview').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-webview/android')
2 4
 
3 5
 include ':app'

+ 62
- 2
demo/ios/demo.xcodeproj/project.pbxproj 查看文件

@@ -5,7 +5,6 @@
5 5
 	};
6 6
 	objectVersion = 46;
7 7
 	objects = {
8
-
9 8
 /* Begin PBXBuildFile section */
10 9
 		00C302E51ABCBA2D00DB3ED1 /* libRCTActionSheet.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 00C302AC1ABCB8CE00DB3ED1 /* libRCTActionSheet.a */; };
11 10
 		00C302E71ABCBA2D00DB3ED1 /* libRCTGeolocation.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 00C302BA1ABCB90400DB3ED1 /* libRCTGeolocation.a */; };
@@ -40,6 +39,7 @@
40 39
 		ADBDB9381DFEBF1600ED6528 /* libRCTBlob.a in Frameworks */ = {isa = PBXBuildFile; fileRef = ADBDB9271DFEBF0700ED6528 /* libRCTBlob.a */; };
41 40
 		ED297163215061F000B7C4FE /* JavaScriptCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = ED297162215061F000B7C4FE /* JavaScriptCore.framework */; };
42 41
 		ED2971652150620600B7C4FE /* JavaScriptCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = ED2971642150620600B7C4FE /* JavaScriptCore.framework */; };
42
+		67358EEE45004F09A283C3E3 /* libRNCWebView.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 9F571B03CD384ED4A5C07A73 /* libRNCWebView.a */; };
43 43
 /* End PBXBuildFile section */
44 44
 
45 45
 /* Begin PBXContainerItemProxy section */
@@ -347,6 +347,8 @@
347 347
 		ADBDB91F1DFEBF0600ED6528 /* RCTBlob.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTBlob.xcodeproj; path = "../node_modules/react-native/Libraries/Blob/RCTBlob.xcodeproj"; sourceTree = "<group>"; };
348 348
 		ED297162215061F000B7C4FE /* JavaScriptCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = JavaScriptCore.framework; path = System/Library/Frameworks/JavaScriptCore.framework; sourceTree = SDKROOT; };
349 349
 		ED2971642150620600B7C4FE /* JavaScriptCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = JavaScriptCore.framework; path = Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS12.0.sdk/System/Library/Frameworks/JavaScriptCore.framework; sourceTree = DEVELOPER_DIR; };
350
+		97C8BA14ABDD4368BA605616 /* RNCWebView.xcodeproj */ = {isa = PBXFileReference; name = "RNCWebView.xcodeproj"; path = "../node_modules/react-native-webview/ios/RNCWebView.xcodeproj"; sourceTree = "<group>"; fileEncoding = undefined; lastKnownFileType = wrapper.pb-project; explicitFileType = undefined; includeInIndex = 0; };
351
+		9F571B03CD384ED4A5C07A73 /* libRNCWebView.a */ = {isa = PBXFileReference; name = "libRNCWebView.a"; path = "libRNCWebView.a"; sourceTree = "<group>"; fileEncoding = undefined; lastKnownFileType = archive.ar; explicitFileType = undefined; includeInIndex = 0; };
350 352
 /* End PBXFileReference section */
351 353
 
352 354
 /* Begin PBXFrameworksBuildPhase section */
@@ -375,6 +377,7 @@
375 377
 				832341BD1AAA6AB300B99B32 /* libRCTText.a in Frameworks */,
376 378
 				00C302EA1ABCBA2D00DB3ED1 /* libRCTVibration.a in Frameworks */,
377 379
 				139FDEF61B0652A700C62182 /* libRCTWebSocket.a in Frameworks */,
380
+				67358EEE45004F09A283C3E3 /* libRNCWebView.a in Frameworks */,
378 381
 			);
379 382
 			runOnlyForDeploymentPostprocessing = 0;
380 383
 		};
@@ -564,6 +567,7 @@
564 567
 				832341B01AAA6A8300B99B32 /* RCTText.xcodeproj */,
565 568
 				00C302DF1ABCB9EE00DB3ED1 /* RCTVibration.xcodeproj */,
566 569
 				139FDEE61B06529A00C62182 /* RCTWebSocket.xcodeproj */,
570
+				97C8BA14ABDD4368BA605616 /* RNCWebView.xcodeproj */,
567 571
 			);
568 572
 			name = Libraries;
569 573
 			sourceTree = "<group>";
@@ -692,7 +696,7 @@
692 696
 		83CBB9F71A601CBA00E9B192 /* Project object */ = {
693 697
 			isa = PBXProject;
694 698
 			attributes = {
695
-				LastUpgradeCheck = 0940;
699
+				LastUpgradeCheck = 940;
696 700
 				ORGANIZATIONNAME = Facebook;
697 701
 				TargetAttributes = {
698 702
 					00E356ED1AD99517003FC87E = {
@@ -1189,6 +1193,14 @@
1189 1193
 				PRODUCT_BUNDLE_IDENTIFIER = "org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier)";
1190 1194
 				PRODUCT_NAME = "$(TARGET_NAME)";
1191 1195
 				TEST_HOST = "$(BUILT_PRODUCTS_DIR)/demo.app/demo";
1196
+				LIBRARY_SEARCH_PATHS = (
1197
+					"$(inherited)",
1198
+					"\"$(SRCROOT)/$(TARGET_NAME)\"",
1199
+				);
1200
+				HEADER_SEARCH_PATHS = (
1201
+					"$(inherited)",
1202
+					"$(SRCROOT)/../node_modules/react-native-webview/ios",
1203
+				);
1192 1204
 			};
1193 1205
 			name = Debug;
1194 1206
 		};
@@ -1207,6 +1219,14 @@
1207 1219
 				PRODUCT_BUNDLE_IDENTIFIER = "org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier)";
1208 1220
 				PRODUCT_NAME = "$(TARGET_NAME)";
1209 1221
 				TEST_HOST = "$(BUILT_PRODUCTS_DIR)/demo.app/demo";
1222
+				LIBRARY_SEARCH_PATHS = (
1223
+					"$(inherited)",
1224
+					"\"$(SRCROOT)/$(TARGET_NAME)\"",
1225
+				);
1226
+				HEADER_SEARCH_PATHS = (
1227
+					"$(inherited)",
1228
+					"$(SRCROOT)/../node_modules/react-native-webview/ios",
1229
+				);
1210 1230
 			};
1211 1231
 			name = Release;
1212 1232
 		};
@@ -1226,6 +1246,10 @@
1226 1246
 				PRODUCT_BUNDLE_IDENTIFIER = "org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier)";
1227 1247
 				PRODUCT_NAME = demo;
1228 1248
 				VERSIONING_SYSTEM = "apple-generic";
1249
+				HEADER_SEARCH_PATHS = (
1250
+					"$(inherited)",
1251
+					"$(SRCROOT)/../node_modules/react-native-webview/ios",
1252
+				);
1229 1253
 			};
1230 1254
 			name = Debug;
1231 1255
 		};
@@ -1244,6 +1268,10 @@
1244 1268
 				PRODUCT_BUNDLE_IDENTIFIER = "org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier)";
1245 1269
 				PRODUCT_NAME = demo;
1246 1270
 				VERSIONING_SYSTEM = "apple-generic";
1271
+				HEADER_SEARCH_PATHS = (
1272
+					"$(inherited)",
1273
+					"$(SRCROOT)/../node_modules/react-native-webview/ios",
1274
+				);
1247 1275
 			};
1248 1276
 			name = Release;
1249 1277
 		};
@@ -1270,6 +1298,14 @@
1270 1298
 				SDKROOT = appletvos;
1271 1299
 				TARGETED_DEVICE_FAMILY = 3;
1272 1300
 				TVOS_DEPLOYMENT_TARGET = 9.2;
1301
+				LIBRARY_SEARCH_PATHS = (
1302
+					"$(inherited)",
1303
+					"\"$(SRCROOT)/$(TARGET_NAME)\"",
1304
+				);
1305
+				HEADER_SEARCH_PATHS = (
1306
+					"$(inherited)",
1307
+					"$(SRCROOT)/../node_modules/react-native-webview/ios",
1308
+				);
1273 1309
 			};
1274 1310
 			name = Debug;
1275 1311
 		};
@@ -1296,6 +1332,14 @@
1296 1332
 				SDKROOT = appletvos;
1297 1333
 				TARGETED_DEVICE_FAMILY = 3;
1298 1334
 				TVOS_DEPLOYMENT_TARGET = 9.2;
1335
+				LIBRARY_SEARCH_PATHS = (
1336
+					"$(inherited)",
1337
+					"\"$(SRCROOT)/$(TARGET_NAME)\"",
1338
+				);
1339
+				HEADER_SEARCH_PATHS = (
1340
+					"$(inherited)",
1341
+					"$(SRCROOT)/../node_modules/react-native-webview/ios",
1342
+				);
1299 1343
 			};
1300 1344
 			name = Release;
1301 1345
 		};
@@ -1321,6 +1365,14 @@
1321 1365
 				SDKROOT = appletvos;
1322 1366
 				TEST_HOST = "$(BUILT_PRODUCTS_DIR)/demo-tvOS.app/demo-tvOS";
1323 1367
 				TVOS_DEPLOYMENT_TARGET = 10.1;
1368
+				LIBRARY_SEARCH_PATHS = (
1369
+					"$(inherited)",
1370
+					"\"$(SRCROOT)/$(TARGET_NAME)\"",
1371
+				);
1372
+				HEADER_SEARCH_PATHS = (
1373
+					"$(inherited)",
1374
+					"$(SRCROOT)/../node_modules/react-native-webview/ios",
1375
+				);
1324 1376
 			};
1325 1377
 			name = Debug;
1326 1378
 		};
@@ -1346,6 +1398,14 @@
1346 1398
 				SDKROOT = appletvos;
1347 1399
 				TEST_HOST = "$(BUILT_PRODUCTS_DIR)/demo-tvOS.app/demo-tvOS";
1348 1400
 				TVOS_DEPLOYMENT_TARGET = 10.1;
1401
+				LIBRARY_SEARCH_PATHS = (
1402
+					"$(inherited)",
1403
+					"\"$(SRCROOT)/$(TARGET_NAME)\"",
1404
+				);
1405
+				HEADER_SEARCH_PATHS = (
1406
+					"$(inherited)",
1407
+					"$(SRCROOT)/../node_modules/react-native-webview/ios",
1408
+				);
1349 1409
 			};
1350 1410
 			name = Release;
1351 1411
 		};

+ 3
- 2
demo/package.json 查看文件

@@ -8,7 +8,8 @@
8 8
   },
9 9
   "dependencies": {
10 10
     "react": "16.6.3",
11
-    "react-native": "0.58.3"
11
+    "react-native": "0.58.3",
12
+    "react-native-autoheight-webview": "../"
12 13
   },
13 14
   "devDependencies": {
14 15
     "babel-core": "^7.0.0-bridge.0",
@@ -20,4 +21,4 @@
20 21
   "jest": {
21 22
     "preset": "react-native"
22 23
   }
23
-}
24
+}

+ 34
- 1
demo/yarn.lock 查看文件

@@ -2143,7 +2143,7 @@ fbjs-scripts@^1.0.0:
2143 2143
     semver "^5.1.0"
2144 2144
     through2 "^2.0.0"
2145 2145
 
2146
-fbjs@^0.8.9:
2146
+fbjs@^0.8.17, fbjs@^0.8.9:
2147 2147
   version "0.8.17"
2148 2148
   resolved "https://registry.yarnpkg.com/fbjs/-/fbjs-0.8.17.tgz#c4d598ead6949112653d6588b01a5cdcd9f90fdd"
2149 2149
   integrity sha1-xNWY6taUkRJlPWWIsBpc3Nn5D90=
@@ -2583,6 +2583,11 @@ image-size@^0.6.0:
2583 2583
   resolved "https://registry.yarnpkg.com/image-size/-/image-size-0.6.3.tgz#e7e5c65bb534bd7cdcedd6cb5166272a85f75fb2"
2584 2584
   integrity sha512-47xSUiQioGaB96nqtp5/q55m0aBQSQdyIloMOc/x+QVTDZLNmXE892IIDrJ0hM1A5vcNUDD5tDffkSP5lCaIIA==
2585 2585
 
2586
+immutable@^3.8.2:
2587
+  version "3.8.2"
2588
+  resolved "https://registry.yarnpkg.com/immutable/-/immutable-3.8.2.tgz#c2439951455bb39913daf281376f1530e104adf3"
2589
+  integrity sha1-wkOZUUVbs5kT2vKBN28VMOEErfM=
2590
+
2586 2591
 import-fresh@^2.0.0:
2587 2592
   version "2.0.0"
2588 2593
   resolved "https://registry.yarnpkg.com/import-fresh/-/import-fresh-2.0.0.tgz#d81355c15612d386c61f9ddd3922d4304822a546"
@@ -4958,6 +4963,14 @@ prop-types@^15.5.8, prop-types@^15.6.2:
4958 4963
     loose-envify "^1.3.1"
4959 4964
     object-assign "^4.1.1"
4960 4965
 
4966
+prop-types@^15.7.1:
4967
+  version "15.7.1"
4968
+  resolved "https://registry.yarnpkg.com/prop-types/-/prop-types-15.7.1.tgz#2fa61e0a699d428b40320127733ee2931f05d9d1"
4969
+  integrity sha512-f8Lku2z9kERjOCcnDOPm68EBJAO2K00Q5mSgPAUE/gJuBgsYLbVy6owSrtcHj90zt8PvW+z0qaIIgsIhHOa1Qw==
4970
+  dependencies:
4971
+    object-assign "^4.1.1"
4972
+    react-is "^16.8.1"
4973
+
4961 4974
 pseudomap@^1.0.2:
4962 4975
   version "1.0.2"
4963 4976
   resolved "https://registry.yarnpkg.com/pseudomap/-/pseudomap-1.0.2.tgz#f052a28da70e618917ef0a8ac34c1ae5a68286b3"
@@ -5038,6 +5051,26 @@ react-is@^16.6.3:
5038 5051
   resolved "https://registry.yarnpkg.com/react-is/-/react-is-16.7.0.tgz#c1bd21c64f1f1364c6f70695ec02d69392f41bfa"
5039 5052
   integrity sha512-Z0VRQdF4NPDoI0tsXVMLkJLiwEBa+RP66g0xDHxgxysxSoCUccSten4RTF/UFvZF1dZvZ9Zu1sx+MDXwcOR34g==
5040 5053
 
5054
+react-is@^16.8.1:
5055
+  version "16.8.1"
5056
+  resolved "https://registry.yarnpkg.com/react-is/-/react-is-16.8.1.tgz#a80141e246eb894824fb4f2901c0c50ef31d4cdb"
5057
+  integrity sha512-ioMCzVDWvCvKD8eeT+iukyWrBGrA3DiFYkXfBsVYIRdaREZuBjENG+KjrikavCLasozqRWTwFUagU/O4vPpRMA==
5058
+
5059
+react-native-autoheight-webview@../:
5060
+  version "0.11.0"
5061
+  dependencies:
5062
+    immutable "^3.8.2"
5063
+    prop-types "^15.7.1"
5064
+    react-native-webview "^5.0.7"
5065
+
5066
+react-native-webview@^5.0.7:
5067
+  version "5.0.7"
5068
+  resolved "https://registry.yarnpkg.com/react-native-webview/-/react-native-webview-5.0.7.tgz#1060f7c652d251ea3610eacfc4bd9e9997862f56"
5069
+  integrity sha512-jzYrpxPdHGXc9KW0J6Ec4zOXeDFy8BZQS+nUjCqs/cPSPkQO2H/4e6IXz9Y1DTC4l08H2RQLeWPo9nml69MXmA==
5070
+  dependencies:
5071
+    escape-string-regexp "^1.0.5"
5072
+    fbjs "^0.8.17"
5073
+
5041 5074
 react-native@0.58.3:
5042 5075
   version "0.58.3"
5043 5076
   resolved "https://registry.yarnpkg.com/react-native/-/react-native-0.58.3.tgz#90e2dbfef19f3793ba008ab5274daac926424916"