RN stylesheet calc问题
在RN中不同于常用的less/sass
,有提供对应的calc
计算属性,只能通过获取到宽高做JS
计算。
以设置某个View
宽度为例:
import { Dimensions, View } from 'react-native';
...
const screenWidth = Dimensions.get('window').width;
...
<View style={{ width: screenWidth - 100, backgroundColor: color.pageBg }}></View