一:快捷鍵
1.讓其自更新----shift+cmd+z 選擇熱更新
2.cmd+r ---重新刷新
3
二:常用規范:
1.文件也是一種組件 所以應該命名規則和組件名的命名規則相同 -----使用首字母大寫 駝峰樣NextPage
三:技巧 :
1.導致listview 出現滾動條解決辦法 設置listview的automaticallyAdjustContentInsets={false}
2.img使用技巧
1:網絡資源
<Image source={{uri:'http://xxxxx/png'}} />
2.本地資源
<Image source={require('image!lealogo')} />
3.背景圖片backgroundImage(一定要設置后面的屬性)
<Image source={require('image!lealogo')} style={{backgroundColor:'transparent'}}>
4.整屏背景<full screen> (先設置包裹flex:1 ,然后圖片也設置flex:1 全部伸縮)
var TestCmp = React.createClass({ render: function() { return ( <View style={styles.imageContainer}> <Image style={styles.image} source={{uri: 'http://lorempixel.com/200/400/sports/5/![enter image description here][2]'}} /> </View> ); }}) var styles = StyleSheet.create({ imageContainer: { flex: 1, alignItems: 'stretch' }, image: { flex: 1 }});
flex布局
- view默認寬度為100%
- flex模擬 column 水平居中用alignItems, 垂直居中用justifyContent 方向為row的相反
- 基於flex能夠實現現有的網格系統需求,且網格能夠各種嵌套無bug
絕對定位和相對定位
和css的標准不同的是, 元素父容器不用設置position:'absolute|relative' . 默認相對於父容器進行位移.
http://www.jianshu.com/p/26dffb845046 自己看吧···
