ReactNative: Android与iOS平台兼容处理
创建不同的文件扩展名:
*.android.js
*.io.js
方法二:import { Platform } from 'react-native';if (Platform.OS === 'android') { // Do something specific for Android } else if (Platform.OS === 'ios') { // Handle iOS} marginTop: Platform.OS === 'ios' 10 : 0, paddingBottom: Platform.OS === 'android' 8 : 0
方法三:
const myStyle = Platform.select({ios:{},android:{})const myFn = Platform.select({ios:()=>{},android:()=>{})myFn();
方法四:
if (UIManager.setLayoutAnimationEnabledExperimental) { UIManager.setLayoutAnimationEnabledExperimental(true);}
声明:本站所有文章资源内容,如无特殊说明或标注,均为采集网络资源。如若本站内容侵犯了原著者的合法权益,可联系本站删除。