Browse Source

Manually link the Android WebView into the example.

Tom Underhill 5 years ago
parent
commit
908142e0af

+ 6
- 3
example/android/app/build.gradle View File

9
  * cycle. By default, bundleDebugJsAndAssets is skipped, as in debug/dev mode we prefer to load the
9
  * cycle. By default, bundleDebugJsAndAssets is skipped, as in debug/dev mode we prefer to load the
10
  * bundle directly from the development server. Below you can see all the possible configurations
10
  * bundle directly from the development server. Below you can see all the possible configurations
11
  * and their defaults. If you decide to add a configuration block, make sure to add it before the
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
  * project.ext.react = [
14
  * project.ext.react = [
15
  *   // the name of the generated asset file containing your JS bundle
15
  *   // the name of the generated asset file containing your JS bundle
44
  *   //         'devDisabledIn${buildType}'
44
  *   //         'devDisabledIn${buildType}'
45
  *
45
  *
46
  *   // the root of your project, i.e. where "package.json" lives
46
  *   // the root of your project, i.e. where "package.json" lives
47
- *   root: "../../../",
47
+ *   root: "../../",
48
  *
48
  *
49
  *   // where to put the JS bundle asset in debug mode
49
  *   // where to put the JS bundle asset in debug mode
50
  *   jsBundleDirDebug: "$buildDir/intermediates/assets/debug",
50
  *   jsBundleDirDebug: "$buildDir/intermediates/assets/debug",
76
  */
76
  */
77
 
77
 
78
 project.ext.react = [
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
     enableHermes: false,  // clean and rebuild if changing
82
     enableHermes: false,  // clean and rebuild if changing
81
 ]
83
 ]
82
 
84
 
179
 }
181
 }
180
 
182
 
181
 dependencies {
183
 dependencies {
184
+    implementation project(':rnWebView')
182
     implementation fileTree(dir: "libs", include: ["*.jar"])
185
     implementation fileTree(dir: "libs", include: ["*.jar"])
183
     implementation "com.facebook.react:react-native:+"  // From node_modules
186
     implementation "com.facebook.react:react-native:+"  // From node_modules
184
 
187
 

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

7
 import com.facebook.react.ReactNativeHost;
7
 import com.facebook.react.ReactNativeHost;
8
 import com.facebook.react.ReactPackage;
8
 import com.facebook.react.ReactPackage;
9
 import com.facebook.soloader.SoLoader;
9
 import com.facebook.soloader.SoLoader;
10
+import com.reactnativecommunity.webview.RNCWebViewPackage;
10
 import java.lang.reflect.InvocationTargetException;
11
 import java.lang.reflect.InvocationTargetException;
11
 import java.util.List;
12
 import java.util.List;
12
 
13
 
25
           List<ReactPackage> packages = new PackageList(this).getPackages();
26
           List<ReactPackage> packages = new PackageList(this).getPackages();
26
           // Packages that cannot be autolinked yet can be added manually here, for example:
27
           // Packages that cannot be autolinked yet can be added manually here, for example:
27
           // packages.add(new MyReactNativePackage());
28
           // packages.add(new MyReactNativePackage());
29
+          packages.add(new RNCWebViewPackage());
28
           return packages;
30
           return packages;
29
         }
31
         }
30
 
32
 

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

1
 rootProject.name = 'example'
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
 include ':app'
3
 include ':app'
4
+include ':rnWebView'
5
+project(':rnWebView').projectDir = new File(rootProject.projectDir, '../../android')