npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

react-native-awesome-navigation

v0.1.2-beta

Published

native-navigation

Downloads

47

Readme

Introduction (中文)

The react-native-awesome-navigation is a native navigation based on iOS UIViewController and Android Activity/Fragment. The purpose we are doing this is that the popular react-navigation's performance cannot satify our react-navie based application, especially on Android. Thanks to Khan Academy's Our Transition to React Native give us inspiration, we decide to develop this project, and it has been already use in our commercial application, and it will be keep optimizing and updating.

Before you decided to use this, feel free to play the example first, just read this instruct to play example

Installation

yarn add react-native-awesome-navigation

or

npm install react-native-awesome-navigation

Build configuration on Android

Ensure your build files match the following requirements:

  1. (React Native 0.59 and lower) Define the react-native-awesome-navigation project in android/settings.gradle:
...
include ':react-native-awesome-navigation'
project(':react-native-awesome-navigation').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-awesome-navigation/android')
  1. (React Native 0.59 and lower) Add the react-native-awesome-navigation as an dependency of your app in android/app/build.gradle:
...
dependencies {
  ...
  implementation project(':react-native-awesome-navigation')
}

Build configuration on iOS

Using React Native Link (React Native 0.59 and lower)

Run react-native link react-native-awesome-navigation after which you should be able to use this library on iOS.

Documentation

Usage

Put following code in index file or you can also copy following code to individual file and import it in index also works, as you wish.

import { Register, setStyle } from 'react-native-awesome-navigation';
import {Image} from 'react-native'

import Home from './src/Home'
import TabBar from './src/TabBar'
import Setting from './src/Setting'

// setting global style
setStyle({
  hideBackTitle: true,
  hideNavigationBarShadow: true,
  navigationBarColor: '#FFFFFF',
  navigationBarItemColor: 'FF84A9',
  tabBarColor: '#FFFFFF',
  tabBarItemColor: '#FF84A9',
  backIcon: Image.resolveAssetSource(require('./src/image/Profile.png')),
})

Register.beforeRegister()

// register component,and set root page

Register.registerComponent('Home', Home);
Register.registerComponent('Setting', Setting);
Register.registerComponent('TabBar', TabBar)

Register.setRoot({
  root: {
    bottomTabs: {
      children: [
        {
          component: {
            name: 'Home',
            options: {title: '主页', icon: Image.resolveAssetSource(require('./src/image/Home.png'))},
          },
        },
        {
          component: {
            name: 'Setting',
            options: {title: '设置', icon: Image.resolveAssetSource(require('./src/image/Setting.png'))},
          },
        },
      ],
      options: {tabBarModuleName: 'TabBar'},
    },
  },
})

Support native page and RN page mash up Currently offer two native style setting Setting title bar title and whether hide title bar or not

Home.navigationItem = {
  title: 'MainPage',
  hideNavigationBar: false,
}

Navigation

Currently support push, pop, popToRoot, present, dismiss, switchTab

push pass parameter

props.navigator.push('NativeViewController', { title: 'Native' })

push receive parameter

const resp = await props.navigator.push('Detail')

Set value before pop

props.navigator.setResult({qwe: 123})
props.navigator.pop()

pop multi pages (currently only support all push pages not for present pages)

props.navigator.popPages(2) // pop 2 pages

The present is similar with push, the 2nd is a nullable parameter, the 3rd parameter is for config screen and nullable.

props.navigator.present('Present', undefined, {isFullScreen: true})

Like push, support asynchronous

const resp = await props.navigator.present('Present', undefined, {isFullScreen: true})

interface PresentOption {
  isFullScreen?: boolean // Only for iOS, `present` a full screen or not
  isTransparency?: boolean // is transparency background or not
  animated?: boolean // play animation or not
  isTabBarPresented?: boolean // label custom TabBar Prensent or not
}

dismiss present

props.navigator.dismiss()

switchTab is for switch tab to position.

props.navigator.switchTab(0)

Every page will be enrolled their own navigator, navigator have a unique screenID and module name ,through navigator to manipulate page.

Global style(just iOS)

Currently include styles follows,continue updating.

interface GlobalStyle {
  backIcon?: {uri: string} // set back icon
  hideNavigationBarShadow?: boolean // if hide tool bar shadow
  hideBackTitle?: boolean // if hide title next to back icon
  navigationBarColor?: string // tool bar background color
  navigationBarItemColor?: string // tool bar item color
  tabBarColor?: string // tabbar background color
  tabBarItemColor?: string // tabbar picked color
  tabBarDotColor?: string // tabbar dot color
}

Example

setStyle({
  hideBackTitle: true,
  hideNavigationBarShadow: true,
  navigationBarColor: '#FFFFFF',
  navigationBarItemColor: 'FF84A9',
  tabBarColor: '#FFFFFF',
  tabBarItemColor: '#FF84A9',
  backIcon: Image.resolveAssetSource(CloseIcon),
})

Toolbar can be set Badge as well.

setTabBadge([
  {
    index: 0,
    hidden: false,
    dot: true,
  },
  {
    index: 1,
    text: '1199',
    hidden: false,
  },
])
export interface TabBadge {
  index: number
  hidden: boolean
  text?: string
  dot?: boolean
}

Color is only support hexadecimal string, not support color string like 'red'.

Lifecycle

Each page has their own hooks to check if the page is focused.

useVisibleEffect(
    props.screenID,
    useCallback(() => {
      console.log(`${props.screenID} is visible`)
      return () => {
        console.log(`${props.screenID} is gone`)
      }
    }, [])
  )

Support DeepLink(just iOS)

Adding route when register

Register.registerComponent('Home', Home, '/home')
Register.registerComponent('Setting', Setting)

Activiting at first page

  useEffect(() => {
    router.activate('hulaqinzi://')
    return () => {
      router.inactivate()
    }
  }, [])
Router.open('hulaqinzi://home?key=value')

Link address will be parsed as /home,paramter {key: value},and push to Home page and pass parameter.

hooks

useResult

This is for pass parameter when a page pop back.

  useResult(props.screenID, (data) => {
    console.log(data);
  })

Type can be return ok or cancel.

Ok means back with value,cancel normal back.

Data is back value.

useReClick

Resopse click tabbar repeatly,this is only for each tab bar first page. (iOS only)

  useReClick(props.screenID, () => {
    console.log('reclick');
  })

Contributing

See the contributing guide to learn how to contribute to the repository and the development workflow.

Logo designed by jemastock / Freepik

License

MIT LISCENSE