react-native控件

前端之家收集整理的这篇文章主要介绍了react-native控件前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

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> ); } }

原文链接:https://www.f2er.com/react/305140.html

猜你在找的React相关文章