1
0
mirror of https://github.com/laurent22/joplin.git synced 2024-11-27 08:21:03 +02:00

Fix scroll

Fixed the issue that not permit to view edited text when the keyboard is shown.
This commit is contained in:
marcosvega91 2017-12-19 10:08:22 +01:00
parent 0926755635
commit 98c0f2315a

View File

@ -1,5 +1,5 @@
const React = require('react'); const Component = React.Component;
const { Platform, Keyboard, BackHandler, View, Button, TextInput, WebView, Text, StyleSheet, Linking, Image } = require('react-native');
const { Platform, Keyboard, BackHandler, View, Button, TextInput, WebView, Text, StyleSheet, Linking, Image,KeyboardAvoidingView } = require('react-native');
const { connect } = require('react-redux');
const { uuid } = require('lib/uuid.js');
const { Log } = require('lib/log.js');
@ -51,6 +51,7 @@ class NoteScreenComponent extends BaseScreenComponent {
isLoading: true,
titleTextInputHeight: 20,
alarmDialogShown: false,
heightBumpView:0
};
// iOS doesn't support multiline text fields properly so disable it
@ -148,6 +149,8 @@ class NoteScreenComponent extends BaseScreenComponent {
await shared.initState(this);
this.refreshNoteMetadata();
this.keyboardDidShowListener = Keyboard.addListener('keyboardDidShow', this._keyboardDidShow.bind(this));
this.keyboardDidHideListener = Keyboard.addListener('keyboardDidHide', this._keyboardDidHide.bind(this));
}
refreshNoteMetadata(force = null) {
@ -156,8 +159,22 @@ class NoteScreenComponent extends BaseScreenComponent {
componentWillUnmount() {
BackButtonService.removeHandler(this.backHandler);
this.keyboardDidShowListener.remove();
this.keyboardDidHideListener.remove();
}
_keyboardDidShow () {
this.setState({
heightBumpView:30
})
}
_keyboardDidHide () {
this.setState({
heightBumpView:0
})
}
title_changeText(text) {
shared.noteComponent_change(this, 'title', text);
}
@ -522,7 +539,7 @@ class NoteScreenComponent extends BaseScreenComponent {
);
return (
<View style={this.rootStyle(this.props.theme).root}>
<KeyboardAvoidingView behavior="padding" style={this.rootStyle(this.props.theme).root}>
<ScreenHeader
folderPickerOptions={{
enabled: true,
@ -558,7 +575,8 @@ class NoteScreenComponent extends BaseScreenComponent {
/>
<DialogBox ref={dialogbox => { this.dialogbox = dialogbox }}/>
</View>
<View style={{ height: this.state.heightBumpView }} />
</KeyboardAvoidingView>
);
}