|
@@ -16,6 +16,7 @@ import {
|
|
|
TouchableOpacity,
|
|
|
ImageBackground,
|
|
|
TextInput,
|
|
|
+ Keyboard,
|
|
|
Button,
|
|
|
StatusBar,
|
|
|
Modal,
|
|
@@ -34,7 +35,8 @@ export default class PersonalInfoDialog extends Component<Props> {
|
|
|
touch_cancel_color: "white",
|
|
|
touch_cancel_textcolor: "#58A8FA",
|
|
|
input_text: "",
|
|
|
- updateType: 0 //1修改昵称,2修改学校名称
|
|
|
+ updateType: 0, //1修改昵称,2修改学校名称,
|
|
|
+ keyBoardHeight: 0
|
|
|
};
|
|
|
|
|
|
setModalVisible(visible, type) {
|
|
@@ -80,12 +82,39 @@ export default class PersonalInfoDialog extends Component<Props> {
|
|
|
if (this.state.updateType == 1) {
|
|
|
data = { nickName: this.state.input_text };
|
|
|
} else if (this.state.updateType == 2) {
|
|
|
- data = { schoolName: this.state.input_text };
|
|
|
+ data = {
|
|
|
+ schoolName: this.state.input_text
|
|
|
+ };
|
|
|
}
|
|
|
this.props.updateParentState(data);
|
|
|
this.setModalVisible(false);
|
|
|
}
|
|
|
+ componentWillMount() {
|
|
|
+ this.keyboardDidShowListener = Keyboard.addListener(
|
|
|
+ "keyboardDidShow",
|
|
|
+ this._keyboardDidShow
|
|
|
+ );
|
|
|
+ this.keyboardDidHideListener = Keyboard.addListener(
|
|
|
+ "keyboardDidHide",
|
|
|
+ this._keyboardDidHide
|
|
|
+ );
|
|
|
+ }
|
|
|
|
|
|
+ componentWillUnmount() {
|
|
|
+ this.keyboardDidShowListener.remove();
|
|
|
+ this.keyboardDidHideListener.remove();
|
|
|
+ }
|
|
|
+
|
|
|
+ _keyboardDidShow = e => {
|
|
|
+ this.setState({
|
|
|
+ keyBoardHeight: e.endCoordinates.height
|
|
|
+ });
|
|
|
+ };
|
|
|
+ _keyboardDidHide = () => {
|
|
|
+ this.setState({
|
|
|
+ keyBoardHeight: 0
|
|
|
+ });
|
|
|
+ };
|
|
|
render() {
|
|
|
return (
|
|
|
<Modal
|
|
@@ -110,12 +139,13 @@ export default class PersonalInfoDialog extends Component<Props> {
|
|
|
style={{
|
|
|
width: "100%",
|
|
|
height: "20%",
|
|
|
- backgroundColor: "white"
|
|
|
+ backgroundColor: "white",
|
|
|
+ bottom: this.state.keyBoardHeight
|
|
|
}}
|
|
|
>
|
|
|
<View
|
|
|
style={{
|
|
|
- height: 150,
|
|
|
+ height: "100%",
|
|
|
width: "100%",
|
|
|
backgroundColor: "white"
|
|
|
}}
|
|
@@ -156,7 +186,11 @@ export default class PersonalInfoDialog extends Component<Props> {
|
|
|
marginLeft: 5,
|
|
|
fontSize: 20
|
|
|
}}
|
|
|
- onChangeText={text => this.setState({ input_text: text })}
|
|
|
+ onChangeText={text =>
|
|
|
+ this.setState({
|
|
|
+ input_text: text
|
|
|
+ })
|
|
|
+ }
|
|
|
/>
|
|
|
</View>
|
|
|
<View
|
|
@@ -191,7 +225,7 @@ export default class PersonalInfoDialog extends Component<Props> {
|
|
|
style={{
|
|
|
textAlignVertical: "center",
|
|
|
textAlign: "center",
|
|
|
- fontSize: 25,
|
|
|
+ fontSize: 23,
|
|
|
borderRadius: 30,
|
|
|
color: this.state.touchtextcolor
|
|
|
}}
|
|
@@ -219,7 +253,7 @@ export default class PersonalInfoDialog extends Component<Props> {
|
|
|
style={{
|
|
|
textAlignVertical: "center",
|
|
|
textAlign: "center",
|
|
|
- fontSize: 25,
|
|
|
+ fontSize: 23,
|
|
|
color: this.state.touch_cancel_textcolor
|
|
|
}}
|
|
|
>
|