1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-11-29 22:48:10 +02:00

Mobile: Fixes #1057: Handle more cases where the title text field disappear

This commit is contained in:
Laurent Cozic
2018-12-29 03:12:23 +01:00
parent 7cfc537870
commit 1b3e0f65e1
4 changed files with 17 additions and 10 deletions

View File

@@ -29,6 +29,10 @@ class NoteBodyViewer extends Component {
}
onLoadEnd() {
setTimeout(() => {
if (this.props.onLoadEnd) this.props.onLoadEnd();
}, 100);
if (this.state.webViewLoaded) return;
// Need to display after a delay to avoid a white flash before
@@ -37,8 +41,6 @@ class NoteBodyViewer extends Component {
if (!this.isMounted_) return;
this.setState({ webViewLoaded: true });
}, 100);
if (this.props.onLoadEnd) this.props.onLoadEnd();
}
shouldComponentUpdate(nextProps, nextState) {

View File

@@ -604,7 +604,9 @@ class NoteScreenComponent extends BaseScreenComponent {
keywords = SearchEngine.instance().allParsedQueryTerms(parsedQuery);
}
bodyComponent = <NoteBodyViewer
// Note: as of 2018-12-29 it's important not to display the viewer if the note body is empty,
// to avoid the HACK_webviewLoadingState related bug.
bodyComponent = !note || !note.body.trim() ? null : <NoteBodyViewer
onJoplinLinkClick={this.onJoplinLinkClick_}
ref="noteBodyViewer"
style={this.styles().noteBodyViewer}
@@ -614,11 +616,11 @@ class NoteScreenComponent extends BaseScreenComponent {
onCheckboxChange={(newBody) => { onCheckboxChange(newBody) }}
onLoadEnd={() => {
setTimeout(() => {
this.setState({ HACK_webviewLoadingState: this.state.HACK_webviewLoadingState + 1 });
this.setState({ HACK_webviewLoadingState: 1 });
setTimeout(() => {
this.setState({ HACK_webviewLoadingState: this.state.HACK_webviewLoadingState + 1 });
this.setState({ HACK_webviewLoadingState: 0 });
}, 50);
}, 50);
}, 5);
}}
/>
} else {