mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
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:
committed by
Facebook GitHub Bot
parent
8de401c625
commit
c232148e74
+3
-3
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user