Platform API - Setting different styles on IOS / ANDROID
Wed Mar 16 2022 16:40:40 GMT+0000 (Coordinated Universal Time)
Saved by
@markmarleydev
Platform API figures what operating system you are on.
backgroundColor: Platform.OS === "android" ? Colors.primary : "white"
backgroundColor: Platform.OS === "ios" ? Colors.primary : "white"
Alternate is to use Platform.select
<View
style={{
...styles.headerBase
...Platform.select({
ios: styles.headerIOS,
android: styles.headerAndroid
})
}}>
</View>
content_copyCOPY
Comments