Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -382,6 +382,21 @@ class SandboxReactNativeDelegate(
override fun getFilesDir(): java.io.File = sandboxFilesDir

override fun getApplicationContext(): Context = this

/**
* On Android 12 and below, Context.registerComponentCallbacks() delegates to
* getApplicationContext().registerComponentCallbacks(). Since getApplicationContext()
* returns `this` in SandboxContextWrapper, that causes infinite recursion and a
* StackOverflowError. Android 13+ fixed this in ContextWrapper by delegating to mBase
* directly. We mirror that fix here to support older platforms.
*/
override fun registerComponentCallbacks(callback: android.content.ComponentCallbacks) {
baseContext.applicationContext.registerComponentCallbacks(callback)
}

override fun unregisterComponentCallbacks(callback: android.content.ComponentCallbacks) {
baseContext.applicationContext.unregisterComponentCallbacks(callback)
}
}

private class FilteredReactPackage(
Expand Down