Reactjs 为什么我的复活(React Native)代码不能在Android上运行?
下面是我使用React-Native和React-Native手势处理程序以React-Native编写的代码Reactjs 为什么我的复活(React Native)代码不能在Android上运行?,reactjs,react-native,native,Reactjs,React Native,Native,下面是我使用React-Native和React-Native手势处理程序以React-Native编写的代码 import React, { Component } from 'react'; import { View, Text, StyleSheet, Image, Dimensions } from 'react-native'; import Animated from 'r
import React, { Component } from 'react';
import {
View,
Text,
StyleSheet,
Image,
Dimensions
} from 'react-native';
import Animated from 'react-native-reanimated';
import {TapGestureHandler, State} from 'react-native-gesture-handler';
const { width, height } = Dimensions.get('window');
const {Value, event, block, cond, eq, set} = Animated;
export default class VideoProject extends Component {
constructor(){
super()
this.buttonOpacity = new Value(1);
this.onStateChange = event([
{
nativeEvent: (state) =>
block([cond(eq(state, State.END), set(this.buttonOpacity, 0)
)])
}
]);
}
render(){
return(
<View style={styles.wrapper}>
<View style={styles.background}>
<Image source={require('../../assets/bg.png')}
style={styles.image}/>
</View>
<View style={styles.inputArea}>
<TapGestureHandler onHandlerStateChange={this.onStateChange}>
<Animated.View style={{...styles.button,opacity:this.buttonOpacity}}>
<Text style={{fontSize: 20, fontWeight: 'bold'}}>SIGN IN</Text>
</Animated.View>
</TapGestureHandler>
<TapGestureHandler>
<View style={{...styles.button, backgroundColor: '#2E71DC'}}>
<Text style={{fontSize: 20, fontWeight: 'bold', color: 'white'}}>SIGN IN WITH FACEBOOK</Text>
</View>
</TapGestureHandler>
</View>
</View>
)
}
}
const styles = StyleSheet.create({
wrapper: {
flex: 1,
backgroundColor: 'white',
justifyContent: 'flex-end'
},
background: {
...StyleSheet.absoluteFill,
},
image: {
flex: 1,
height: null,
width: null,
},
inputArea: {
height: height / 3,
justifyContent: 'flex-end',
marginVertical: 20,
/*
backgroundColor: '#64D0FE'
*/
},
button: {
backgroundColor: 'white',
height: 70,
marginHorizontal: 20,
marginVertical: 5,
borderRadius: 35,
alignItems: 'center',
justifyContent: 'center',
}
});
import React,{Component}来自'React';
进口{
看法
文本,
样式表,
形象,,
尺寸
}从“反应本机”;
从“react native reanimated”导入动画;
从“反应本机手势处理程序”导入{TapGestureHandler,State};
const{width,height}=Dimensions.get('window');
const{Value,event,block,cond,eq,set}=动画;
导出默认类VideoProject扩展组件{
构造函数(){
超级()
this.buttonOpacity=新值(1);
this.onStateChange=事件([
{
nativeEvent:(州)=>
块([cond(eq(state,state.END)),集(this.buttonOpacity,0)
)])
}
]);
}
render(){
返回(
登录
使用FACEBOOK登录
)
}
}
const styles=StyleSheet.create({
包装器:{
弹性:1,
背景颜色:“白色”,
justifyContent:“柔性端”
},
背景:{
…样式表。绝对填充,
},
图片:{
弹性:1,
高度:空,
宽度:空,
},
输入区域:{
高度:高度/3,
justifyContent:“柔性端”,
澳门时间:20,,
/*
背景颜色:“#64D0FE”
*/
},
按钮:{
背景颜色:“白色”,
身高:70,
marginHorizontal:20,
第五名:,
边界半径:35,
对齐项目:“居中”,
为内容辩护:“中心”,
}
});
新手反应自然,还没有使用复活库,每当我点击“登录”按钮时,它应该立即消失,没有更多。这只是IOS版的还是我太傻了?提前感谢android上存在一个漏洞,导致0无法运行。将其设置为0.01,您应该会得到相同的效果。仍然不起任何作用,即使将不透明度设置为50%