欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

解決react-native軟鍵盤彈出擋住輸入框的問題

 更新時(shí)間:2019年08月09日 16:30:00   作者:曲小強(qiáng)  
這篇文章主要介紹了解決react-native軟鍵盤彈出擋住輸入框的問題,本文通過實(shí)例圖文相結(jié)合給大家介紹的非常詳細(xì),具有一定的參考借鑒價(jià)值,需要的朋友可以參考下

這是效果:

代碼:

import React, {Component} from 'react';
import { View, Text, Button, StyleSheet, TextInput, ScrollView, KeyboardAvoidingView, Dimensions } from 'react-native';
import { StackActions, NavigationActions, withNavigation } from 'react-navigation';
const {width, height} = Dimensions.get('window');
class ChangePassword extends Component {
 static navigationOptions = {
  headerStyle: {
   elevation: 0, //去除安卓手機(jī)header的樣式
  },
 };
 constructor(props) {
  super(props);
  this.state = {
   isTrue: false,
   text: '',
   text1: '',
  };
 }
 onChangeText = (text1) => {
  this.setState({
   text1
  },()=> {
   if (this.state.text1.length >= 8) {
    this.setState({
     isTrue: true
    })
   } else if (this.state.text1.length < 8) {
    this.setState({
     isTrue: false
    })
   }
  })
 }
 render() {
  return (
   <ScrollView style={styles.container}>
   <KeyboardAvoidingView behavior="position" keyboardVerticalOffset = {120} >
     <Text style={styles.title}>修改密碼</Text>
     <Text style={styles.totst}>密碼為8-16位,須包含數(shù)字、字母2中元素</Text>
      <TextInput
       style={styles.textinput}
       placeholder="請(qǐng)輸入初始密碼"
       placeholderTextColor = "#cccccc"
       maxLength = {16}
       value={this.state.value}
       secureTextEntry = {true}
       onChangeText={(text) => this.setState({text})}
      />
      <Text style={styles.Line}></Text>
      <TextInput
       style={styles.textinput}
       placeholder="請(qǐng)輸入新密碼"
       placeholderTextColor = "#cccccc"
       maxLength = {16}
       secureTextEntry = {true}
       onChangeText={this.onChangeText}
      />
     <Text style={styles.Line}></Text>
     {
      this.state.isTrue == true ? <Text style={styles.errorconfirm} onPress={() => {
       alert('你點(diǎn)擊了確認(rèn),該跳轉(zhuǎn)了!~')
       // this.props.navigation.navigate('ChangePassword')
      }}>確認(rèn)</Text> : <Text style={styles.confirm}>確認(rèn)</Text>
     }
    </KeyboardAvoidingView>
   </ScrollView>
  );
 }
}
const styles = StyleSheet.create({
 container: {
  height: height,
  padding: 16,
 },
 title: {
  color: '#4a4a4a',
  fontSize: 23,
  fontFamily: 'PingFangSC-Semibold',
 },
 totst: {
  color: '#999999',
  fontFamily: 'PingFang-SC-Medium',
  fontSize: 13,
  marginTop: 16,
 },
 Line: {
  height: 1,
  backgroundColor: '#d8d8d8',
 },
 textinput: {
  marginTop: 50,
  color: '#4a4a4a',
  fontSize: 18,
 },
 errorconfirm: {
  marginTop: 44,
  height: 44,
  lineHeight: 44,
  textAlign: 'center',
  fontSize: 16,
  color: '#ffffff',
  backgroundColor: '#25A3FF',
  borderRadius: 4,
 },
 confirm: {
  marginTop: 44,
  height: 44,
  lineHeight: 44,
  textAlign: 'center',
  fontSize: 16,
  color: '#ffffff',
  backgroundColor: '#cccccc',
  borderRadius: 4,
 }
})
export default withNavigation(ChangePassword);

有無用的代碼,可自行刪除,我不會(huì)弄gif的圖 ,要不就配一個(gè)圖了。

總結(jié)

以上所述是小編給大家介紹的解決react-native軟鍵盤彈出擋住輸入框的問題,希望對(duì)大家有所幫助,如果大家有任何疑問請(qǐng)給我留言,小編會(huì)及時(shí)回復(fù)大家的。在此也非常感謝大家對(duì)腳本之家網(wǎng)站的支持!
如果你覺得本文對(duì)你有幫助,歡迎轉(zhuǎn)載,煩請(qǐng)注明出處,謝謝!

相關(guān)文章

  • 詳解Android跨進(jìn)程IPC通信AIDL機(jī)制原理

    詳解Android跨進(jìn)程IPC通信AIDL機(jī)制原理

    本篇文章主要介紹了詳解Android跨進(jìn)程IPC通信AIDL機(jī)制原理,詳細(xì)的介紹了AIDL的概念和使用,具有一定的參考價(jià)值,有興趣的可以了解一下
    2018-01-01
  • Android輔助權(quán)限的介紹和配置完整記錄

    Android輔助權(quán)限的介紹和配置完整記錄

    這篇文章主要給大家介紹了關(guān)于Android輔助權(quán)限的介紹和配置的相關(guān)資料,文中通過示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧
    2019-01-01
  • Android布局之幀布局FrameLayout詳解

    Android布局之幀布局FrameLayout詳解

    這篇文章主要為大家詳細(xì)介紹了Android布局之幀布局FrameLayout ,具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下
    2017-10-10
  • 解決Android Studio 3.0 butterknife:7.0.1配置的問題

    解決Android Studio 3.0 butterknife:7.0.1配置的問題

    下面小編就為大家分享一篇解決Android Studio 3.0 butterknife:7.0.1配置的問題,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。一起跟隨小編過來看看吧
    2017-12-12
  • Android 封裝Okhttp+Retrofit+RxJava,外加攔截器實(shí)例

    Android 封裝Okhttp+Retrofit+RxJava,外加攔截器實(shí)例

    下面小編就為大家分享一篇Android封裝Okhttp+Retrofit+RxJava,外加攔截器實(shí)例,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。一起跟隨小編過來看看吧
    2018-01-01
  • Android RecyclerView布局就這么簡單

    Android RecyclerView布局就這么簡單

    Android RecyclerView布局就這么簡單!RecyclerView比ListView更靈活,更強(qiáng)大,作為一個(gè)android開發(fā)者如果還不知道如何使用android5.X的RecyclerView未免有點(diǎn)說不過去了,本文就為大家講解Android RecyclerView布局,需要的朋友可以參考下
    2016-04-04
  • Android開發(fā)仿咸魚鍵盤DEMO(修改版)

    Android開發(fā)仿咸魚鍵盤DEMO(修改版)

    本文給大家分享一段代碼關(guān)于android開發(fā)高仿咸魚鍵盤修改版的實(shí)例代碼,代碼簡單易懂,非常實(shí)用,需要的朋友參考下吧
    2016-11-11
  • Android 老生常談LayoutInflater的新認(rèn)知

    Android 老生常談LayoutInflater的新認(rèn)知

    今天不想去聊一些Android的新功能,新特性之類的東西,特別想聊一聊這個(gè)老生常談的話題:LayoutInflater,感興趣的朋友來看看吧
    2022-03-03
  • Kotlin掛起函數(shù)應(yīng)用介紹

    Kotlin掛起函數(shù)應(yīng)用介紹

    掛起函數(shù)用狀態(tài)機(jī)以掛起點(diǎn)將協(xié)程的運(yùn)算邏輯拆分成不同的片段,每次執(zhí)行協(xié)程運(yùn)行不同的邏輯片段,由此可以知道協(xié)程是運(yùn)行在線程中的,線程的并發(fā)處理方式也可以用在協(xié)程上
    2022-11-11
  • JNI方法實(shí)現(xiàn)圖片壓縮(壓縮率極高)

    JNI方法實(shí)現(xiàn)圖片壓縮(壓縮率極高)

    這篇文章主要給大家介紹了一種JNI方法實(shí)現(xiàn)圖片壓縮(壓縮率極高)的相關(guān)資料,文中通過示例代碼介紹的非常詳細(xì),對(duì)各位Android開發(fā)者們具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧
    2018-11-11

最新評(píng)論