Cristian Maraglino

Cristian Maraglino

08/20/2024

Exploring Frameworks with a Focus on React Native

React Native
Mobile Development
Cross-Platform

In the vast landscape of software development, customization and process acceleration are now more accessible, thanks to the emergence of new frameworks. Among the available options, React Native has caught my attention in recent months as I worked on developing a cross-platform mobile app for iOS and Android. In this article, I share my experiences and insights on React Native, exploring its origins, uses, and challenges faced.

Why React Native?

When working on projects with tight deadlines, balancing development time and product quality becomes crucial. I sought a way to develop an app for both iOS and Android without having to create two separate codebases. In this search, React Native emerged as a promising solution, allowing a single codebase to be written for both platforms.

React Native offers a promising solution for developing cross-platform mobile apps with a single codebase, balancing development time and product quality.

Origins and history of React Native

React Native is an open-source framework created by Facebook (now Meta) that allows mobile applications to be developed using JavaScript or TypeScript with the React framework. The evolution of React Native is marked by several significant milestones:

  • 2013: Introduction of React, a framework for developing user interfaces for the web.

  • 2015: Official announcement of React Native at the F8 conference and release on GitHub as an open-source project, enabling the development of native mobile apps using the same codebase as React for the web.

  • 2017: Introduction of 'React Native Fabric,' a major architectural overhaul to improve performance and flexibility.

  • 2020: Release of 'Hermes,' a JavaScript engine optimized for React Native, improving the performance of Android apps.

  • 2021: Meta continues to invest in the framework, expanding support and enhancing integration with other technologies.
  • Uses and applications of React Native

    Today, React Native is widely adopted by leading global companies for mobile app development:

  • Facebook and Instagram (Meta): use React Native for parts of their mobile apps.

  • Airbnb: extensively used React Native in the past, though they have partially moved away for specific reasons.

  • Skype and Microsoft Teams: both apps are developed by Microsoft using React Native.

  • Uber Eats and Walmart: utilize React Native for their e-commerce and delivery platforms.

  • Tesla: adopts React Native for certain features of its mobile apps.

  • The framework remains popular due to its ability to combine the user experience of native apps with the efficiency of cross-platform development.

    Top companies trust React Native for its performance.

    My experience with React Native

    Starting with React Native required getting familiar with the necessary tools and setting up the project. The documentation is abundant, and the community is active, although the information can sometimes be contradictory. I found community support and official guides useful, although the variety of approaches can be a source of confusion.

    Using components and Material Design

    React Native offers a wide range of components for building user interfaces. Whether using basic, custom, or third-party components, modular development is a key strength. Integration with Material Design, using libraries like React Native Paper, further enhances UI consistency and customization.

    Components in React Native:

    React Native components offer flexibility and customization for building mobile apps:

  • Basic Components: View, Text, Image, ScrollView... Corresponding to native elements of iOS and Android.

  • Custom Components: created to meet specific app needs.

  • Third-Party Components: external libraries that offer predefined elements.

  • Components can be stateless (without state) or stateful (with state). Stateless components are functions that receive data via props without managing internal state, while stateful components maintain and manage internal state, enabling dynamic and interactive user interfaces.


    For example, a search bar that performs dynamic searches based on external parameters (such as searching for apartments or parking spaces) could be implemented as a stateful component, managing the text entered by the user and search results internally.


    Alternatively, a versatile CustomInput component could be used as a numeric field, password input, or email entry by adjusting a few properties. This component would be stateless, relying entirely on data passed through props, making it easily reusable across different parts of the app.


    Material Design and React Native: Material Design, developed by Google, provides visual and behavioral guidelines for consistent and engaging user interfaces. Libraries for implementing Material Design in React Native include:


  • React Native Paper: provides a wide range of Material Design-compliant components, with support for custom themes.

  • React Native Material UI: offers Material Design-based components, though less comprehensive than React Native Paper.

  • Integrating Material Design into React Native enhances UI consistency, reduces development time, and allows for theme customization.

    Effective Development and Debugging

    When starting a project in React Native, various modes and tools can be used:

  • React Native CLI: the official tool for creating and managing projects, offering complete control over the development environment.

  • Expo CLI: a solution for starting projects without complex configurations, includes hot-reloading and multi-platform support.

  • EAS (Expo Application Services): a suite of tools for managing builds, distribution, and OTA updates.

  • Metro Bundler: the default bundler for React Native, handles the creation and serving of JavaScript bundles.

  • Visual Studio Code + React Native Tools: extension for debugging and managing builds directly from the editor.

  • Ignite CLI: an advanced toolkit with preconfigured setup and ready-to-use features.

  • Bitrise / App Center: CI/CD platforms to automate build, testing, and distribution.

  • Choosing the right method for your project can be challenging. My experience was characterized by some initial confusion, but over time I found the solutions that best suited my needs.

    Preparing for a Bundle Release

    Creating a bundle for releasing a React Native app often requires the use of native IDEs:

  • Xcode (for iOS): required to configure build settings, manage signing certificates, and create IPA files.

  • Android Studio (for Android): used to configure gradle files, manage signing keys, and create APK or AAB files.

  • Expo EAS Build can simplify some aspects, but native IDEs remain crucial for advanced configurations and final publication.

    Conclusion

    React Native offers significant advantages but is not without challenges. The variety of approaches and tools can be overwhelming, and improving the experience requires good documentation and education.

    If you're looking to save time in development, it's essential to carefully choose the method and tools. Otherwise, native development may be preferable for more centralized documentation and optimal performance. The choice depends on specific needs and your experience with the framework.