Skip to content

Commit 2e52c1a

Browse files
cortinicoreact-native-bot
authored andcommitted
Make accessors inside HeadlessJsTaskService open again (#52660)
Summary: Pull Request resolved: #52660 The documentation for those methods mention that users should override them to provide their own implementation. However those vals are not `open` so users cannot really override them. This fixes it. See more context on #48800 (comment) So this was practically a breaking change, that I'm attempting to mitigate. Changelog: [Android] [Fixed] - Make accessors inside HeadlessJsTaskService open again Reviewed By: cipolleschi Differential Revision: D78479162 fbshipit-source-id: eefc7332e2004198cd6bd64b60a66215f137ad4a
1 parent cb20a1c commit 2e52c1a

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ public abstract class com/facebook/react/HeadlessJsTaskService : android/app/Ser
3131
public fun <init> ()V
3232
public static final fun acquireWakeLockNow (Landroid/content/Context;)V
3333
protected final fun getReactContext ()Lcom/facebook/react/bridge/ReactContext;
34-
protected final fun getReactHost ()Lcom/facebook/react/ReactHost;
35-
protected final fun getReactNativeHost ()Lcom/facebook/react/ReactNativeHost;
34+
protected fun getReactHost ()Lcom/facebook/react/ReactHost;
35+
protected fun getReactNativeHost ()Lcom/facebook/react/ReactNativeHost;
3636
protected fun getTaskConfig (Landroid/content/Intent;)Lcom/facebook/react/jstasks/HeadlessJsTaskConfig;
3737
public fun onBind (Landroid/content/Intent;)Landroid/os/IBinder;
3838
public fun onDestroy ()V

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,15 +113,15 @@ public abstract class HeadlessJsTaskService : Service(), HeadlessJsTaskEventList
113113
* somewhere.
114114
*/
115115
@Suppress("DEPRECATION")
116-
protected val reactNativeHost: ReactNativeHost
116+
protected open val reactNativeHost: ReactNativeHost
117117
get() = (application as ReactApplication).reactNativeHost
118118

119119
/**
120120
* Get the [ReactHost] used by this app. By default, assumes [getApplication] is an instance of
121121
* [ReactApplication] and calls [ReactApplication.reactHost]. This method assumes it is called in
122122
* new architecture and returns null if not.
123123
*/
124-
protected val reactHost: ReactHost?
124+
protected open val reactHost: ReactHost?
125125
get() = (application as ReactApplication).reactHost
126126

127127
protected val reactContext: ReactContext?

0 commit comments

Comments
 (0)