您的位置:首页 > Web前端 > React

react-native控件

2016-12-28 17:52 417 查看

1用法

导入 'react-native'组件如下:

(1)写法1

import {

Image,

TextInput,

View,

Button,

Text,Alert,

StyleSheet

} from 'react-native';

(2)写法2

const ReactNative = require('react-native'); //定义导入地址

const {

Alert,

Button

} = ReactNative; //导入

Button

资料地址:https://github.com/reactnativecn/react-native.cn/blob/stable/docs/docs/0.39/button.md

简单实例:

/**

* 方法

*/

const logout = () => {

Alert.alert('退出账户!');

};

export default class Personal extends Component {

render() {

return (

<View>

<Button

onPress={logout}

title="退出账户"

color="#841584"

accessibilityLabel="Learn more about this purple button"

/>

</View>

);

}

}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: