From a2156be4ec506bd14bf9e634164a05f9809c9742 Mon Sep 17 00:00:00 2001 From: Laurent Cozic Date: Sun, 3 Feb 2019 16:57:29 +0000 Subject: [PATCH] Mobile: Fixed search screen --- .../lib/components/global-style.js | 4 ++-- .../lib/components/screens/search.js | 24 ++++++++++++------- 2 files changed, 18 insertions(+), 10 deletions(-) diff --git a/ReactNativeClient/lib/components/global-style.js b/ReactNativeClient/lib/components/global-style.js index 7686d000f..891025a34 100644 --- a/ReactNativeClient/lib/components/global-style.js +++ b/ReactNativeClient/lib/components/global-style.js @@ -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 = { diff --git a/ReactNativeClient/lib/components/screens/search.js b/ReactNativeClient/lib/components/screens/search.js index 547a74c98..daece50b8 100644 --- a/ReactNativeClient/lib/components/screens/search.js +++ b/ReactNativeClient/lib/components/screens/search.js @@ -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) {