mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Convert ReactApplication to kotlin (#37987)
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/37987 Convert ReactApplication to kotlin bypass-github-export-checks changelog: [internal] internal Reviewed By: cortinico Differential Revision: D46772472 fbshipit-source-id: 70c6b9fad3e4e365434b59f184753ca23cf5ed56
This commit is contained in:
committed by
Facebook GitHub Bot
parent
ca9d74a377
commit
68fe124fdc
@@ -471,6 +471,11 @@ android {
|
||||
targetCompatibility = JavaVersion.VERSION_11
|
||||
}
|
||||
|
||||
kotlinOptions {
|
||||
// Using '-Xjvm-default=all' to support usage of @JvmDefault in kotlin files
|
||||
freeCompilerArgs = ['-Xjvm-default=all']
|
||||
}
|
||||
|
||||
defaultConfig {
|
||||
minSdk = 21
|
||||
targetSdk = 33
|
||||
|
||||
+1
-1
@@ -89,7 +89,7 @@ public class ReactActivityDelegate {
|
||||
}
|
||||
|
||||
public ReactHostInterface getReactHost() {
|
||||
return ((ReactApplication) getPlainActivity().getApplication()).getReactHostInterface();
|
||||
return ((ReactApplication) getPlainActivity().getApplication()).reactHostInterface();
|
||||
}
|
||||
|
||||
public ReactInstanceManager getReactInstanceManager() {
|
||||
|
||||
-26
@@ -1,26 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
package com.facebook.react;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
import com.facebook.react.interfaces.ReactHostInterface;
|
||||
|
||||
/** Interface that represents an instance of a React Native application */
|
||||
public interface ReactApplication {
|
||||
|
||||
/** Get the default {@link ReactNativeHost} for this app. */
|
||||
ReactNativeHost getReactNativeHost();
|
||||
|
||||
/**
|
||||
* Get the default {@link ReactHostInterface} for this app. This method will be used by the new
|
||||
* architecture of react native
|
||||
*/
|
||||
default @Nullable ReactHostInterface getReactHostInterface() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
/*
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
package com.facebook.react
|
||||
|
||||
import com.facebook.react.common.annotations.UnstableReactNativeAPI
|
||||
import com.facebook.react.interfaces.ReactHostInterface
|
||||
|
||||
@OptIn(UnstableReactNativeAPI::class)
|
||||
/** Interface that represents an instance of a React Native application */
|
||||
interface ReactApplication {
|
||||
/** Get the default [ReactNativeHost] for this app. */
|
||||
fun getReactNativeHost(): ReactNativeHost
|
||||
|
||||
/**
|
||||
* Get the default [ReactHostInterface] for this app. This method will be used by the new
|
||||
* architecture of react native
|
||||
*/
|
||||
@JvmDefault fun reactHostInterface(): ReactHostInterface? = null
|
||||
}
|
||||
Reference in New Issue
Block a user