react-native-normalize icon indicating copy to clipboard operation
react-native-normalize copied to clipboard

Normalize doesn't work on android

Open momolafrooo opened this issue 3 years ago • 1 comments

I'm using this package and it works perfectly on IOS but it doesn't work on android. Can someone help me ?

momolafrooo avatar Nov 27 '21 13:11 momolafrooo

I had the same problem. I looked into the code and saw that on Android 2 pixels are being subtracted from the end result

    if (Platform.OS === 'ios') {
        return Math.round(PixelRatio.roundToNearestPixel(newSize));
    } else {
        return Math.round(PixelRatio.roundToNearestPixel(newSize)) - 2;
    }
}

I removed subtraction and now normalization works fine.

But could someone explain why we are doing subtraction of 2 pixels? UPD: I also see I am not only one asking such question #5

layerok avatar Oct 06 '22 11:10 layerok