1.NavigatorIOS
負(fù)責(zé)視圖切換的組件问慎;
本質(zhì)上是對UIKit navigation的包裝;
屬性
- barTintColor:導(dǎo)航條的背景顏色
- initialRoute = {{
component:MyView, 該頁面需要加載的組件視圖
title:’123456’, 表示需要在頭部顯示的標(biāo)題
passProps:{myProp:’foo’},用于頁面間傳遞參數(shù)
backButtonIcon:Image.propTypes.source,返回按鈕圖標(biāo)
backButtonTitle:string,返回按鈕標(biāo)題
leftButtonIcon:Image.propTypes.source,左邊按鈕圖標(biāo)
leftButtonTitle:string,左邊按鈕標(biāo)題
onLeftButtonPress:function,左邊按鈕點(diǎn)擊事件
rightButtonIcon:Image.propTypes.source,右邊按鈕圖標(biāo)
rightButtonTitle:string,右邊按鈕標(biāo)題
onRightButtonPress:function,右邊按鈕點(diǎn)擊事件
wrapperStyle:[object object],包裹樣式
}}
- itemWrapperStyle:為每個(gè)定制樣式
- navigationBarHidden:為true時(shí)隱藏導(dǎo)航欄
- shadowHidden:是否隱藏陰影
- tintColor:導(dǎo)航欄上的按鈕顏色
- titleTextColor:導(dǎo)航欄上的字體顏色
- translucent:導(dǎo)航欄是否為半透明
- navigator對象:
- push(route):加載一個(gè)新的頁面
- pop():返回到上一個(gè)頁面
- popN(n):一次返回N個(gè)頁面
- replace(route):替換當(dāng)前的導(dǎo)航
- replacePrevious(route):替換前一個(gè)頁面的視圖并回退過去
- resetTo(reoute):取代最頂層的導(dǎo)航并且回退過去
- popToTop():回到最上層視圖
2.TextInput
輸入框
屬性
- autoCapitalize:枚舉類型倡勇,可選值有:none、sentences挣棕、words译隘、characters;提示
- placeholder:占位符
- value:文本輸入框的默認(rèn)值
- placeholderTextColor:占位符文本的顏色
- password:如果為true亲桥,則是密碼框
- multiline:如果為true,則是多行輸入
- editable:如果為false固耘,不可輸入
- autoFocus:為true题篷,將自動(dòng)聚焦;
- clearButtonMode:枚舉類型厅目,never番枚、while-editing、unless-editing损敷、always葫笼;清楚按鈕;
- maxLength:能夠輸入的最長字符數(shù)
- enablesReturnKeyAutomatically:為true拗馒,標(biāo)示沒有文本時(shí)鍵盤是不能有返回鍵的路星;
- returnKeyType:枚舉類型,default诱桂、go洋丐、google、join挥等、next友绝、route、search肝劲、- send迁客、yahoo、done辞槐、emergency-call.標(biāo)示軟鍵盤返回鍵顯示的字符串掷漱;
- secureTextEntry:為true時(shí),則像密碼框一樣隱藏輸入內(nèi)容催蝗;默認(rèn)值為false切威;
- onChangeText:當(dāng)文本輸入發(fā)內(nèi)容變化時(shí),調(diào)用該函數(shù)丙号;onChangeText接收一個(gè)文本的參數(shù)對象先朦;
- onChange:當(dāng)文本發(fā)生變化時(shí)調(diào)用;
- onEndEditing:當(dāng)結(jié)束編輯時(shí)調(diào)用犬缨;
- onBlur:失去焦點(diǎn)時(shí)觸發(fā)喳魏;
- onFocus:獲取焦點(diǎn)時(shí)觸發(fā)
- onSubmitEditing:點(diǎn)擊鍵盤的提交按鈕觸發(fā);
<TextInput style = {styles.inputs}
returnKeyType = "search"
placeholder = "請輸入關(guān)鍵字"
EndEditing = {this.hide.bind(this,this.state.value)}
value = {this.state.value}
onChangeText = {this.getValue}/>