How to use different styles for android and ios on react-native?
There are many ways to achieve this. The simplest one in your case would be to use Platform.OS:
var {Platform} = React;
var styles = StyleSheet.create({
height: (Platform.OS === 'ios') ? 200 : 100
});
From https://facebook.github.io/react-native/docs/platform-specific-code, you can use Platform.select
There is also a Platform.select method available, that given an object containing Platform.OS as keys, returns the value for the platform you are currently running on.
import { Platform, StyleSheet } from 'react-native'
const styles = StyleSheet.create({
container: {
flex: 1,
...Platform.select({
ios: {
backgroundColor: 'red',
},
android: {
backgroundColor: 'blue',
},
}),
}
})