模块RCTEventEmitter不是在react native中注册的可调用模块(调用receiveTouches)

时间:2019-05-29 17:12:38

标签: react-native react-native-android

我试图为npm中的react-native安装一个图像幻灯片附加组件。这是指向it的链接 。

然后我使用react-native run-android

从文档中运行以下代码
import React, {Component} from 'react';
import {Platform, StyleSheet, Text, View} from 'react-native';
import Slideshow from 'react-native-slideshow';

export default class App extends Component {

  constructor(props) {
    super(props);

    this.state = {
      position: 1,
      interval: null,
      dataSource: [
        {
          title: 'Title 1',
          caption: 'Caption 1',
          url: 'http://placeimg.com/640/480/any',
        }, {
          title: 'Title 2',
          caption: 'Caption 2',
          url: 'http://placeimg.com/640/480/any',
        }, {
          title: 'Title 3',
          caption: 'Caption 3',
          url: 'http://placeimg.com/640/480/any',
        },
      ],
    };
  }

  componentWillMount() {
    this.setState({
      interval: setInterval(() => {
        this.setState({
          position: this.state.position === this.state.dataSource.length ? 0 : this.state.position + 1
        });
      }, 2000)
    });
  }

  componentWillUnmount() {
    clearInterval(this.state.interval);
  }

  render() {
    return (
      <View>
        <Slideshow
          dataSource={this.state.dataSource}
          position={this.state.position}
          onPositionChanged={position => this.setState({ position })} 
        />
      </View>
    );
  }
}

构建后,我得到一个白色的屏幕,当触摸它时,屏幕将显示以下错误窗口:

error page in android

如何摆脱这个错误?

0 个答案:

没有答案