Skip to content

Conversation

skusnierz
Copy link

@skusnierz skusnierz commented Oct 8, 2025

Summary:

https://app.asana.com/1/236888843494340/project/1211566197378916/task/1210654707296995

React Native has a parameter called PixelRatio (https://reactnative.dev/docs/pixelratio) which is responsible for scaling components and font size.

DisplayMetricsHolder.kt is responsible for storing values such as density, fontScale, width, and height.

private fun getPhysicalPixelsWritableMap(
      displayMetrics: DisplayMetrics,
      fontScale: Double
  ): WritableMap =
      WritableNativeMap().apply {
        putInt(“width”, displayMetrics.widthPixels)
        putInt(“height”, displayMetrics.heightPixels)
        putDouble(“scale”, displayMetrics.density.toDouble())
        putDouble(“fontScale”, fontScale)
        putDouble(“densityDpi”, displayMetrics.densityDpi.toDouble())
      }

While debugging why the Discord app scales font size and component sizes incorrectly, I noticed that PixelRatio values change incorrectly when changing the OS display size on Android:

Screen.Recording.2025-10-08.at.16.45.26.mov

This PR adds the missing DisplayMetricsHolder initialization on Android:

Screen.Recording.2025-10-08.at.16.49.40.mov

Test Plan:

Discord app :

Before :

Screen.Recording.2025-10-08.at.16.55.56.mov

After:

Screen.Recording.2025-10-08.at.16.59.39.mov

Changelog:

@skusnierz skusnierz requested a review from Flewp October 8, 2025 14:54
@skusnierz skusnierz self-assigned this Oct 8, 2025
@skusnierz skusnierz requested a review from athenayao October 8, 2025 14:54
Copy link

@joemun joemun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants