Method one:

Create a different file extension: *.android.js *.io.js

Method 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
Copy the code

Method 3:

const myStyle = Platform.select({ios: {},android: {})const myFn = Platform.select({ios:(a)= >{},android:(a)= >{})
myFn();
Copy the code

Method 4:

if (UIManager.setLayoutAnimationEnabledExperimental) {
       UIManager.setLayoutAnimationEnabledExperimental(true);
} 
Copy the code