找不到事件分配器的模块

时间:2019-03-22 10:26:05

标签: react-native

import React, { Component } from 'react';
 import { AppRegistry, Text, TextInput, View} from 'react-native';
 import data from './localserver/data';
 import { Dimensions } from 'react-native'
  export default class PizzaTranslator extends Component {

 constructor(props) {
  super(props);
  this.state = {text: ''};

 }
 componentDidMount() {
  let deviceWidth = Dimensions.get('window').width
  console.log('sadas',deviceWidth)
  }

 render() {
  var stylesubash={
  height: 200,
  width:200

   }
  return (
   <View style={{flex: 1, flexDirection: 
   'column',alignItems:'center',justifyContent:'center'}}>
     <TextInput
        style={stylesubash}
        placeholder="Enter your mobile no"
        placeholderTextColor={data.primarysColor}
        maxLength={10}
        keyboardType='number-pad'
      />

     </View>

    );
  }
  }


  AppRegistry.registerComponent('AwesomeProject', () => PizzaTranslator);

My error

我正在尝试获取输出,但是当我运行模拟器时会引发错误 无法找到事件分配器的模块,我也怀疑还有其他方法来获取屏幕尺寸,而不是从react native中导入尺寸

2 个答案:

答案 0 :(得分:1)

delete the project from the simulator and erase all content from the simulator under hardware. make sure debug remotely is off

答案 1 :(得分:0)

我认为您的项目设置有问题,因为我刚刚运行了上面的代码,但没有发现任何问题,因此请设置新项目,这可能会帮助您解决问题。