React native 如何在react native中将文本转换为语音?
我正在用react native进行表单验证,我想做一些文本到语音的转换。我安装了这个库React native 如何在react native中将文本转换为语音?,react-native,React Native,我正在用react native进行表单验证,我想做一些文本到语音的转换。我安装了这个库react native speech。但是,当我编译代码时,会出现以下错误(我使用的是Expo): 我的代码是: import Speech from 'react-native-speech'; signIn () { if (this.state.email == "") { Speech.speak({ text: 'Email is required',
react native speech
。但是,当我编译代码时,会出现以下错误(我使用的是Expo):
我的代码是:
import Speech from 'react-native-speech';
signIn () {
if (this.state.email == "") {
Speech.speak({
text: 'Email is required',
voice: 'en_US'
})
return false
}
else {...}
}
.....
<Button onPress={() => this.signIn() }>
Sign in
</Button>
从“react native Speech”导入语音;
签名(){
如果(this.state.email==“”){
讲话({
文本:“需要电子邮件”,
声音:“恩,我们”
})
返回错误
}
否则{…}
}
.....
this.sign()}>
登录
有人知道如何解决这个问题吗
谢谢
import Speech from 'react-native-speech';
signIn () {
if (this.state.email == "") {
Speech.speak({
text: 'Email is required',
voice: 'en_US'
})
return false
}
else {...}
}
.....
<Button onPress={() => this.signIn() }>
Sign in
</Button>