ReactNative: Android与iOS平台兼容处理
16lz
2021-01-23
方法一:
创建不同的文件扩展名:
*.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);}
更多相关文章
- android Environment 常用方法(获取存储目录)
- Android 获取控件宽高的3种方法
- Android中创建与几种解析xml的方法!
- Android当方法总数超过64K时(Android Studio)
- android ViewPager 使用方法
- Android 方法数超过64k限制的解决办法
- android的Services生命周期和使用方法
- Android onClick事件三种实现方法
- android学习——android 常见的错误 和 解决方法