mirror of
https://github.com/facebook/react-native.git
synced 2026-11-18 20:19:07 +00:00
Compile-out UIManagerModule from ReactSafeAreaView (#50161)
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/50161 Compile-out UIManagerModule from ReactSafeAreaView changelog: [internal] internal Reviewed By: cortinico Differential Revision: D71050640 fbshipit-source-id: e6675064a0e34bb581b495b3a6412f42372d223d
This commit is contained in:
1 parent
6f5d6a5990
commit
7dd6e25861
1 file changed
+14
-12
+14
-12
@@ -15,6 +15,7 @@ import androidx.core.view.WindowInsetsCompat
|
||||
import androidx.core.view.WindowInsetsCompat.CONSUMED
|
||||
import com.facebook.react.bridge.GuardedRunnable
|
||||
import com.facebook.react.bridge.WritableNativeMap
|
||||
import com.facebook.react.common.build.ReactBuildConfig
|
||||
import com.facebook.react.uimanager.PixelUtil.pxToDp
|
||||
import com.facebook.react.uimanager.StateWrapper
|
||||
import com.facebook.react.uimanager.ThemedReactContext
|
||||
@@ -40,25 +41,26 @@ internal class ReactSafeAreaView(val reactContext: ThemedReactContext) : ViewGro
|
||||
|
||||
@UiThread
|
||||
private fun updateState(insets: Insets) {
|
||||
stateWrapper?.let { stateWrapper ->
|
||||
// fabric
|
||||
val sw = stateWrapper
|
||||
if (sw != null) {
|
||||
WritableNativeMap().apply {
|
||||
putDouble("left", insets.left.toFloat().pxToDp().toDouble())
|
||||
putDouble("top", insets.top.toFloat().pxToDp().toDouble())
|
||||
putDouble("bottom", insets.bottom.toFloat().pxToDp().toDouble())
|
||||
putDouble("right", insets.right.toFloat().pxToDp().toDouble())
|
||||
|
||||
stateWrapper.updateState(this)
|
||||
sw.updateState(this)
|
||||
}
|
||||
} else if (!ReactBuildConfig.UNSTABLE_ENABLE_MINIFY_LEGACY_ARCHITECTURE) {
|
||||
// paper
|
||||
reactContext.runOnNativeModulesQueueThread(
|
||||
object : GuardedRunnable(reactContext) {
|
||||
override fun runGuarded() {
|
||||
this@ReactSafeAreaView.reactContext.reactApplicationContext
|
||||
.getNativeModule(UIManagerModule::class.java)
|
||||
?.updateInsetsPadding(id, insets.top, insets.left, insets.bottom, insets.right)
|
||||
}
|
||||
})
|
||||
}
|
||||
// paper
|
||||
?: reactContext.runOnNativeModulesQueueThread(
|
||||
object : GuardedRunnable(reactContext) {
|
||||
override fun runGuarded() {
|
||||
this@ReactSafeAreaView.reactContext.reactApplicationContext
|
||||
.getNativeModule(UIManagerModule::class.java)
|
||||
?.updateInsetsPadding(id, insets.top, insets.left, insets.bottom, insets.right)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user