TouchableHighlight简单使用

来源:互联网 发布:无限恐怖网络剧 编辑:程序博客网 时间:2024/05/29 17:56

//相当于button使用
<TouchableHighlight
//点击后的背景颜色
underlayColor="#1FB579"
//设置点击事件
onPress={hanwanjie}
style={styleObj.loginButton}>
<Text style={styleObj.loginButtonText}>登录</Text>
</TouchableHighlight>

//登录按钮的点击事件
const hanwanjie = () => {
console.log('点击登录按钮');
}

const styleObj = StyleSheet.create({
//登录按钮样式
loginButton:{
backgroundColor:'#1fd094',
width:screenWidth*0.6,
height:45,
marginTop:30,
alignItems:'center',
borderRadius:8,
},
//登录文字设置
loginButtonText:{
color:'#ffffff',
fontSize:18,
lineHeight:42,
fontWeight:'bold',
},

});

0 0
原创粉丝点击