Giter Club home page Giter Club logo

react-native-mopsdk's Introduction

FinClip React Native SDK

本项目提供在 React Native 环境中运行小程序的能力

👉 https://www.finclip.com/ 👈


🤔 FinClip 是什么?

有没有想过,开发好的微信小程序能放在自己的 APP 里直接运行,只需要开发一次小程序,就能在不同的应用中打开它,是不是很不可思议?

有没有试过,在自己的 APP 中引入一个 SDK ,应用中不仅可以打开小程序,还能自定义小程序接口,修改小程序样式,是不是觉得更不可思议?

这就是 FinClip ,就是有这么多不可思议!

⚙️ 配置环境

$ npm install react-native-mopsdk --save

🖥 自动安装

$ react-native link react-native-mopsdk

🔨 使用方法

import MopSDK from 'react-native-mopsdk';
import { NativeModules, NativeEventEmitter } from 'react-native';

// 初始化
const eventEmitter = new NativeEventEmitter(NativeModules.FINMopSDK);
  MopSDK.initialize({
    appkey:
      'Ev7QHvml1UcW98Y1GaLfRz34ReffbDESaTXbCoFyKhEm0a3gam0elOOOdZ6Twpa3HkBzlvOwJ2cyhOrMVWuuGw==',
    secret: '16f2d2700453ae51',
    apiServer: 'https://api.finclip.com',
    apiPrefix: '/api/v1/mop/',
    nativeEventEmitter: eventEmitter,
    finMopSDK: NativeModules.FINMopSDK,
  }).then(res => {
    console.log('初始化成功')
  }).catch(err => {
    console.log('初始化失败')
  })

🔨 使用方法

import MopSDK from 'react-native-mopsdk';
import { NativeModules, NativeEventEmitter } from 'react-native';

/**
 * @description Initialize the SDK with specific configurations
 * @param {Object} params - Configuration parameters
 */
MopSDK.initSDK = function(params) {
  return new Promise((resolve, reject) => {
    // 这里假设 params 中已经包含了 config 和 uiConfig
    let { config, uiConfig } = params;

    // 确保 config 和 uiConfig 是有效的对象
    if (!config || typeof config !== 'object' || !uiConfig || typeof uiConfig !== 'object') {
      reject(new Error('Invalid config or uiConfig'));
      return;
    }

    // 调用原生模块的 initSDK 方法
    NativeModules.FINMopSDK.initSDK({ config, uiConfig }).then(res => {
      console.log('SDK 初始化成功');
      resolve(res);
    }).catch(err => {
      console.error('SDK 初始化失败', err);
      reject(err);
    });
  });
};

// 使用示例
const eventEmitter = new NativeEventEmitter(NativeModules.FINMopSDK);
MopSDK.initSDK({
  config: {
    appkey: '您的appkey',
    secret: '您的secret',
    apiServer: 'https://api.finclip.com',
    apiPrefix: '/api/v1/mop/',
    // 其他相关的配置项
  },
  uiConfig: {
    // UI 相关配置
  }
}).then(res => {
  console.log('初始化成功');
}).catch(err => {
  console.log('初始化失败', err);
});

📱 DEMO

点击这里 查看 React Native Demo

📋 接口文档

点击这里 查看 React Native 快速集成文档

🔗 常用链接

以下内容是您在 FinClip 进行开发与体验时,常见的问题与指引信息

☎️ 联系我们

微信扫描下面二维码,关注官方公众号 「凡泰极客」,获取更多精彩内容。

微信扫描下面二维码,加入官方微信交流群,获取更多精彩内容。

react-native-mopsdk's People

Contributors

dependabot[bot] avatar ebwc avatar elric-pp avatar haley-wong avatar jimmy-chung avatar kingswim404 avatar sybarisdev avatar wangzi0218 avatar zhaoyaowang avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

react-native-mopsdk's Issues

No types file

无法找到模块“react-native-mopsdk”的声明文件。

0.72.5版本报错

使用2.0.1,出现Could not set unknown property 'classifier' for task ':react-native-mopsdk:androidSourcesJar' of type org.gradle.api.tasks.bundling.Jar

自行解决了classifier的报错,又出现了Could not find com.finogeeks.lib:finapplet:2.41.11
麻烦对0.70以上的版本进行支持,

gradle: 8.0.1-all
buildToolsVersion = "33.0.0"
minSdkVersion = 21
compileSdkVersion = 33
targetSdkVersion = 33
ndkVersion = "23.1.7779620"

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.