(一) 设置 Deployment Info
因为默认rn创建为iphone,在ipod打开有大黑边
所以需要 如下配置
(二) 设置 比例函数
如果默认使用rn的配置,会发现在ipad上面显示的很小,这时候需要缩放函数
import { Dimensions } from 'react-native';
const { width, height } = Dimensions.get('window');
// Guideline sizes are based on standard ~5" screen mobile device
const guidelineBaseWidth = 350;
const guidelineBaseHeight = 680;
const scale = size => (width / guidelineBaseWidth) * size;
const verticalScale = size => (height / guidelineBaseHeight) * size;
const moderateScale = (size, factor = 0.5) => size + ((scale(size) - size) * factor); // <-- use this
export {
scale,
verticalScale,
moderateScale,
width,
height,
};