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

bs-react-navigation

v0.2.0

Published

[![Build Status][build-badge]][build] [![Version][version-badge]][package] [![MIT License][license-badge]][license] [![PRs Welcome][prs-welcome-badge]][prs-welcome]

Downloads

20

Readme

bs-react-navigation

Build Status Version MIT License PRs Welcome

A fast, declarative navigation for React Native, based on React Navigation

Status

Currently we are not supporting the nested navigators.

Supported navigators:

Installation

Open a Terminal in your project's folder and run,

yarn add bs-react-navigation

After installation, you will need to install react-navigation and its peer dependencies. Please follow official installation instructions here.

Examples

  • example built-in library - check /example

API

For all navigator you need follow some steps:

Config

First of all, create a config file like Config.re and there define your all routes. It sould be a simple Variant Type with your routes/tabs/items

type route =
  | Home
  | UserDetails;

It is important to create a separate file in order to avoid circular dependencies when you try to import navigation dependencies.

Navigation prop for compoenents

For our components we need to create navigationProp type, which is created from a list of our routes defined in Config.re.

type navigationProp = StackNavigator.navigation(route);

Each Navigator provides their own navitationProp type.

Example:

let make = (~navigation: Config.navigationProp, _children) => {
  ...component,
  render: _self =>
    <View>
      <Button
        title="Go to home screen"
        onPress={() => navigation.push(Home)}
      />
      <Button
        title="Go back"
        onPress={() => navigation.goBack()}
      />
    </View>,
};

StackNavigator

Configuration

Use a functor Create from StackNavigator module and pass a configuration module which needs to include a few pieces:

  • route - list of your routes, use variant from your Config.re
  • initialRoute - the first screen of your navigation state
  • getScreen - it's a function which as a parameters get the currentRoute and navigation props. As a return, you should create a tuple where the first element is a screen component and the second is screen configuration.

Route Params

If your route has a parameter you should pass them to you component inside getScreen function.

exmaple:


let getScreen = (currentRoute, navigation) =>
  switch (currentRoute) {
  | Home => (<Screen navigation />, screenOptions(~title="Home", ()))
  | UserDetails(userId) => (
      <Screen navigation text={"Browsing profile of: " ++ userId} />,
      screenOptions(~title="Hello " ++ userId, ()),
    )
  };

SwitchNavigator

The API for creating navigator is almost the same as in Stack Navigator:

module Switch =
  SwitchNavigator.Create({
    open SwitchNavigator;

    type route = Config.route;

    let initialRoute = Login;

    let getScreen = (currentRoute, navigation) =>
      switch (currentRoute) {
      | Login => (<Login navigation />, screenOptions())
      | LoggedIn => (<LoggedIn navigation />, screenOptions())
      };
  });

TabNavigator

Tab needs one additional setting compared to the Switch or Stack Navigator.

let order: list(tabs);

Full example:

module Tabs =
  TabNavigator.Create({
    open TabNavigator;

    type tabs = Config.tabs;

    let options = options(~activeTintColor="#847", ());

    let order = [Info, Profile, Settings];

    let getTab = tab => {
      switch (tab) {
      | Info => (<Tabs.Info navigation/>, screenOptions(~title="Info"))
      | Profile => (<Tabs.Profile navigation/>, screenOptions(~title="Profile"))
      | Settings => (<Tabs.Settings navigation/>, screenOptions(~title="Settings"))
      };
    };
  });

DrawerNavigator

Drawer needs one additional setting compared to the Switch or Stack Navigator.

let items: list(item);

Full example:

module Drawer =
  DrawerNavigation.Create({
    open DrawerNavigation;
    type item = Config.item;

    let items = [Dashbord, Settings];

    let options = options(~width=150, ());

    let order = [Dashbord, Settings];

    let getItem = currentItem =>
      switch (currentItem) {
      | Dashbord => (<Items.Dashboard />, screenOptions(~title="Info")
      | Settings => (<Items.Settings />, screenOptions(~title="Settings")
      };
  });

Prior art

This library is a continuation of our efforts to provide a first-class navigation for bs-react-native applications.

If you are coming from rebolt-navigation or reroute-native (our previous attempts at solving this problem), please open an issue and let us know. We will help you find the best migration path to adopt this library.

Developing example app

Inside the root folder, run BS build script:

yarn start

next, go to the example app and start the watch script for building the ReasonML code:

yarn watch

The last step is to start the Expo packager inside your example app

yarn start

License

See Reason license in LICENSE.txt.