marudy / react-native-responsive-screen

Make React Native views responsive for all devices with the use of 2 simple methods
MIT License
1.56k stars 142 forks source link

Strange results in two different emulators #81

Open CodeByRahulSaini opened 4 years ago

CodeByRahulSaini commented 4 years ago

Hey, first of all thanks for this awesome package.

I am getting a strange result on two different emulators with the same code.

Another strange thing is when I remove flexWrap: 'wrap', property then design looks the same in both devices with no issue

Any suggestions on how to solve it?

Pixel XL Emulator Screenshot_1590995791

Nexus 4 Emulator Screenshot_1590995793

Here is my code:


const item = {
      backgroundColor: 'green',
      width: wp('28%'),
      height: wp('28%'),
      margin: wp('1%'),
    }`

   render(){ return (
      <Fragment>
        <View
          style={{
            backgroundColor: 'red',
            flex: 1,
            flexDirection: 'row',
            margin: wp('5%'),
            marginTop: wp('10%'),
            flexWrap: 'wrap',
          }}
        >
          <View style={item} />
          <View style={item} />
          <View style={item} />
        </View></Fragment>)
}
cvlos commented 4 years ago

Hello @IMRahulSaini , the behavior you are explaining is exactly what you would expect from flexWrap property. This may help https://reactnative.dev/docs/flexbox#flex-wrap

CodeByRahulSaini commented 4 years ago

Actually my point is if I am using 'wp()' everywhere means some responsive value, then both emulators should show content equally i.e. three boxes in a line

mir1198yusuf commented 3 years ago

It seems wrong value for width is being returned by emulator. Might be emulator error instead of library error. Can you log the width of both emulators & check if that's correct ?