この方法の一つ:
:別のファイル拡張子の作成
* .android.js
* .io.jsを
方法2:
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
方法3:
const myStyle = Platform.select({ios:{},android:{})
const myFn = Platform.select({ios:()=>{},android:()=>{}) myFn();
方法4:
if (UIManager.setLayoutAnimationEnabledExperimental) {
UIManager.setLayoutAnimationEnabledExperimental(true);
}