博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
新的博客新技术ReactNative
阅读量:7023 次
发布时间:2019-06-28

本文共 1205 字,大约阅读时间需要 4 分钟。

上代码了

/**

  • Sample React Native App
  • */

'use strict';

import React, {
AppRegistry,
Component,
StyleSheet,
Text,
View,
TouchableOpacity,
} from 'react-native';
class AwesomeProject extends Component {
//构造
constructor(props)
{

super(props);

// 初始状态

this.state = {states:1};

}

customPressHandler = () =>
{
//自定义方法,使用属性来定义

alert('你按下了按钮,当前的状态是'+this.state.states);

};

render() {

return (  
Welcome to React Native 郝建明!
To get started, edit index.ios.js
Press Cmd+R to reload,{'\n'} Cmd+D or shake for dev menu
确定
);

}

}

const styles = StyleSheet.create({

button:

{//   按钮的高度  height:40,  //按钮的宽度  width:100,  //按钮的圆角  borderRadius:20,  //按钮的背景颜色  backgroundColor:'green',  justifyContent:'center',  overflow:'hidden'
},

buttonText:{

textAlign:'center',color:'white'

},

container: {

flex: 1,justifyContent: 'center',alignItems: 'center',backgroundColor: '#F5FCF0'

},

welcome: {

fontSize: 20,textAlign: 'center',margin: 10

},

instructions: {

textAlign: 'center',color: '#333333',marginBottom: 5

},

});

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

转载地址:http://dnvxl.baihongyu.com/

你可能感兴趣的文章
Windows下使用pthread库(GCC CL编译器都可以使用)
查看>>
ASP.NET MVC集成EntLib实现“自动化”异常处理[实现篇]
查看>>
去掉viewstate保持在页面中的一大串字符的方法
查看>>
关于datediff(year,开始日期,结束日期)中year格式的说明,特别注意year两边不能加引号,否则报错...
查看>>
android activity 跳转与值
查看>>
详谈 JQuery Ajax异步处理Json数据
查看>>
从外部拖拽文件
查看>>
Linux简介与厂商版本
查看>>
MongoDB —— 第四篇 索引操作
查看>>
基础才是重中之重~你是否真正在用MVC路由功能~续
查看>>
使用SQL Server的CLR集成
查看>>
第二十三模板 18.2列表容器
查看>>
每日英语:Report: Chinese Consumers Increasingly Divided
查看>>
VC:桌面右击快捷键菜单(CRegKey 、command目录)
查看>>
jQuery学习之---效果
查看>>
Vim as Python IDE on windows - DDL - 博客园
查看>>
是什么让程序员想死的心都有了?
查看>>
enum与int、String之间的转换
查看>>
munmap(解除内存映射)
查看>>
oracle补零 (转)
查看>>