2021 / 03 / 06
RN版百度语音识别与一个UI组件
预告
好久没跟新过,因为根本没时间了,目前在赶一个项目
本次项目完成后将开源两个组件库,一个是RN版百度语音识别,另一个是UI组件,
Dialog和Toast,Toast其实就是基于react-native-root-toast的,看到这个库使用api的形式展现toast,非常好用,
然后搞了一个对话框也是基于api形式进行展现。
Dialog
- 基于api形式进行展现。
预告图

export interface DialogOptions {
title?: string,
description?: string,
okText?: string,
cancelText?: string,
onOKPress?: () => void;
onCancelPress?: () => void;
onDismiss?: () => void;
destroyDialog?: () => void;
contentView?: React.ElementType;
okTextColor?: string;
cancelTextColor?: string;
}
使用:
Tips.showDialog(TipsType.confirm, {
onCancelPress: this.handleCancelSavePress,
onOKPress: this.handleSavePress,
description: "是否修改保存?",
okText: "保存",
cancelText: "不保存"
});
基本上自定义啥props都行,后面可以改。
其实也是基于其他开源进行改造的,我发现我改完后会与react-native-root-toast冲突,所以干脆合在一起了。
RN版百度语音识别
目前看到这两个库
现在看到这两个库,把这两个库有的功能利用百度语音识别实现。
开源
项目结束后会开源这两个库,可以关注我 github 和 gitee ,我也会在这里说。
百度语音已经开源了,另外一个UI库看时间安排上。
react-native-baidu-asr
react-native-baidu-asr 是一个 React Native 下的百度语音库,可以进行语音识别以及语音唤醒。