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-navigation-easy-helper

v1.2.2

Published

由于Navigator被官方移除,官方推荐的路由是react-navigation。但使用起来还是有些复杂。本组件旨在不更改源码情况下,简单配置即可实现一些复杂的功能。如在任意位置进行跳转、根据路由名字返回指定页面、简化参数的获取、快速点击的拦截、统一页面跳转的拦截等。

Downloads

24

Readme

react-navigation-easy-helper

由于Navigator被官方移除,官方推荐的路由是react-navigation。但使用起来还是有些复杂。本组件旨在不更改源码情况下,简单配置即可实现一些复杂的功能。如在任意位置进行跳转、根据路由名字返回指定页面、简化参数的获取、快速点击的拦截、统一页面跳转的拦截等。

  • 安装:npm install react-navigation-easy-helper --save or yarn add react-navigation-easy-helper

  • 使用:

      import {configRoute,addToRouteStack,configRoute} from 'react-navigation-easy-helper'
      
      //首先需要在之前的导航配置文件中用configRoute包裹参数
        export const AppNavigator = StackNavigator(
        configRoute({
          LaunchPage: {screen: LaunchPage},
          Test2Page: {screen: Test2Page},
          Test3Page: {screen: Test3Page},
          Test4Page: {screen: Test4Page},
          LoginPage: {screen: LoginPage},
      }), {
          initialRouteName: 'LaunchPage'
      }
     );
      
      //在任意地方就可以这样使用
      RouteHelper.navigate('Test2Page', {params: '我是参数'})
      //返回指定页面
      RouteHelper.goBackTo('Test2Page')
      
      //在注册的页面可以添加回调
       componentDidFocus(){
          console.log('componentDidFocus',arguments)
       }
      
       componentWillBlur(){
          console.log('componentWillBlur',arguments)
       }
      
         //跳转拦截器用法
          let needLoginPage = ['Test3Page'];
                  let noLogin = true;
                  RouteHelper.routeInterceptor = (routeName, params) => {
                      if (noLogin && needLoginPage.indexOf(routeName) !== -1) {
                          // RouteHelper.navigate('LoginPage', {
                          //     routeName,
                          //     params
                          // });
                          RouteHelper.push('LoginPage', {
                              successCallBack: () => {
                                  noLogin = false;
                                  RouteHelper.push(routeName, params)
                              }
                          });
                          return false;
                      }
                      return true
                  };
                  RouteHelper.navigate('Test3Page', {params: '我是参数'})
      
                  //其它具体用法见example
  • 注意点:本组件只是简化一些react-navigation的用法,方法可能不是很完善,如遇到问题,欢迎提issues,如果觉得不错,欢迎star。