模板版本:v0.2.2
react-native-vconsole
[Github 地址](https://github.com/kafudev/react-native-vconsole)
| 三方库版本 | 支持RN版本 |
|---|---|
| 0.1.11 | 0.72/0.77 |
对于未发布到npm的旧版本,请参考安装指南安装tgz包。
安装与使用
进入到工程目录并输入以下命令:
npm
npm install @kafudev/react-native-vconsole@0.1.11
yarn
yarn add @kafudev/react-native-vconsole@0.1.11
下面的代码展示了这个库的基本使用场景:
使用时 import 的库名不变。
import React from 'react';
import { StyleSheet, View } from 'react-native';
import Vconsole from '@kafudev/react-native-vconsole';
export const ConsoleDemo = () => {
return (
<View style={styles.container}>
<PropsType />
</View>
);
};
function PropsType() {
const appInfo = {
原生构建类型: "1",
原生版本号: "ConfigReader.VERSION_NAME",
原生构建时间: "ConfigReader.BUILD_TIME",
热更新版本号: "codePushStore.info.label",
热更新详情: "codePushStore.info.desc"
}
return (
<View style={styles.container1}>
<Vconsole appInfo={appInfo} console={true} showBtn={true} />
</View>
);
}
const styles = StyleSheet.create({
container: {
position: 'absolute', // 绝对定位
bottom: 180, // 底部边界与父容器底部对齐
width: '100%',
height: 200,
borderWidth: 1,
button: 0
},
container1: {
width: '100%',
height: 200,
borderWidth: 1,
paddingVertical: 20,
button: 0
},
box: {
width: 60,
height: 60,
},
});
约束与限制
兼容性
本文档内容基于以下版本验证通过:
- RNOH: 0.72.29; SDK:HarmonyOS-Next-DB6 5.0.0.61; IDE:DevEco Studio 5.0.3.706; ROM:3.0.0.65;
- RNOH:0.72.33; SDK:OpenHarmony 5.0.0.71(API Version 12 Release); IDE:DevEco Studio 5.0.3.900; ROM:NEXT.0.0.71;
- RNOH: 0.77.17; SDK: HarmonyOS 6.0.0 Release SDK; IDE: DevEco Studio 6.0.0.868; ROM: 6.0.0.112;
属性
"Platform"列表示该属性在原三方库上支持的平台。
"HarmonyOS Support"列为 yes 表示 HarmonyOS 平台支持该属性;no 则表示不支持;partially 表示部分支持。使用方法跨平台一致,效果对标 iOS 或 Android 的效果。
| Name | Description | Type | Required | Platform | HarmonyOS Support |
|---|---|---|---|---|---|
| appInfo | 想要显示的自定义版本信息 | json | no | All | yes |
| console | 是否显示控制台 | boolean | no | All | yes |
| showBtn | 是否显示按钮 | boolean | no | All | yes |
| panels | 自定义面板 | json | no | All | yes |
遗留问题
其他
开源协议
本项目基于 The MIT License (MIT) ,请自由地享受和参与开源