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>
This commit is contained in:
Dulmandakh 2020-02-13 09:12:24 +08:00 committed by GitHub
parent f65783d348
commit e6241cbb6a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 16 additions and 28 deletions

View File

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

View File

@ -1,27 +0,0 @@
package com.reactnativecommunity.webview;
import com.facebook.react.ReactPackage;
import com.facebook.react.bridge.JavaScriptModule;
import com.facebook.react.bridge.NativeModule;
import com.facebook.react.bridge.ReactApplicationContext;
import com.facebook.react.uimanager.ViewManager;
import java.util.Collections;
import java.util.List;
public class RNCWebViewPackage implements ReactPackage {
@Override
public List<NativeModule> createNativeModules(ReactApplicationContext reactContext) {
return Collections.singletonList(new RNCWebViewModule(reactContext));
}
// Deprecated from RN 0.47
public List<Class<? extends JavaScriptModule>> createJSModules() {
return Collections.emptyList();
}
@Override
public List<ViewManager> createViewManagers(ReactApplicationContext reactContext) {
return Collections.singletonList(new RNCWebViewManager());
}
}

View File

@ -0,0 +1,15 @@
package com.reactnativecommunity.webview
import com.facebook.react.ReactPackage
import com.facebook.react.bridge.ReactApplicationContext
class RNCWebViewPackage: ReactPackage {
override fun createNativeModules(reactContext: ReactApplicationContext) = listOf(
RNCWebViewModule(reactContext)
)
override fun createViewManagers(reactContext: ReactApplicationContext) = listOf(
RNCWebViewManager()
)
}