All Projects → software-mansion → React Native Screens

software-mansion / React Native Screens

Licence: mit
Native navigation primitives for your React Native app.

Programming Languages

typescript
32286 projects
objective c
16641 projects - #2 most used programming language
kotlin
9241 projects
javascript
184084 projects - #8 most used programming language
C++
36643 projects - #6 most used programming language
java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to React Native Screens

React Native Redux Navigation
A demo use react-navigation and redux。[Thx for your star !!!]
Stars: ✭ 40 (-98.14%)
Mutual labels:  react-navigation
Mchat
RN生态学习
Stars: ✭ 101 (-95.3%)
Mutual labels:  react-navigation
React Native Navigation Animation
Transition navigation component for React Native
Stars: ✭ 133 (-93.81%)
Mutual labels:  react-navigation
Mobile Boilerplate
React Native boilerplate (TypeScript, MobX-State-Tree, NativeBase, React Navigation, Enzyme) by Prominent Edge
Stars: ✭ 57 (-97.35%)
Mutual labels:  react-navigation
Lego Expo
Play with Lego bricks anywhere using Expo
Stars: ✭ 65 (-96.97%)
Mutual labels:  react-navigation
Jmusic
重构一款音乐app
Stars: ✭ 108 (-94.97%)
Mutual labels:  react-navigation
React Native Boilerplate
🚀 React Native Boilerplate Updated
Stars: ✭ 9 (-99.58%)
Mutual labels:  react-navigation
React Native Feature Boilerplate
Feature based Architecture for developing Scalable React Native Apps 🚀 using react, redux, sagas and hooks
Stars: ✭ 139 (-93.53%)
Mutual labels:  react-navigation
Book Of Spices
An educational app to help you learn about spices, built on top of react-native, react-native-navigation from wix and lottie-react-native for animations.
Stars: ✭ 94 (-95.62%)
Mutual labels:  react-navigation
React Navigation Magic Move
Bindings for using react-navigation with react-native-magic-move 🐰🎩✨
Stars: ✭ 132 (-93.85%)
Mutual labels:  react-navigation
Dooboo Native Ts
Complete boilerplate for react-native app. Contains, typescript, react-hook, context-api, ts-jest, localization, navigation and etc.
Stars: ✭ 61 (-97.16%)
Mutual labels:  react-navigation
Re Navigate
Example of React Native Navigation with re-frame/re-natal
Stars: ✭ 61 (-97.16%)
Mutual labels:  react-navigation
Rnexample
一个基于mobx、react-navigation、teaset的react-native框架
Stars: ✭ 114 (-94.69%)
Mutual labels:  react-navigation
Bs React Navigation
A fast, declarative navigation for React Native, based on React Navigation
Stars: ✭ 55 (-97.44%)
Mutual labels:  react-navigation
Yaba Social
Yet Another Boilerplate App showing off react-navigation and the excellent new tools from Apollo
Stars: ✭ 133 (-93.81%)
Mutual labels:  react-navigation
React Native Workshop
Prototyping Airbnb with React Native
Stars: ✭ 21 (-99.02%)
Mutual labels:  react-navigation
Reactnativeauth
Mobile user authentication flow with React Native, Expo, and AWS Amplify: Sign In, Sign Up, Confirm Sign Up, Forget Password, Reset Password.
Stars: ✭ 108 (-94.97%)
Mutual labels:  react-navigation
Typescript React Native Starter
A highly scalable foundation with a focus on best pratices and simplicity to start your React Native project in seconds.
Stars: ✭ 141 (-93.44%)
Mutual labels:  react-navigation
React Native Boilerplate
A React Native boilerplate with Expo, Redux, React Navigation, Styled Components and some 💕 included.
Stars: ✭ 135 (-93.72%)
Mutual labels:  react-navigation
Expo Disneyplus
Disney+ UI Clone with React Native & Expo
Stars: ✭ 130 (-93.95%)
Mutual labels:  react-navigation

React Native Screens by Software Mansion

This project aims to expose native navigation container components to React Native. It is not designed to be used as a standalone library but rather as a dependency of a full-featured navigation library.

Supported platforms

  • iOS
  • Android
  • tvOS
  • Windows
  • Web

Installation

iOS

Installation on iOS should be completely handled with auto-linking, if you have ensured pods are installed after adding this module, no other actions should be necessary

Android

On Android the View state is not persisted consistently across Activity restarts, which can lead to crashes in those cases. It is recommended to override the native Android method called on Activity restarts in your main Activity, to avoid these crashes.

For most people using an app built from the react-native template, that means editing MainActivity.java, likely located in android/app/src/main/java/<your package name>/MainActivity.java

You should add this code, which specifically discards any Activity state persisted during the Activity restart process, to avoid inconsistencies that lead to crashes.

import android.os.Bundle;

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(null);
}

For people that must handle cases like this, there is a more detailed discussion of the difficulties in a series of related comments.

Need to use a custom Kotlin version?

Since v3.6.0 react-native-screens has been rewritten with Kotlin. Kotlin version used in this library defaults to 1.4.10.

If you need to use a different Kotlin version, set kotlinVersion ext property in your project's android/build.gradle and the library will use this version accordingly:

buildscript {
    ext {
        ...
        kotlinVersion = "1.4.10"
    }
}

Disclaimer: react-native-screens requires Kotlin 1.3.50 or higher.

Windows

Installation on Windows should be completely handled with auto-linking when using React Native Windows 0.63+. For earlier versions, you must manually link the native module.

How can I take advantage of that?

Screens are already integrated with the React Native's most popular navigation library react-navigation and Expo.

Supported react-native version

version react-native version
3.0.0+ 0.62.0+
2.0.0+ 0.60.0+

Usage with react-navigation

Screens support is built into react-navigation starting from version 2.14.0 for all the different navigator types (stack, tab, drawer, etc).

To configure react-navigation to use screens instead of plain RN Views for rendering screen views, simply add this library as a dependency to your project:

# bare React Native project
yarn add react-native-screens

# if you use Expo managed workflow
expo install react-native-screens

Just make sure that the version of react-navigation you are using is 2.14.0 or higher.

You are all set 🎉 – when screens are enabled in your application code react-navigation will automatically use them instead of relying on plain React Native Views.

Experimental support for react-freeze

You have to use React Native 0.64 or higher, react-navigation 5.x or 6.x and react-native-screens >= v3.9.0

Since v3.9.0, react-native-screens comes with experimental support for react-freeze. It uses the React Suspense mechanism to prevent parts of the React component tree from rendering, while keeping its state untouched.

To benefit from this feature, enable it in your entry file (e.g. App.js) with this snippet:

import { enableFreeze } from 'react-native-screens';

enableFreeze(true);

Want to know more? Check out react-freeze README

Found a bug? File an issue here or directly in react-freeze repository.

Disabling react-native-screens

If, for whatever reason, you'd like to disable native screens support and use plain React Native Views add the following code in your entry file (e.g. App.js):

import { enableScreens } from 'react-native-screens';

enableScreens(false);

You can also disable the usage of native screens per navigator with detachInactiveScreens.

Using createNativeStackNavigator with React Navigation

To take advantage of the native stack navigator primitive for React Navigation that leverages UINavigationController on iOS and Fragment on Android, please refer:

Interop with react-native-navigation

React-native-navigation library already uses native containers for rendering navigation scenes so wrapping these scenes with <ScreenContainer> or <Screen> component does not provide any benefits. Yet if you would like to build a component that uses screens primitives under the hood (for example a view pager component) it is safe to use <ScreenContainer> and <Screen> components for that as these work out of the box when rendered on react-native-navigation scenes.

Interop with other libraries

This library should work out of the box with all existing react-native libraries. If you experience problems with interoperability please report an issue.

Guide for navigation library authors

If you are building a navigation library you may want to use react-native-screens to have control over which parts of the React component tree are attached to the native view hierarchy. To do that, react-native-screens provides you with the components documented here.

Common problems

Problems with header on iOS

Solution

Use ScrollView with prop contentInsetAdjustmentBehavior=“automatic” as a main container of the screen and set headerTranslucent: true in screen options.

Other problems

Problem Solution
SVG component becomes transparent when goBack related PRs
Memory leak while moving from one screen to another in the same stack explanation
LargeHeader stays small after pop/goBack/swipe gesture on iOS 14+ potential fix

Contributing

There are many ways to contribute to this project. See CONTRIBUTING guide for more information. Thank you for your interest in contributing!

License

React native screens library is licensed under The MIT License.

Credits

This project has been build and is maintained thanks to the support from Shopify, Expo.io and Software Mansion

shopify expo swm

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].