React Native組件 --NavigatorIOS&TextInput

1.NavigatorIOS

負責(zé)視圖切換的組件;
本質(zhì)上是對UIKit navigation的包裝;

屬性
- barTintColor:導(dǎo)航條的背景顏色
- initialRoute = {{
    component:MyView, 該頁面需要加載的組件視圖
    title:’123456’, 表示需要在頭部顯示的標題
    passProps:{myProp:’foo’},用于頁面間傳遞參數(shù)
    backButtonIcon:Image.propTypes.source,返回按鈕圖標
    backButtonTitle:string,返回按鈕標題
    leftButtonIcon:Image.propTypes.source,左邊按鈕圖標
    leftButtonTitle:string,左邊按鈕標題
    onLeftButtonPress:function,左邊按鈕點擊事件
    rightButtonIcon:Image.propTypes.source,右邊按鈕圖標
    rightButtonTitle:string,右邊按鈕標題
    onRightButtonPress:function,右邊按鈕點擊事件
    wrapperStyle:[object object],包裹樣式
}}

- itemWrapperStyle:為每個定制樣式
- navigationBarHidden:為true時隱藏導(dǎo)航欄
- shadowHidden:是否隱藏陰影
- tintColor:導(dǎo)航欄上的按鈕顏色
- titleTextColor:導(dǎo)航欄上的字體顏色
- translucent:導(dǎo)航欄是否為半透明

- navigator對象:
- push(route):加載一個新的頁面
- pop():返回到上一個頁面
- popN(n):一次返回N個頁面
- replace(route):替換當(dāng)前的導(dǎo)航
- replacePrevious(route):替換前一個頁面的視圖并回退過去
- resetTo(reoute):取代最頂層的導(dǎo)航并且回退過去
- popToTop():回到最上層視圖

2.TextInput

輸入框

屬性
- autoCapitalize:枚舉類型,可選值有:none、sentences、words、characters;提示
- placeholder:占位符
- value:文本輸入框的默認值
- placeholderTextColor:占位符文本的顏色
- password:如果為true,則是密碼框
- multiline:如果為true,則是多行輸入
- editable:如果為false,不可輸入
- autoFocus:為true,將自動聚焦;
- clearButtonMode:枚舉類型,never、while-editing、unless-editing、always;清楚按鈕;
- maxLength:能夠輸入的最長字符數(shù)
- enablesReturnKeyAutomatically:為true,標示沒有文本時鍵盤是不能有返回鍵的;
- returnKeyType:枚舉類型,default、go、google、join、next、route、search、- send、yahoo、done、emergency-call.標示軟鍵盤返回鍵顯示的字符串;
- secureTextEntry:為true時,則像密碼框一樣隱藏輸入內(nèi)容;默認值為false;
- onChangeText:當(dāng)文本輸入發(fā)內(nèi)容變化時,調(diào)用該函數(shù);onChangeText接收一個文本的參數(shù)對象;
- onChange:當(dāng)文本發(fā)生變化時調(diào)用;
- onEndEditing:當(dāng)結(jié)束編輯時調(diào)用;
- onBlur:失去焦點時觸發(fā);
- onFocus:獲取焦點時觸發(fā)
- onSubmitEditing:點擊鍵盤的提交按鈕觸發(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}/>
最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。

推薦閱讀更多精彩內(nèi)容