react native 学习笔记2

1.Layout with Flexbox

flexDirection ('row','column')//取得值为primary axis,另一个为secondary axis

justifyContent ('flex-start', 'flex-end', 'center', 'space-between', 'space-around')

//primary axis上的分布

alignItems ('flex-start', 'flex-end', 'center', 'stretch')

//secondary axis上的分布

2.Handling Text Input

基础组件---TextInput
有两个prop:
onChangeText prop : takes a function to be called every time the text changed

onSubmitEditing prop: takes a function to be called when the text is submitted

  this.setState({text})}

/>

3.Handling Touches

基础组件---Button

Touchable 组件
TouchableHighlight 用户按压按钮,按钮背景变暗。安卓和ios都可以用。
TouchableNativeFeedback 用户按压按钮,按钮震动。安卓用。
TouchableOpacity 用户按压按钮,按钮背景的透明度变为0。安卓和ios都可以用。
TouchableWithoutFeedback.用户按压按钮,无反馈,安卓和ios都可以用。


  
    Touchable with Long Press
  

4.Using a ScrollView
基础组件---
ScrollView :垂直滚动条


    Scroll me plz
    

5.Using List Views

组件---FlatList
有data和renderItem属性,data 是数据源,renderItem是渲染的一条组件,只渲染屏幕上面显示的元素

  
      {item.key}}        
 />

组件---SectionList形成一块数据块,有SectionHeader的情况

  {item}}
    renderSectionHeader={({section}) => {section.title}}
/>

6.Networking
Fetch
aysnc
XMLHttpRequest
websocket

你可能感兴趣的:(react native 学习笔记2)