ReactNative: Android与iOS平台兼容处理
16lz
2021-12-04
方法一:
创建不同的文件扩展名:
*.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);}
更多相关文章
- 浅谈Java中Collections.sort对List排序的两种方法
- Python list sort方法的具体使用
- python list.sort()根据多个关键字排序的方法实现
- 2011.09.01(3)——— android service startService bindService
- 从jdk1.7.0获取MD5认证指纹方法
- Android(安卓)API开发之OpenGL开发之Android(安卓)OpenGL之使用G
- Android中Scroller类的分析
- Android(安卓)TextView文字过多时通过滚动条显示多余内容
- Android(安卓)平铺背景图片