mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Use vals inside ReactApplication (#38088)
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/38088 For better Kotlin interop we should be using `val` in this interface rather than just `fun`. This is not a breaking change as Java users can still use `getReactNativeHost()` as before. Changelog: [Internal] [Changed] - Use vals inside ReactApplication Reviewed By: javache Differential Revision: D47053030 fbshipit-source-id: 4a7fbc71a76be54e1cf7daef499b9bc3e8fc615a
This commit is contained in:
committed by
Facebook GitHub Bot
parent
3a912a3716
commit
c3f672cef7
+3
-4
@@ -14,13 +14,12 @@ import com.facebook.react.interfaces.ReactHostInterface
|
||||
/** Interface that represents an instance of a React Native application */
|
||||
interface ReactApplication {
|
||||
/** Get the default [ReactNativeHost] for this app. */
|
||||
fun getReactNativeHost(): ReactNativeHost
|
||||
val reactNativeHost: ReactNativeHost
|
||||
|
||||
/**
|
||||
* Get the default [ReactHostInterface] for this app. This method will be used by the new
|
||||
* architecture of react native
|
||||
*/
|
||||
fun getReactHostInterface(): ReactHostInterface? {
|
||||
return null
|
||||
}
|
||||
val reactHostInterface: ReactHostInterface?
|
||||
get() = null
|
||||
}
|
||||
|
||||
+1
-3
@@ -11,7 +11,7 @@ import com.facebook.soloader.SoLoader
|
||||
|
||||
class MainApplication : Application(), ReactApplication {
|
||||
|
||||
private val reactNativeHost: ReactNativeHost =
|
||||
override val reactNativeHost: ReactNativeHost =
|
||||
object : DefaultReactNativeHost(this) {
|
||||
override fun getPackages(): List<ReactPackage> {
|
||||
// Packages that cannot be autolinked yet can be added manually here, for example:
|
||||
@@ -27,8 +27,6 @@ class MainApplication : Application(), ReactApplication {
|
||||
override val isHermesEnabled: Boolean = BuildConfig.IS_HERMES_ENABLED
|
||||
}
|
||||
|
||||
override fun getReactNativeHost(): ReactNativeHost = reactNativeHost
|
||||
|
||||
override fun onCreate() {
|
||||
super.onCreate()
|
||||
SoLoader.init(this, false)
|
||||
|
||||
Reference in New Issue
Block a user