2

I have been searching online for a while trying to find some best practices for simultaneously development of iOS and Android app in React-Native. I was wondering if anyone has any experience with this. Should we have two projects? Have one project with different views? Share the same views for the same components?

Appreciate your time!

2 Answers 2

5

How you organize your components is a bit of personal preference.

You don't need to organize by platform, however. Just name your components like so:

MyComponent.android.js
MyComponent.ios.js

React Native will automatically pick the right version of the component for each platform.

Sign up to request clarification or add additional context in comments.

Comments

2

I think it should be one project. Here is my project structure:

  • /app/common/
    • commonComponent1.js
    • commonComponent2.js
  • /app/ios/
    • iosComponent1.js
    • iosComponent2.js
  • /app/android/
    • androidComponent1.js
    • androidComponent2.js

React-Native has %70-%80 code sharing for both platforms. Therefore you should one project and reuse common components for ios and android.

1 Comment

could you give an example of what a platform-specific component would be? in other words, what's the other 30-20%? menu stuff? login stuff? buttons?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.