@fintoc/fintoc-react-native

中文文档
1.0.3发布于 2025/09/26MITTypeScriptESM + CJS零依赖近 30 天下载 2396

Fintoc React Native

原始使用文档
文档目录5 节
  1. Installation
  2. Usage
  3. TypeScript support
  4. Developing
  5. Acknowledgements

Fintoc React Native

Use the Fintoc widget within your React Native application as a View.

NPM - Version Linters

Installation

Install using npm! (or your favourite package manager)

# Using npm
npm install @fintoc/fintoc-react-native

# Using yarn
yarn add @fintoc/fintoc-react-native

Usage

Fintoc React Native exports a single component called FintocWidgetView. This is a React Native component that creates the same WebView from the native WebView documentation. To use the Fintoc View, use the following snippet:

import { FintocWidgetView } from '@fintoc/fintoc-react-native';

After retrieving the FintocWidgetView component, you are ready to instantiate the widget:

const options = { ... };

const onSuccess = () => {
  console.log('SUCCESS');
};

const onExit = () => {
  console.log('EXIT');
};

export default function FintocWidgetScreen() {
  return (
    <FintocWidgetView
      options={options}
      onSuccess={onSuccess}
      onExit={onExit}
    />
  );
}

Here, options corresponds to an object with the parameters received by the widget (you can read more about these parameters here), and onSuccess and onExit correspond to the WebView redirections detailed here.

Notice that on close the Fintoc View must be unmounted. This is because the widget won't re-open if the Fintoc View isn't re-rendered, so I would recommend unmounting the component on the onClose method of the Fintoc View.

TypeScript support

This package includes TypeScript declarations for the Fintoc View.

Developing

To develop the package, you need to use npm. Install the dependencies:

npm install

To test locally, I recommend packaging the app. Remember to build the library first:

npm run build
npm pack

This will create a fintoc-fintoc-react-native-1.3.1.tgz file (with the corresponding package version). Now, go to another directory and create a React Native app (using Expo, perhaps). After createing the new application, add the following dependency to its package.json file:

{
  "dependencies": {
    ...,
    "@fintoc/fintoc-react-native": "file:./path/to/fintoc-fintoc-react-native-0.3.1.tgz",
    ...
  }
}

Where ./path/to/fintoc-fintoc-react-native-0.3.1.tgz corresponds to the path to the .tgz file created on the npm pack step. After running npm install on the new React Native app, you should be able to use Fintoc React Native to import the Fintoc View.

If you want to create a new release, you can run:

git switch main
npm run bump! <major|minor|patch>

This will create a new branch with the updated version from main.

Acknowledgements

This implementation was written based on the input and experience of @marialuisaclaro integrating the WebView using React Native, which served as a good starting point for the general idea of this library.

版本与发布记录

@fintoc/fintoc-react-native 共发布 8 个版本,首次发布于 2022/03/24;过去 12 个月发布了 0 个版本。

版本发布日期距今
1.0.3latest2025/09/261.1 年前
1.0.22024/05/112 年前
1.0.12024/05/102 年前
1.0.02022/03/314 年前
0.1.12022/03/254 年前
0.1.02022/03/244 年前

关于 @fintoc/fintoc-react-native 的常见问题

@fintoc/fintoc-react-native 是什么?

Fintoc React Native

如何安装 @fintoc/fintoc-react-native?

在项目目录运行 npm install @fintoc/fintoc-react-native,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:react(*)、react-native(*)、react-native-webview(*)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@fintoc/fintoc-react-native 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@fintoc/fintoc-react-native 支持 ESM 还是 CommonJS?

同时提供 ES Module 与 CommonJS 入口,import 和 require() 都可以使用,打包工具会自动选择合适的版本。

@fintoc/fintoc-react-native 可以商用吗?

@fintoc/fintoc-react-native 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@fintoc/fintoc-react-native 的下载量有多少?

根据 npm 官方下载统计,@fintoc/fintoc-react-native 在 2026/10/15 – 2026/11/13 这 30 天内被下载 2,396 次,日均约 80 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@fintoc/fintoc-react-native 还在维护吗?

最新版本 1.0.3 发布于 2025/09/26(1.1 年前);至今共发布 8 个版本,其中过去 12 个月发布了 0 个;首次发布于 2022/03/24。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。