aliyun-rn-mobi-sdk
v0.1.1
Published
`aliyun-rn-mobi-sdk` 是一个用于 React Native 的 WebView 组件封装,支持与 Web 内容进行交互。
Readme
aliyun-rn-mobi-sdk
aliyun-rn-mobi-sdk 是一个用于 React Native 的 WebView 组件封装,支持与 Web 内容进行交互。
安装
npm install aliyun-rn-mobi-sdk快速开始
import React from 'react';
import { MobiCopilotWebView } from 'aliyun-rn-mobi-sdk';
const MyApp = () => (
<MobiCopilotWebView
handlerNavigateTo={(routerKey, params) => console.log('Navigate to:', routerKey, params)}
hanlderMobiErrorWithCode={(code, message) => console.error('Error:', code, message)}
source={{ uri: 'https://mobi-runtime-url.com' }}
accessToken=""
style={{ flex: 1 }}
/>
);
export default MyApp;组件属性
| 属性名 | 类型 | 说明 |
|-----------|------|-------------|
| handlerNavigateTo | (routerKey: string, params?: Record<string, any>) => void | 处理导航请求。 |
| hanlderMobiErrorWithCode | (code: MobiErrorCode, message: string) => void | 处理错误信息。 |
| handlerMobiNavigateErrorWithRouterKey | (routerKey: string, code: MobiErrorCode, message: string) => void | 处理导航错误。 |
| accessToken | string | 传递身份验证令牌,开发环境无需传递 |
| ...others | WebViewProps | 其他 WebView 属性。 |
