From b803984773b385e9165688fd14fb4faa983b5175 Mon Sep 17 00:00:00 2001 From: Laurent Cozic Date: Mon, 20 Apr 2020 22:31:21 +0000 Subject: [PATCH] Android: Fixes #3041: Fixed text scrolling issue on older devices --- .../lib/components/screens/note.js | 20 ++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/ReactNativeClient/lib/components/screens/note.js b/ReactNativeClient/lib/components/screens/note.js index 17c457b23..4607889fb 100644 --- a/ReactNativeClient/lib/components/screens/note.js +++ b/ReactNativeClient/lib/components/screens/note.js @@ -1,5 +1,5 @@ const React = require('react'); -const { Platform, Clipboard, Keyboard, View, TextInput, StyleSheet, Linking, Image, Share, Dimensions } = require('react-native'); +const { Platform, Clipboard, Keyboard, View, TextInput, StyleSheet, Linking, Image, Share } = require('react-native'); const { connect } = require('react-redux'); const { uuid } = require('lib/uuid.js'); const { MarkdownEditor } = require('../../../MarkdownEditor/index.js'); @@ -210,17 +210,21 @@ class NoteScreenComponent extends BaseScreenComponent { if (this.styles_[cacheKey]) return this.styles_[cacheKey]; this.styles_ = {}; - const dimensions = Dimensions.get('window'); - // TODO: Clean up these style names and nesting const styles = { bodyTextInput: { flex: 1, paddingLeft: theme.marginLeft, paddingRight: theme.marginRight, + // Add extra space to allow scrolling past end of document, and also to fix this: // https://github.com/laurent22/joplin/issues/1437 - paddingBottom: Math.round(dimensions.height / 4), + // 2020-04-20: removed bottom padding because it doesn't work properly in Android + // Instead of being inside the scrollable area, the padding is outside thus + // restricting the view. + // See https://github.com/laurent22/joplin/issues/3041#issuecomment-616267739 + // paddingBottom: Math.round(dimensions.height / 4), + textAlignVertical: 'top', color: theme.color, backgroundColor: theme.backgroundColor, @@ -968,7 +972,13 @@ class NoteScreenComponent extends BaseScreenComponent { }} /> - : ( + : + // Note: In theory ScrollView can be used to provide smoother scrolling of the TextInput. + // However it causes memory or rendering issues on older Android devices, probably because + // the whole text input has to be in memory for the scrollview to work. So we keep it as + // a plain TextInput for now. + // See https://github.com/laurent22/joplin/issues/3041 + ( this.body_changeText(text)} blurOnSubmit={false} selectionColor={theme.textSelectionColor} keyboardAppearance={theme.keyboardAppearance} placeholder={_('Add body')} placeholderTextColor={theme.colorFaded} /> ); }