Pārlūkot izejas kodu

Manually link the Android WebView into the example.

Tom Underhill 5 gadus atpakaļ
vecāks
revīzija
908142e0af

+ 6
- 3
example/android/app/build.gradle Parādīt failu

@@ -9,7 +9,7 @@ import com.android.build.OutputFile
9 9
  * cycle. By default, bundleDebugJsAndAssets is skipped, as in debug/dev mode we prefer to load the
10 10
  * bundle directly from the development server. Below you can see all the possible configurations
11 11
  * and their defaults. If you decide to add a configuration block, make sure to add it before the
12
- * `apply from: "../../../node_modules/react-native/react.gradle"` line.
12
+ * `apply from: "../../node_modules/react-native/react.gradle"` line.
13 13
  *
14 14
  * project.ext.react = [
15 15
  *   // the name of the generated asset file containing your JS bundle
@@ -44,7 +44,7 @@ import com.android.build.OutputFile
44 44
  *   //         'devDisabledIn${buildType}'
45 45
  *
46 46
  *   // the root of your project, i.e. where "package.json" lives
47
- *   root: "../../../",
47
+ *   root: "../../",
48 48
  *
49 49
  *   // where to put the JS bundle asset in debug mode
50 50
  *   jsBundleDirDebug: "$buildDir/intermediates/assets/debug",
@@ -76,7 +76,9 @@ 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
 
@@ -179,6 +181,7 @@ 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
 

+ 2
- 0
example/android/app/src/main/java/com/example/MainApplication.java Parādīt failu

@@ -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,6 +26,7 @@ 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
 

+ 2
- 0
example/android/settings.gradle Parādīt failu

@@ -1,3 +1,5 @@
1 1
 rootProject.name = 'example'
2 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')