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

mutants-mobile-navigator

v1.0.7

Published

## 模块说明 * 通过HOC组件实现顶部导航 * 支持多种应用页面场景流转

Downloads

17

Readme

mutants-mobile-navigator

模块说明

  • 通过HOC组件实现顶部导航
  • 支持多种应用页面场景流转

依赖模块

  • mutants-microfx
  • mutants-jsbridge

使用HOC组件(代码示例)

import {TopNavPage} from 'mutants-mobile-navigator';
@TopNavPage
class Test extends React.Component<object,object>{

   /**
    * 头部导航栏相关-可重写的方法
    */

    //是否显示导航栏 默认显示
    navShow(){
        return true;
    }
    //设置标题
    navTitle(){
        return 'test';
    }
    //是否显示回退图标 默认显示
    navLeftIcon(){
        return true;
    }
    //回退事件
    navLeftClick(){
       const returnValue = await new Promise(function (resolve) {
        alert('温馨提示', '您确定要退出此应用?', [
            { text: '取消', onPress: () => resolve(false) },
            { text: '确定', onPress: () => resolve(true) },
        ])
       });
       if(returnValue){
         this.pop();
       }
    }
    //是否显示关闭按钮 默认 history.length > 1?true:false; 
    navCloseShow(){

    }

   /**
    * 导航相关 可直接调用
    */

    testPush = ()=>{
        this.push(pagePath, pageParams);
    }

    testReplace = ()=>{
        this.replace(pagePath, pageParams);
    }

    testPop = ()=>{
        this.pop(); //如果栈里只有一个元素,直接closeApp
    }

    testPageParam = ()=>{
        console.log('从前一页面传递过来的参数',this.pageParam());
    }

    //打开新页面,获取值,返回后调用pageBackReceiveResult
    testPushForResult = (pagePath, pageParams = {})=>{
        this.push(pagePath,pageParams);
    }

    //action 返回的key ,result 返回结果
    pageBackReceiveResult(action, result) {
        console.log('action === result=====',action,result);
    }

    //关闭回传值时调用
    testPopAndReturn(action, result) {
        this.popAndReturn(action,result);
    }

}

使用导航工具类

适用场景

非页面组件,无法使用TopNavPage包裹,在普通组件中完成跳转管理

代码示例

import {NavUtils} from 'mutants-mobile-navigator';

//跳转到新页面取值
NavUtils.pushForResult('second',{source:'index'},(action,result)=>{
    console.log('action === result=====',action,result);
});

//关闭页面并返回值  backResultKey可从pageParam中获取
NavUtils.popAndReturn('backResult',{content:'hello world'},pageParam.backResultKey);

//如果栈里只有一个元素,直接closeApp
NavUtils.pop();