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

后端 未结 6 1219
南旧
南旧 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:25

    React Native components will port to their platforms so yes, you can build everything in index.js and be fine for most cases.

    If you have certain styles or using some components that only have platform specific features, you can either use the .ios or .android tags to help that so it puts that scaffolding out there.

    There is also the Platform module that you can use for simple stuff but the React Native guide, it mentions the use of ios and android tags on files if your code gets too complex.

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

提交回复
热议问题