Article From:https://segmentfault.com/q/1010000011132212
Question:

Just getting started, I feel that since JS has been unified to write why it can not be done more perfect, once write, run anywhere~

It feels like the reactpackager is powerful enough to encapsulate a layer of exceptions to IOS and android, such as navigation
For example, the package is compiled into IOS programs, using NavagatorIOS, compiled into Android and react-navagator.

I’m thinking about the possibility that there’s an impossible difference between IOS and Android Applications (probably because of a hardware system), such as styles, or gestures.
Lead to writing a set of code can not meet the requirements of two systems at the same time.

So I want to know what causes the two codes to be written in react-native according to IOS and Android.

Answer 0:

jsJust as an intermediate language, or a native API is just a package with JS, which is difficult to unify based on the differences between the two native languages

Answer 1:

I think it’s to get closer to the sound. You know there’s a lot of similarities between iOS and Android, but there’s also a lot of differences. If a API or a control only has iOS, then write a set of code, will Android make mistakes or not?

I used to write a set of code when I used Xamrin Form, but the functionality and interface were very basic, and many advanced features were missing.

For example, iOS is updated. If it is 2 sets, react will update the iOS suite. Is it embarrassing if you use one set as you want?

Answer 2:

It is not perfect to use js, or need some basic knowledge of Java and iOS. For example, iOS needs to open the permissions by using out of project functions, and they need to do special settings when using SDK. These are all impossible to avoid.

Answer 3:

When writing RN, most of the time, Android and IOS share the same code, RN is just doing this. Only part of the functions need to use the suffix name of the file because of the platform difference.PlatformTo differentiate the platform from the specific code.

Answer 4:

rnThe idea is learn once, write anywhere

Leave a Reply

Your email address will not be published. Required fields are marked *