Javascript 反应本机:未定义不是对象。。。使用';反应本机tts';

Javascript 反应本机:未定义不是对象。。。使用';反应本机tts';,javascript,node.js,reactjs,react-native,npm,Javascript,Node.js,Reactjs,React Native,Npm,我想将文本转换为语音用于我的react本机应用程序,因此我导入了 从“React”导入React; 从“react native”导入{样式表、视图、TouchableHighlight、图像}; 从“反应本机Tts”导入Tts; 导出默认类App扩展React.Component{ 建造师(道具){ 超级(道具); this.\u pressConfig=this.\u pressConfig.bind(this); this.\u pressPlay=this.\u pressPlay.bi

我想将文本转换为语音用于我的react本机应用程序,因此我导入了

从“React”导入React;
从“react native”导入{样式表、视图、TouchableHighlight、图像};
从“反应本机Tts”导入Tts;
导出默认类App扩展React.Component{
建造师(道具){
超级(道具);
this.\u pressConfig=this.\u pressConfig.bind(this);
this.\u pressPlay=this.\u pressPlay.bind(this);
}
_pressConfig(){
控制台日志(“按下”);
}
_pressPlay(){
Tts.speak(“你好世界”);
}
render(){
返回(
);
}
}
我在点击播放按钮时出错:


我已尝试安装、更新、清理。。。每一个npm都有包,但没有任何帮助。有人能帮我解决这个问题吗?我对React-Native完全是新手,因此我非常感谢您的建议。

安装软件包后是否运行了
React-Native链接?@Harlan是的,我执行的步骤与中显示的完全相同。您是否找到了解决方案?奇怪的是,我在任何本机模块中都找不到TextToSpeech文档。我发现了我的错误。项目需要在链接texttospeech模块后进行完全重建。
import React from 'react';
import { StyleSheet, View, TouchableHighlight, Image } from 'react-native';
import Tts from 'react-native-tts';

export default class App extends React.Component {
  constructor(props) {
    super(props);
    this._pressConfig = this._pressConfig.bind(this);
    this._pressPlay = this._pressPlay.bind(this);
  }
  _pressConfig() {
    console.log("pressed");
  }
  _pressPlay() {
    Tts.speak("Hello world");
  }
  render() {
    return (
      <View style={styles.container}>
        <View style={styles.navigation}>
          <TouchableHighlight onPress={this._pressConfig}>
            <Image source={require('./App/img/img_hamburger.png')}
              style={{ width: 30, height: 30 }} />
          </TouchableHighlight>
        </View>
        <View style={styles.content}>
          <TouchableHighlight onPress={this._pressPlay}>
            <Image source={require('./App/img/img_play.png')}
              style={{ width: 100, height: 100 }} />
          </TouchableHighlight>
        </View>
      </View>
    );
  }
}