1
0
mirror of https://github.com/laurent22/joplin.git synced 2024-12-24 10:27:10 +02:00

Mobile: Fixed search screen

This commit is contained in:
Laurent Cozic 2019-02-03 16:57:29 +00:00
parent cf427eba0f
commit a2156be4ec
2 changed files with 18 additions and 10 deletions

View File

@ -79,8 +79,8 @@ function addExtraStyles(style) {
};
if (Platform.OS === 'ios') {
style.lineInput.borderBottomWidth = 1;
style.lineInput.borderBottomColor = style.dividerColor;
delete style.lineInput.borderBottomWidth;
delete style.lineInput.borderColor;
}
style.buttonRow = {

View File

@ -71,15 +71,17 @@ class SearchScreenComponent extends BaseScreenComponent {
this.isMounted_ = false;
}
UNSAFE_componentWillReceiveProps(newProps) {
let newState = {};
if ('query' in newProps && !this.state.query) newState.query = newProps.query;
// UNSAFE_componentWillReceiveProps(newProps) {
// console.info('UNSAFE_componentWillReceiveProps', newProps);
if (Object.getOwnPropertyNames(newState).length) {
this.setState(newState);
this.refreshSearch(newState.query);
}
}
// let newState = {};
// if ('query' in newProps && !this.state.query) newState.query = newProps.query;
// if (Object.getOwnPropertyNames(newState).length) {
// this.setState(newState);
// this.refreshSearch(newState.query);
// }
// }
searchTextInput_submit() {
const query = this.state.query.trim();
@ -89,6 +91,9 @@ class SearchScreenComponent extends BaseScreenComponent {
type: 'SEARCH_QUERY',
query: query,
});
this.setState({ query: query });
this.refreshSearch(query);
}
clearButton_press() {
@ -96,6 +101,9 @@ class SearchScreenComponent extends BaseScreenComponent {
type: 'SEARCH_QUERY',
query: '',
});
this.setState({ query: '' });
this.refreshSearch('');
}
async refreshSearch(query = null) {