react native detect platform code example
Example 1: react native get OS
const design = Platform.select({
android: {
header: true
},
ios: {
header: false
},
});
Example 2: how to use platform.select
import {Platform} from 'react-native';
st styles = StyleSheet.create({
container: {
flex: 1,
...Platform.select({
ios: {
backgroundColor: 'red',
},
android: {
backgroundColor: 'blue',
},
}),
},
});
Example 3: react native detect platform
Platform.select({
ios: {
backgroundColor: 'red',
},
android: {
backgroundColor: 'blue',
},
})