Browse Source

chore(Android): Convert RNCWebViewPackage to Kotlin (#1194)

* RN is implementation dependency

* renamed:    RNCWebViewPackage.java -> RNCWebViewPackage.kt

* migrate RNCWebViewPackage to Kotlin

Co-authored-by: Jason Safaiyeh <safaiyeh@protonmail.com>
Dulmandakh 4 years ago
parent
commit
e6241cbb6a
No account linked to committer's email address

+ 1
- 1
android/build.gradle View File

@@ -123,6 +123,6 @@ def kotlin_version = getExtOrDefault('kotlinVersion')
123 123
 
124 124
 dependencies {
125 125
   //noinspection GradleDynamicVersion
126
-  api 'com.facebook.react:react-native:+'
126
+  implementation 'com.facebook.react:react-native:+'
127 127
   implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
128 128
 }

+ 0
- 27
android/src/main/java/com/reactnativecommunity/webview/RNCWebViewPackage.java View File

@@ -1,27 +0,0 @@
1
-package com.reactnativecommunity.webview;
2
-
3
-import com.facebook.react.ReactPackage;
4
-import com.facebook.react.bridge.JavaScriptModule;
5
-import com.facebook.react.bridge.NativeModule;
6
-import com.facebook.react.bridge.ReactApplicationContext;
7
-import com.facebook.react.uimanager.ViewManager;
8
-
9
-import java.util.Collections;
10
-import java.util.List;
11
-
12
-public class RNCWebViewPackage implements ReactPackage {
13
-  @Override
14
-  public List<NativeModule> createNativeModules(ReactApplicationContext reactContext) {
15
-    return Collections.singletonList(new RNCWebViewModule(reactContext));
16
-  }
17
-
18
-  // Deprecated from RN 0.47
19
-  public List<Class<? extends JavaScriptModule>> createJSModules() {
20
-    return Collections.emptyList();
21
-  }
22
-
23
-  @Override
24
-  public List<ViewManager> createViewManagers(ReactApplicationContext reactContext) {
25
-    return Collections.singletonList(new RNCWebViewManager());
26
-  }
27
-}

+ 15
- 0
android/src/main/java/com/reactnativecommunity/webview/RNCWebViewPackage.kt View File

@@ -0,0 +1,15 @@
1
+package com.reactnativecommunity.webview
2
+
3
+import com.facebook.react.ReactPackage
4
+import com.facebook.react.bridge.ReactApplicationContext
5
+
6
+
7
+class RNCWebViewPackage: ReactPackage {
8
+  override fun createNativeModules(reactContext: ReactApplicationContext) = listOf(
9
+    RNCWebViewModule(reactContext)
10
+  )
11
+
12
+  override fun createViewManagers(reactContext: ReactApplicationContext) = listOf(
13
+    RNCWebViewManager()
14
+  )
15
+}