Giter VIP home page Giter VIP logo

react-native-url-router's Introduction

React Native Url Router

Motivation

React Native Url Router aims to simplify native navigation patterns.

It allows for native navigation UI that feels natural on mobile together with easy navigation by opening URLs.

It exports Stack and Tab Navigators same as react-navigation, but they are usually closely mapped with an app-wide URL structure.

Being designed to work seamlessly with react-router and it should feel immidiately intuitive to people who used react-router on web.

React Router provides the routing logic, route ranking, matching, params support and more.

React Native Url Router provides a powerful new abstraction over a regular web history stack. It also integrates with react-native-screens providing a fully native stack behavior, and relies on react-native-pager-view for swipeable Tabs.

Usage

<StackNavigator>
    <Route
        path="/"
        element={<NavigateWhenFocused to={loggedIn ? "/app" : "/login" replace />}}
    />
    <Route
        path="/login"
        element={
            <>
            {loggedIn && <NavigateWhenFocused to="/app" replace />}
            <Button onPress={() => setLoggedIn(true)} title="Login" />
            </>
        }
    />
    <Route
        path="/app"
        element={
            <>
            {!loggedIn && <NavigateWhenFocused to="/login" replace />}
            <Button onPress={() => setLoggedIn(false)} title="Logout" />
            </>
        }
    />
</StackNavigator>

Installation

For expo:

expo install react-native-url-router react-native-pager-view react-native-screens react-router

For regular react native >=0.60:

yarn add react-native-url-router react-native-pager-view react-native-screens react-router

Also follow https://github.com/software-mansion/react-native-screens#installation for android

Documentation

https://software-mansion-labs.github.io/react-native-url-router/docs/overview

Examples

Check out examples/ for a quick start into using react-native-url-router in your own project.

License

React Native Url Router library is licensed under The MIT License.

react-native-url-router's People

Contributors

aleqsio avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.