README
xn-react-native-applets
包含:
- URL配置文件
- 通用头部组件
- 通用关于页面相关逻辑
- 基本方法库
项目结构
|--src 源文件
|--components 组件
|--CommStatusBar 通用statusBar
|--img 静态资源
|--utils 工具文件夹
|--config.js 小程序配置文件
|--index.js 插件导出js文件
|--package.json
|--README.md
如果集成通用头部到目前项目
- 首先导出关于页面
import { AboutScreen } from 'xn-react-native-applets';
// 然后配置到你需要的页面, 路由请自定义
const RootRouteConfig = {
[routers.authLoading]: { screen: AuthLoadingScreen },
[routers.about]: { screen: AboutScreen }, // <-- this
[routers.tabView]: { screen: TabBarStack },
};
- 对首页使用右侧小程序图标, 然后在小程序后侧导入此文件
// 首先导入
import { TopRightView } from 'xn-react-native-applets';
// 然后把配置文件 右侧设置为小程序头部, 这里注意 这里的onPress 只绑定关于页面的事件,
CRM.navigationOptions = ({ navigation }) => ({
title: 'CRM',
headerRight: (
<TopRightView
onPress={() => navigation.navigate(routers.about)}
/>
),
});