Socket
Socket
Sign inDemoInstall

rn-push

Package Overview
Dependencies
0
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    rn-push

Actually it's just an experiment with scrollview.


Version published
Weekly downloads
0
decreased by-100%
Maintainers
1
Created
Weekly downloads
 

Readme

Source

React Native simplest push from right transition

Actually it's just an experiment with scrollview.

Try it out on Expo Snack!

<img src="https://thumbs.gfycat.com/DependentForsakenAustraliancurlew-size_restricted.gif" />

Why would You use this library?

  1. Super simple codebase
  2. Gesture handling and animation of the fading view are handled on the main thread
  3. Looks natively on ios and android

Caveats

You might still consider using NavigatorIOS because the animation is after all a little bit different - sometimes I think it's worse than in this component and sometimes I think it's better. But the major downside of native navigator is the fact that you can swipe only from the edge and obviously you can't share code with android.

Installation

yarn add rn-push

Usage

This component takes two children components and allows you to navigate between them

import Push from "rn-push";

function App(props) {
    // you can pass color prop (default: #efefef)
  return (
    <Push color="#efefef">
      <Screen />
      <Screen />
    </Push>
  );
}

function Screen(props) {
  return (
    <View>
      <Button title="Next" onPress={() => props.push()} />
      <Button title="Previous" onPress={() => props.pop()} />
    </View>
  );
}

Example that shows how You can pass props to achieve infinite navigation

import Push from "rn-push";

function App(props) {
  return (
    <Push>
      <ViewOne pop={() => props.pop()} />
      <App />
    </Push>
  );
}

function ViewOne(props) {
  return (
    <View>
      <Button title="Next" onPress={() => props.push()} />
      <Button title="Previous" onPress={() => props.pop()} />
    </View>
  );
}

Keywords

FAQs

Last updated on 09 Nov 2017

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc