react-native开发常用宏义

前端之家收集整理的这篇文章主要介绍了react-native开发常用宏义前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
@H_404_1@// 获取设备屏幕宽 export const widthDevice = Dimensions.get('window').width; // 获取设备屏幕高 export const heightDevice = Dimensions.get('window').height;

注意,获取设备信息时,需要导入Dimensions

@H_404_1@import { Dimensions } from 'react-native';


学习交流:https://gitee.com/potato512/Learn_ReactNative

react-native学习交流QQ群:806870562

猜你在找的React相关文章