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

react-native-datatist

v1.0.1

Published

react-native 埋点

Downloads

5

Readme

1. 使用 npm 方式安装 react-native-datatist 模块

对于 React Native 开发的应用,可以使用 npm 方式集成 react-native-datatist 模块。

1.1 npm 安装 react-native-datatist 模块

npm install react-native-datatist

1.2 link react-native-datatist 模块

react-native link react-native-datatist

2. Android 集成

2.1 添加 Android 端原生 SDK 依赖

react-native-datatist 模块 是在 Android 原生 SDK 上的扩展,参照 集成 Android SDK,集成配置SDK 和 插件,SDK 版本号最低为 2.2.7.

2.2 重要配置

react-native-datatist 模块需要在 java 代码中初始化。

在项目继承 Application 的类中,添加DatatistRNModule:

如果自定义的 Application 类名称是MainApplication,则react-native link 命令会在MainApplication 类中自动添加 DatatistRNPackage

private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) {

    @Override
    protected List<ReactPackage> getPackages() {
        return Arrays.asList(
                new MainReactPackage(),
                //添加 DatatistRNModule
                new DatatistRNPackage()
        );
    }

};

3. iOS 集成

如果react-native link react-native-datatist失败

(成功则忽略此步骤),即发现Libraries中没有DatatistRNModule.xcodeproj,则可手动配置:

打开 XCode 工程中, 右键点击 Libraries 文件夹 ➜ Add Files to <...>

去 node_modules ➜ react-native-datatist ➜ ios ➜ 选择 DatatistRNModule.xcodeproj

在工程Build Phases ➜ Link Binary With Libraries中添加libDatatistRNModule.a

4. ReactNative 埋点 Api

埋点示例:

var datatistRNModule = NativeModules.DatatistRNModule;

<Button
    title="登录"
    onPress={() => {
        nativeModule.trackLogin("userId");}
    }
/>

<Button
    title="自定义事件"
    onPress={() => {
        var properties = {shareId: 123, shareType: '热门'};
        datatistRNModule.customerTrack("share", properties);}
    }
/>

1. 自定义事件

参数:

  1. eventName : 事件名
  2. properties : 事件属性(自定义参数)
customerTrack(String eventName,JSONObject properties)

2. 页面采集

您需要在您认为页面发生切换时, 将最新的页面标识和标题名称告诉我们。 调用方法如下。

参数:

  1. url : 页面标识
  2. title :页面标题
trackPageview(String url,String title);

3. 设置用户ID

参数:

  1. userId :用户唯一标识
setUserId(String userId)

4. 设置用户属性

参数:

  1. properties :用户属性
setUserProperties(JSONObject properties);

5. 登录

参数:

  1. uid :用户唯一标识
trackLogin(String uid);

6. 注册

参数:

  1. uid: 用户注册的用户ID
  2. type: 用户类型
  3. authenticated: 是否已认证的标识,值为true/false
trackRegister(String uid,String type,boolean authenticated);

7. 登出

参数:

trackLogout();