This platform allows the team to maintain two platforms and share a common technology - React. With a single codebase, you can create platform-specific versions of components so that it could be shared across platforms.
Native Development For Everyone
If you truly want to create native apps without compromising the user experiences. React Native provides a core set of platform-agnostic native components like the View, Text, and Image that map directly to the platform's native UI building blocks.
React gives Seamless Cross-Platform
The encapsulation of the existing native code by the components of React Native makes it easier to interact with the native APIs. This enables the developers for native app development and allowing the existing team to work much faster.
Developing The Application
To start with a simple employee listing application with hsearch functionality. The focus of this application will entirely be on logic and spend less attention to the styling of the components. The application structure will contain folders such as APIs, components, containers, utils & much more.
The API folder will be needed for mocking the data required for mobile app development.
The building blocks of an application are separated into two - containers folder and components folder. The separation of the building blocks makes the reusability of the presentational and state full components much easier and enforce separation of concerns. The components in the containers folder handle the data flow and mutations.
Developing requires coding, hence you should open - index.ios.js and add AppRegistry.
This feature defines the entry point of the application and provides the root component. Further, you will have to examine the application skeleton, which is the App.js container component. To move forward with the app development - will use the Tab bar with two items. The two components - Employees and Search will be used within the TabBarIOS component provide by the React Native for their functionality.
So, every tab created would require TabBarIOS.Item component in order to pass the child custom components, which will be handled by the tab route - EmployeesTab and SearchTab components. Methods - _searchOnPress and _employeesOnPress are passed to the Onpress handlers to their corresponding components, as they are responsible for handling the state for the selected tab.
Adding Tab Components
Creating EmployeesTab and SearchTab components are similar to the NavigatorIOS component, which creates the routes for the tabs.
Employee List View
The Employees container component, here is where LastView can be created with all the employees available. The data is loaded and set up to the dataSource for ListView, which is passed via props - EmployeeList presentational component, over the component DidMount lifecycle hook.
The use of ListView, a ReactNative component, and pass dataSource and renderRow functions. The role of the renderRow component is to make the appearance and behavior of the data in the list item.
Using the TouchableHighlight component can make views respond properly to touches. When a row is pressed, _rowOnPress is triggered, the opacity of the View is decreased, allowing the underlying color through darkening or tinting the View. Additionally, a new route with EmployeeDetails props is pushed to the navigator object.
Since all the routes to mobile app development are completed for the Employees tab, now is the time for Search Tab enabling the users to search Employees by name. Hence, creating a Search.js container component will require reusing the EmloyeesList component here, as well as to show the results. So here APIs are queried, when the user types in the search box, the returned data is displayed.
The finished app will enable the great use of the react-native component's reusability and will showcase the list of employees with their email, location, DOB, and contact. And for quick results, you can search for the employee you are looking for.
In A Nutshell -
React Native is a relatively new technology that is widely used for mobile app development services. The increasing adoption of this technology is due to its productivity, its scalability, and above all, time and cost-effectiveness.