Advantages of having index.ios.js instead of just index.js

后端 未结 6 1202
南旧
南旧 2021-02-04 19:58

New to react-native and used create-react-native-app to make the scaffolding for my first app. It made an App.js which I guess is equivalent to most ap

6条回答
  •  野性不改
    2021-02-04 20:28

    The whole idea of having iOS and android files is for dealing with codes that needs to be written differently in android and iOS. For example, the Picker component in React Native works differently in iOS and Android. By splitting the code, you can easily split the code and maintain them. When running, React Native will find which file to use automatically based on the platform the app is running on.

    Source: https://facebook.github.io/react-native/releases/0.26/docs/platform-specific-code.html

提交回复
热议问题