fbsource//xplat/js/react-native-github/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/modules/deviceinfo:deviceinfoAndroid (#51011)

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

Reviewed By: rshest

Differential Revision: D73840378

fbshipit-source-id: 8a902c454b4b8252f8e690fb10de58cfecd6c703
This commit is contained in:
generatedunixname89002005287564
2025-04-30 09:07:19 -07:00
committed by Facebook GitHub Bot
parent 8de401c625
commit c232148e74
@@ -38,7 +38,7 @@ internal class DeviceInfoModule(reactContext: ReactApplicationContext) :
}
override fun onHostResume() {
val newFontScale = reactApplicationContext?.resources?.configuration?.fontScale
val newFontScale = reactApplicationContext.resources?.configuration?.fontScale
if (newFontScale != null && newFontScale != fontScale) {
fontScale = newFontScale
emitUpdateDimensionsEvent()
@@ -50,7 +50,7 @@ internal class DeviceInfoModule(reactContext: ReactApplicationContext) :
override fun onHostDestroy(): Unit = Unit
fun emitUpdateDimensionsEvent() {
reactApplicationContext?.let { context ->
reactApplicationContext.let { context ->
if (context.hasActiveReactInstance()) {
// Don't emit an event to JS if the dimensions haven't changed
val displayMetrics = getDisplayMetricsWritableMap(fontScale.toDouble())
@@ -71,7 +71,7 @@ internal class DeviceInfoModule(reactContext: ReactApplicationContext) :
override fun invalidate() {
super.invalidate()
reactApplicationContext?.removeLifecycleEventListener(this)
reactApplicationContext.removeLifecycleEventListener(this)
}
public companion object {