简体   繁体   中英

What should be the sizes of the Images for supporting both iOS & Android in React-Native

I am an iOS developer, recently I have started creating an APP in React-native. In iOS we provide 3 types of images x, @2x & @3x for supporting all the devices. When coming to android according in some of the developer sites/blogs, I have seen they use many resolution image sizes like ldpi, mdpi, hdpi, xhdpi and like..

My Question is

So, In react-native what sizes of images should i use so as it fits in both iOS & Android devices.

In my login screen the image size I have used is "640 X 1138" & "750X1334", but here in Android devices the image is being trimmed in top and bottom of the screens, in iOS devices it is good to go.

You can use it separately by platform .

For images in the Android assets folder, use the asset:/ scheme:

<Image source={{ uri: 'asset:/app_icon.png' }} style={{ width: 40, height: 40 }} />
var icon = Platform.OS === 'ios' ? require('./my-icon-active.png') : require('asset:/my-icon-inactive.png');
<Image source={icon} />;

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM