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 🙏

© 2024 – Pkg Stats / Ryan Hefner

react-mobile-stack-router

v1.6.3

Published

Made with create-react-library

Downloads

26

Readme

react-mobile-stack-router

NPM JavaScript Style Guide

Use with webview for creation pretty navigation 📱

Navigation like IOS

example

Navigation like Android

example

⭐️⭐️⭐️ Build a beautiful mobile app using React and Webview ⭐️⭐️⭐️

You will get navigation with animation like ios and android without unnecessary things 😏

Introducing "React Mobile Stack Router"

Description

react-mobile-stack-router is a comprehensive React library specifically crafted to provide a robust and feature-rich mobile navigation experience. Utilizing the power of React, this library empowers developers to create dynamic and efficient navigation stacks similar to those found in popular mobile platforms.

Regardless of your mobile application's complexity, react-mobile-stack-router provides an intuitive and efficient solution for managing the navigation stack. Streamline your development process and deliver an exceptional mobile navigation experience to your users with react-mobile-stack-router.

Start implementing react-mobile-stack-router in your React projects today and unlock a new level of mobile navigation prowess!

Install

npm install --save react-mobile-stack-router

or

yarn add react-mobile-stack-router

Usage

One stack of screens

import React from 'react';

import 'react-mobile-stack-router/dist/index.css';
import {
  MobileNavigation,
  Stack,
  StackScreen,
  useStackNavigation,
  useStackParams,
} from 'react-mobile-stack-router';

const FirstScreen = () => {
  const history = useStackNavigation('BaseStack');

  const openSecondScreen = () => {
    history.push('SecondScreen', { id: 1 });
  };

  return (
    <div className='screen'>
      <button onClick={openSecondScreen}>Open second screen</button>
    </div>
  );
};

const SecondScreen = () => {
  const history = useStackNavigation('BaseStack');

  const { id } = useStackParams();

  const openThridScreen = () => {
    history.push('ThirdScreen');
  };

  const backToFirstScreen = () => {
    history.back();
  };

  return (
    <div className='screen'>
      <button onClick={openThridScreen}>Open third screen</button>

      <button onClick={backToFirstScreen}>Back</button>
    </div>
  );
};

const ThridScreen = () => {
  const history = useStackNavigation('BaseStack');

  const backToSecondScreen = () => {
    history.back();
  };

  return (
    <div className='screen'>
      <button onClick={backToSecondScreen}>Back</button>
    </div>
  );
};

const MobileApp = () => {
  return (
    <MobileNavigation>
      <Stack name="BaseStack">
        <StackScreen name="FirstScreen">
          <FirstScreen />
        </StackScreen>

        <StackScreen name="SecondScreen">
          <SecondScreen />
        </StackScreen>

        <StackScreen name="ThirdScreen">
          <ThridScreen />
        </StackScreen>
      </Stack>
    </MobileNavigation>
  );
};

With tab navigation

import React from 'react';

import {
  Tabs,
  Tab,
  Stack,
  StackScreen,
  useMobileNavigation,
} from 'react-mobile-stack-router';

const Navigation = () => {
  const { changeStack } = useMobileNavigation();

  const handleChangeStack = (tabName: string) => {
    changeStack(tabName);
  };

  return (
    <Tabs onChange={handleChangeStack}>
      <Tab name="Main">
        <Stack name="Main" key="Main">
          <StackScreen name="TodoList">
            <FirstScreen />
          </StackScreen>

          <StackScreen name="Todo">
            <SecondScreen />
          </StackScreen>
        </Stack>
      </Tab>

      <Tab name="Settings">
        <Stack name="Settings" key="Settings">
          <StackScreen name="SettingsList">
            <ThirdScreen />
          </StackScreen>

          <StackScreen name="Todo">
            <FourthScreen />
          </StackScreen>
        </Stack>
      </Tab>
    </Tabs>
  );
};

/* App.tsx */
import 'react-mobile-stack-router/dist/index.css';
import {
  MobileNavigation,
  Stack,
  StackScreen,
} from 'react-mobile-stack-router';

const MobileApp = () => {
  return (
    <MobileNavigation>
      <Navigation />
    </MobileNavigation>
  );
};

Platform indication

Default value ios.

You can use Capacitor

import 'react-mobile-stack-router/dist/index.css';
import { MobileNavigation } from 'react-mobile-stack-router';

const MobileApp = () => {
  return (
    <MobileNavigation platform="android">{/* Your app */}</MobileNavigation>
  );
};

See example 👀

Props

| MobileNavigation | | | | | -------- | ------- | ------- | ------- | | Prop | Values | Default Values | Required | | platform | ios, android | ios | true | | children | ReactNode | none | true |

| Stack | | | | | -------- | ------- | ------- | ------- | | Prop | Values | Default Values | Required | | name | string | none | true | | children | ReactNode | none | true | | if Stack in Tab | | | | | key | string | none | true |

| Tabs | | | | | -------- | ------- | ------- | ------- | | Prop | Values | Default Values | Required | | onChange | (tabName: string) => void | none | false |

| Tab | | | | | -------- | ------- | ------- | ------- | | Prop | Values | Default Values | Required | | name | string | none | true | | children | ReactNode | none | true |

| StackScreen | | | | | -------- | ------- | ------- | ------- | | Prop | Values | Default Values | Required | | name | string | none | true | | children | ReactNode | none | true |

| useStackNavigation | | | | | -------- | ------- | ------- | ------- | | Prop | Values | Default Values | Required | | stackName | string | none | true |

License

MIT ©