解决键盘问题

This commit is contained in:
mx1700 2019-07-28 21:55:27 +08:00
parent 1d3fde97f1
commit 3cf8071977

View file

@ -12,7 +12,8 @@ import {
TouchableWithoutFeedback, TouchableWithoutFeedback,
DeviceEventEmitter, DeviceEventEmitter,
Alert, Alert,
Image Image,
SafeAreaView
} from 'react-native'; } from 'react-native';
import {Navigation} from 'react-native-navigation'; import {Navigation} from 'react-native-navigation';
import KeyboardSpacer from "react-native-keyboard-spacer"; import KeyboardSpacer from "react-native-keyboard-spacer";
@ -26,6 +27,7 @@ import Event from "../util/event";
import NotebookLine from '../component/notebook/notebookLine'; import NotebookLine from '../component/notebook/notebookLine';
import ImageAction from '../component/image/imageAction' import ImageAction from '../component/image/imageAction'
import { getBottomSpace } from 'react-native-iphone-x-helper';
export default class WritePage extends Component { export default class WritePage extends Component {
@ -305,6 +307,7 @@ export default class WritePage extends Component {
render() { render() {
return ( return (
<SafeAreaView style={{flex: 1, backgroundColor: Color.navBackground}}>
<ScrollView style={localStyle.container} <ScrollView style={localStyle.container}
contentContainerStyle={{flex: 1}} contentContainerStyle={{flex: 1}}
keyboardShouldPersistTaps='always'> keyboardShouldPersistTaps='always'>
@ -347,12 +350,13 @@ export default class WritePage extends Component {
</View> </View>
{ {
Api.IS_IOS ? <KeyboardSpacer topSpacing={Api.IS_IPHONEX ? -30 : 0} /> : null Api.IS_IOS ? <KeyboardSpacer topSpacing={-getBottomSpace()} /> : null
} }
{this.renderModal()} {this.renderModal()}
</ScrollView> </ScrollView>
</SafeAreaView>
); );
} }
@ -410,7 +414,7 @@ export default class WritePage extends Component {
this.state.fadeAnimHeight, this.state.fadeAnimHeight,
{ {
toValue: Api.IS_IOS toValue: Api.IS_IOS
? (Api.IS_IPHONEX ? 280 : 250) ? 250
: 260, : 260,
duration: 350, duration: 350,
easing: Easing.out(Easing.cubic) easing: Easing.out(Easing.cubic)
@ -452,7 +456,6 @@ const localStyle = StyleSheet.create({
container: { container: {
flex: 1, flex: 1,
backgroundColor: Color.navBackground, backgroundColor: Color.navBackground,
paddingBottom: Api.IS_IPHONEX ? 30 : 0
}, },
textContent: { textContent: {
flex: 1, flex: 1,