zhouzhongyuan / qa

Questions recods
MIT License
5 stars 1 forks source link

react-native中的样式 #34

Closed zhouzhongyuan closed 7 years ago

zhouzhongyuan commented 7 years ago

1.简介

2.StyleSheet.create优点

3.使用时的注意点

4.合并规则

用法类似<View style={[styles.base, styles.background]} />,与Object.assign作用相同。

zhouzhongyuan commented 7 years ago

为什么很少见到代码display: 'flex'?

Also, there’s no need to set display: ‘flex’ on React Native because you don’t have any other choice.

不需要多此一举。 所有的组件默认都使用flexbox layout。但是,也有例外,Text组件内部使用text layout。 ——A Mini-Course on React Native Flexbox

zhouzhongyuan commented 7 years ago

react-native默认使用哪种盒模型?

border-box吧(中原说)

height``width的高度单位是什么?

All dimensions(尺寸) in React Native are unitless(无单位的), and represent density-independent pixels.