score:3
I've found that a well-designed project can reach a relatively high degree of code-sharing between both iOS and Android - in some instances 85-95% - it depends how complex the app is. The .ios
and .android
extensions simply exist because it's useful to be able to target each platform specifically - when creating modular components sometimes each OS yields a different challenge, so you have to rethink the architecture. An example is the <Picker>
component, which creates a UIPickerView
on iOS, but a modal Picker
and label on Android - both of which work slightly differently. But in general this isn't the case, at least in my experience.
As the index.js
file is the entry-point it therefore serves as the router for many apps, which means you want this to be the same across each platform - so you can actually have just one index.js
for all platforms. Sometimes it might be necessary to have platform-specific initialisations and global assignments which would make the separate approach useful.
Web-wise there currently isn't much cross-over (although hopefully this will change). React Native utilises the power of React, while running on top of the native components designed by the iOS and Android teams, and the differences between mobile and web are fairly broad. That having been said there are some components such as React Swipeable Views which work across web and native which is very promising. But for now the two are fairly separate - one sits on the DOM, the other on native SDKs, although both share pretty much everything else, meaning there's good transfer of skills across platforms.
Source: stackoverflow.com
Related Query
- Understanding React Native Cross Platform
- Understanding default font sizes in React Native
- Do react native uses same code for ios and android or both platform code should be written separately?
- What is the difference between React Native and React?
- Error Running React Native App From Terminal (iOS)
- React native text going off my screen, refusing to wrap. What to do?
- Get current scroll position of ScrollView in React Native
- React Native Responsive Font Size
- Make view 80% width of parent in React Native
- Understanding the React Hooks 'exhaustive-deps' lint rule
- Image resizing in React Native
- React Native on Android failed to find Build Tools
- Simulate display: inline in React Native
- React Native Error - yarn' is not recognized as an internal or external command
- Understanding why super() is deprecated in a React class component
- Can React Native apps be tested in a browser?
- Hiding the status bar with React Native
- How to detect when a React Native app is closed (not suspended)?
- What folders should be git ignored in React Native project?
- How do I exit/shut down a React Native app?
- New React Native project with old version of react native
- react lifecycle methods understanding
- How do you make the ListHeaderComponent of a React Native FlatList sticky?
- Transparent overlay in React Native
- Why does React Native not offer a justify-self
- Can you use React Native to create a desktop application?
- GET with query string with Fetch in React Native
- React Native / Xcode Upgrade and now RCTConvert.h not found
- PhaseScriptExecution [CP-User] error in React Native
- React Native error: Element type is invalid: expected a string or a class/function but got: object
More Query from same tag
- tailwind css not working between components
- Using props data for a select field
- One-off error(?) on Reactjs setState
- How to clear entire react material ui table conent
- react destructuring variable got undefined
- React.js (useState ,useEffect) infinite loop error when setState("updated value") is called
- navigate with react-router-dom v6 not working
- React useEffect cleanup function depends on async await result
- How to use custom resuable components as input fields in react
- Is there a way of maintaining a lot objects in react state wiesly
- module not found, React
- Receiving "Attempted import error:" in react app
- React - update component class on custom Scroll change
- How can we get the text field value during onSubmit method in latest react-hooks-form
- I can't get npm start to run
- React - stuck on filtering JSON data based on whether object key exists
- invalid assignment to const 'setMessage'
- this.props is not a function between parent and children components
- How to add a margin to a datetime picker component?
- ReactJS how to update page after fetching data
- how do you declare an array of objects inside typescript?
- Newly created preact Component retains UI state of old component (different from react)
- Issues with snapshot testing in Jest with material-ui
- Using CSS nth-child on nested map in React
- ReactJS state is being updated after an API request
- Can't access to a state object (React useState hook)
- Theme with React and Redux
- How can I allow just one input selection in react?
- React TextArea value not automatically updating as expected
- React component props with hyphen naming