1import {Platform} from 'react-native';
2 st styles = StyleSheet.create({
3 container: {
4 flex: 1,
5 ...Platform.select({
6 ios: {
7 backgroundColor: 'red',
8 },
9 android: {
10 backgroundColor: 'blue',
11 },
12 }),
13 },
14 });
15
16
17//OR
18import {Platform, StyleSheet} from 'react-native';
19
20const styles = StyleSheet.create({
21 height: Platform.OS === 'ios' ? 200 : 100,
22});
1import { Platform, StyleSheet } from 'react-native';
2
3const styles = StyleSheet.create({
4 container: {
5 flex: 1,
6 ...Platform.select({
7 ios: {
8 backgroundColor: 'red'
9 },
10 android: {
11 backgroundColor: 'green'
12 },
13 default: {
14 // other platforms, web for example
15 backgroundColor: 'blue'
16 }
17 })
18 }
19});
20
1import { Platform, StyleSheet } from 'react-native';
2
3const styles = StyleSheet.create({
4 height: Platform.OS === 'ios' ? 200 : 100
5});