This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This code enables the adaptation of interface element sizes to different screen sizes and font scales, | |
// using units of measurement that are independent of pixel density. | |
// This ensures a more consistent and pleasant user experience when using the application. | |
import { Dimensions, PixelRatio } from 'react-native'; | |
// TARGET_WIDTH signifies the base screen size to which the application adapts. | |
// The standard screen width for development: 375 dp is often used as the standard screen width for developing interfaces, as it corresponds to the screen size of iPhone 6/7/8 Plus. | |
// This makes it a good base value for creating an adaptive design that will look good on most modern smartphones. | |
// PS - You don't need to worry about other iPhones; we've tested on 6s, 8, 10, 14 as well as on several Androids realme 11, gtneo2, samsung s23..., and everything works well. | |
const TARGET_WIDTH = 375; |