Fix Soloader call in DefaultComponentsRegistry (#42660)

Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42660

Calling `maybeLoadSoLibrary` from init is too late, as we call `initHybrid` before `init`. Instead use a static initializer.

Changelog: [Internal]

Reviewed By: cortinico

Differential Revision: D53048065

fbshipit-source-id: dfd2957fd9209e02c498ee08e9cbd7c7a1a83c3e
This commit is contained in:
Pieter De Baets
2024-01-25 07:07:04 -08:00
committed by Facebook GitHub Bot
parent e7fd142c38
commit 49f6ffc92f
@@ -23,15 +23,17 @@ class DefaultComponentsRegistry
@DoNotStrip
private constructor(componentFactory: ComponentFactory) {
@DoNotStrip private val hybridData: HybridData = initHybrid(componentFactory)
@DoNotStrip
@Suppress("NoHungarianNotation")
private val mHybridData: HybridData = initHybrid(componentFactory)
@DoNotStrip private external fun initHybrid(componentFactory: ComponentFactory): HybridData
init {
DefaultSoLoader.maybeLoadSoLibrary()
}
companion object {
init {
DefaultSoLoader.maybeLoadSoLibrary()
}
@JvmStatic
@DoNotStrip
fun register(componentFactory: ComponentFactory) = DefaultComponentsRegistry(componentFactory)