最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

解決react-native軟鍵盤彈出擋住輸入框的問(wèn)題

 更新時(shí)間:2019年08月09日 16:30:00   作者:曲小強(qiáng)  
這篇文章主要介紹了解決react-native軟鍵盤彈出擋住輸入框的問(wèn)題,本文通過(guò)實(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);

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

總結(jié)

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

相關(guān)文章

最新評(píng)論

双流县| 永康市| 定安县| 金沙县| 仁化县| 高雄市| 河北区| 建宁县| 环江| 玉溪市| 蓬莱市| 谢通门县| 阿拉善左旗| 合川市| 嘉定区| 富川| 镇沅| 勃利县| 无棣县| 军事| 临海市| 中阳县| 西青区| 台南市| 德格县| 长垣县| 淮阳县| 沾化县| 邹城市| 朝阳市| 抚顺县| 桐乡市| 曲沃县| 宣汉县| 平邑县| 玛多县| 大荔县| 三门峡市| 铅山县| 翁牛特旗| 保山市|