parent
81c8f99256
commit
087d9cd7f9
@ -0,0 +1,17 @@
|
|||||||
|
import { Dimensions, Platform, PixelRatio } from 'react-native';
|
||||||
|
|
||||||
|
const {
|
||||||
|
width: SCREEN_WIDTH,
|
||||||
|
} = Dimensions.get('window');
|
||||||
|
|
||||||
|
const scale = SCREEN_WIDTH / 480;
|
||||||
|
|
||||||
|
// @ts-ignore
|
||||||
|
export default function normalize(size) {
|
||||||
|
const newSize = size * scale
|
||||||
|
if (Platform.OS === 'ios') {
|
||||||
|
return Math.round(PixelRatio.roundToNearestPixel(newSize))
|
||||||
|
} else {
|
||||||
|
return Math.round(PixelRatio.roundToNearestPixel(newSize)) - 3
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in new issue