修复一个崩溃问题

This commit is contained in:
mx1700 2019-08-22 21:51:10 +08:00
parent 6be0a4c3c3
commit 456e7261e8

View file

@ -115,7 +115,7 @@ export default class WritePage extends Component {
this.loadNotebook().then(notebookCount => { this.loadNotebook().then(notebookCount => {
if(notebookCount > 0) { if(notebookCount > 0) {
InteractionManager.runAfterInteractions(() => { InteractionManager.runAfterInteractions(() => {
this.contentInput.focus(); this && this.contentInput && this.contentInput.focus();
}); });
} else { } else {
Alert.alert('提示', '没有可用日记本,无法写日记',[ Alert.alert('提示', '没有可用日记本,无法写日记',[
@ -171,7 +171,7 @@ export default class WritePage extends Component {
this.setState({modalVisible: false}, () => { this.setState({modalVisible: false}, () => {
setTimeout(() => { setTimeout(() => {
if(showKeyboard) { if(showKeyboard) {
this.contentInput.focus() this && this.contentInput && this.contentInput.focus()
} else { } else {
if(typeof callback == 'function') { if(typeof callback == 'function') {
callback(); callback();