Skip to content

Commit 0d3791c

Browse files
mdvaccafacebook-github-bot
authored andcommitted
Throw Exception if ReactApplication.reactNativeHost is not overriden (#52912)
Summary: Pull Request resolved: #52912 This diff throws an Exception if ReactApplication.reactNativeHost is not overriden. This field is deprecated and it will be deleted in the near future. The goal of this diff is to be able to remove usages of reactNativeHost for classes that implement ReactApplication changelog: [Android][Breaking] Throw Exception if ReactApplication.reactNativeHost is not overriden Reviewed By: mlord93 Differential Revision: D79186336 fbshipit-source-id: 9f8f34739c0f04056ff3d795bda45bc0dbca7624
1 parent 4614a0b commit 0d3791c

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

packages/react-native/ReactAndroid/api/ReactAndroid.api

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ public class com/facebook/react/ReactActivityDelegate {
140140

141141
public abstract interface class com/facebook/react/ReactApplication {
142142
public fun getReactHost ()Lcom/facebook/react/ReactHost;
143-
public abstract fun getReactNativeHost ()Lcom/facebook/react/ReactNativeHost;
143+
public fun getReactNativeHost ()Lcom/facebook/react/ReactNativeHost;
144144
}
145145

146146
public class com/facebook/react/ReactDelegate {

packages/react-native/ReactAndroid/src/main/java/com/facebook/react/ReactApplication.kt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ public interface ReactApplication {
1515
"You should not use ReactNativeHost directly in the New Architecture. Use ReactHost instead.",
1616
ReplaceWith("reactHost"))
1717
public val reactNativeHost: ReactNativeHost
18+
get() {
19+
throw RuntimeException("You should not use ReactNativeHost directly in the New Architecture")
20+
}
1821

1922
/**
2023
* Get the default [ReactHost] for this app. This method will be used by the new architecture of

0 commit comments

Comments
 (0)