我想在我的反应本机项目上显示指南针,我使用这个compas github,我已经遵循了链接上的所有步骤,但是得到了类似于这个错误的错误。我对这件事很陌生。请帮助我或建议其他方式显示指南针的反应-本地人。非常感谢
这是我的密码
从“react”导入React,{Component};从“react本机”导入{ Text、View、StyleSheet、Image、动画片、宽松、维};从‘expo’导入{Location、权限};从“本机-基”导入{容器、标题、内容、}; 导出默认类KompasPage扩展组件{构造函数(支持){超级(支持);this.spinValue =新Animated.Value(0);this.state ={ location: null,//errorMessage: null,标题: null,truenoth: null,timer: false,};} timePass() { this.setState({ this.setState: true });} componentWillMount() {setTimeout()) => { this.timePass();},1000);this._getLocationAsync();} componentWillUpdate() { this.spinValue() } _getLocationAsync = loc () => { //check loc Permission{Permissions.askAsync}= Permissions.askAsync(Permissions.LOCATION);if (status !== check‘){ this.setState({ errorMessage:’访问位置的权限被拒绝‘,});}{ Expo.Location.watchHeadingAsync((obj) => { let标题= obj.magHeading;this.setState({标题:标题}) } };this.setState(){ let start = JSON.stringify(this.spinValue);let start= Math.round(this.state.heading);this.setState= +start;设rotM = rot %360,if (rotM < 180 &(标题> (rotM + 180 )腐烂-= 360,if (rotM >= 180&(标题<= (rotM -180)腐烂+= 360;rot += (标题- rotM) Animated.timing( this.spinValue,{ toValue: rot,持续时间: 300,宽松: Easing.easeInOut } ).start() .start().start(){ const {导航}= this.props.navigation;让LoadingText =‘装载……’;设display = LoadingText;if (this.state.errorMessage) display = this.state.errorMessage;const = this.spinValue.interpolate({ inputRange: 0,360,outputRange:'-0deg‘)‘- 360 360’})显示= Math.round(JSON.stringify(this.spinValue)) if(显示< 0)显示+= 360 if(显示> 360)显示-= 360返回( { display +'°'} <图像大小模式=‘source={require(“./image/kompasbaru.png”)} style={styles.arrow} />;} deviceWidth = Dimensions.get('window').width const deviceHeight = Dimensions.get('window').height const styles =StyleSheet.create(容器:{ flex: 1,alignItems:'center',justifyContent:'center',},文本:{ color:'#263544',fontSize: 80,变换:({translateY:-(deviceHeight/2 -(deviceHeight/2-10) /2 )- 50 }) },imageContainer:{ ...StyleSheet.absoluteFillObject,},arrowContainer:{ ...StyleSheet.absoluteFillObject,},箭头:{宽度: deviceWidth/7,高度: deviceWidth/7,左: deviceWidth /2- (deviceWidth/7)/2,顶部: deviceHeight /2 - (deviceWidth/7)/2,不透明度: 0.9 });
https://stackoverflow.com/questions/51478187
复制相似问题