|
|
|
|
|
by joshjhargreaves
2580 days ago
|
|
Applications written in React Native typically are cross-platform; saying that they are not is a pretty large misrepresentation of the framework. At its base React Native provides a common set of native components with the same API on both iOS and Android such as View, Image & Text which can all be styled and laid out through common APIs. These APIs pretty much give you most of what you need to make an entire APP. Sometimes you may want to have different behavior per platfrom and for that you can use the Platform API (provided by React Native) to switch for each platform. This would allow you to do things like change the styling on each platform or the native components you use. React Native makes it pretty easy to expose native components to JavaScript. It is also up to the native component author if they want to create a common API for all platforms that they support. In the case of Views & styling it makes a lot of sense to have the same API on iOS and Android, but sometimes they are some platform features that are only available on one platform. Wile Swift Layout is not cross-platform, it may soon be and I think it does a lot for promoting declarative UI & maybe they did take some inspiration from React! View docs: https://facebook.github.io/react-native/docs/view.html
Styling: https://facebook.github.io/react-native/docs/style
Layout: https://facebook.github.io/react-native/docs/flexbox |
|
React Native is for cross-platform. SwiftUI is for cross-device.
Does that work?