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

axe-react

v0.1.3

Published

axe using in react-native

Downloads

7

Readme

axe-react

axe interface using in react-native

usage

安装通过 npm

npm install axe-react --save

接口文件

src/index.d.ts

接口声明

main.d.ts文件

数据类型说明

基础数据类型

  • Number : 数字
  • String : 字符串
  • Array: 列表
  • Object : 对象

需要注意,如果要在js模块中使用原生设置的 ArrayObject对象,就要求原生传入的是纯基础数据类型,其中不能设置特殊类型。

特殊类型

  • Image : 图片,js中设置和获取的图片类型为 , data:image/jpeg;base64,xxx 这种形式的URI形式的字符串。
  • Data: 数据类型, 对于ios中的NSData类型。 js中设置和获取的是 base64字符串.
  • Date: 时间类型
  • Boolean:

这里我们实现了 js模块和原生模块之间的特殊类型传递。

Model类型

在Axe中提及的 Model类型,指可以进行序列化,且一般从后台获取的Model类型。

JS中设置的Model类型,是一个Object对象,键值需要是基础数据类型,不能嵌套一些特殊类型。

如果声明了一个model类型, 在设置时,一定要包含所有的key值, 对于空值,一定要设置为null类型。

如,我们在文档中声明了一个model

{
	userName,
}

userName为空时, 必须要设置为null,而不是默认的undefined (使用null值,传递到原生时,会保留model的机构,确保原生模块能够正确访问model的所有属性。) 。 否则原生模块获取时会出错。

如果一个原生模块要传递ModelJS模块,则该Model类型,必须是纯基础数据类型构成,不能包含特殊类型。

注意Event

事件回调是一个闭包, 而闭包会持有对象,容易导致内存泄漏 (当路由跳转时,新页面监听了事件,然后在路由返回到之前页面,则这个监听没有释放,就可能导致内存泄漏,且事件发送时会产生异常)。

目前axe使用的是基于原生导航栏的多页面应用的 react-native模块,所以Event的问题会少一些。

建议注册通知,像demo-test-react中一样,记录状态,避免重复监听!

使用示例

注意事项

  • axe4js接口的区别, axe4js中获取路由信息是异步函数,而在axe-react中,路由信息是固定属性 axe.router.routeInfo
  • axe4js接口区别,提供了一个 navigation工具类,以进行页面跳转和简单的导航栏操作。 因为h5模块暂时是单页面应用, 而 react-native模块是基于原生导航栏的多页面应用。

TODO

  • 优化closePage, 支持传入参数 ,即具体关闭页面的次数,默认为1, 以更好的处理多级页面弹出时,页面的正确关闭。