diff --git a/node_modules/react-native-elements/dist/searchbar/SearchBar-android.js b/node_modules/react-native-elements/dist/searchbar/SearchBar-android.js index 1bfd2b4..a4f6f77 100644 --- a/node_modules/react-native-elements/dist/searchbar/SearchBar-android.js +++ b/node_modules/react-native-elements/dist/searchbar/SearchBar-android.js @@ -10,7 +10,7 @@ var __rest = (this && this.__rest) || function (s, e) { return t; }; import React, { Component } from 'react'; -import { StyleSheet, View, ActivityIndicator, Keyboard, } from 'react-native'; +import { StyleSheet, View, ActivityIndicator, } from 'react-native'; import { renderNode } from '../helpers'; import Input from '../input/Input'; import Icon from '../icons/Icon'; @@ -68,24 +68,20 @@ class SearchBar extends Component { }; this.onBlur = (event) => { this.props.onBlur(event); - this.setState({ hasFocus: false }); + this.setState({ hasFocus: false, isEmpty: this.props.value === '' }); }; this.onChangeText = (text) => { this.props.onChangeText(text); this.setState({ isEmpty: text === '' }); }; - this._keyboardDidHide = () => { - this.cancel(); + this.setNativeProps = (nativeProps: object) => { + this.input.setNativeProps && this.input.setNativeProps(nativeProps); }; const { value = '' } = props; this.state = { hasFocus: false, isEmpty: value ? value === '' : true, }; - Keyboard.addListener('keyboardDidHide', this._keyboardDidHide); - } - componentWillUnmount() { - Keyboard.removeListener('keyboardDidHide', this._keyboardDidHide); } render() { var _a; diff --git a/node_modules/react-native-elements/dist/searchbar/SearchBar-ios.js b/node_modules/react-native-elements/dist/searchbar/SearchBar-ios.js index 8fe90be..69ab1ff 100644 --- a/node_modules/react-native-elements/dist/searchbar/SearchBar-ios.js +++ b/node_modules/react-native-elements/dist/searchbar/SearchBar-ios.js @@ -78,6 +78,9 @@ class SearchBar extends Component { this.props.onChangeText(text); this.setState({ isEmpty: text === '' }); }; + this.setNativeProps = (nativeProps: object) => { + this.input.setNativeProps && this.input.setNativeProps(nativeProps); + }; const { value } = props; this.state = { hasFocus: false, @@ -85,6 +88,11 @@ class SearchBar extends Component { cancelButtonWidth: null, }; } + componentDidUpdate(prevProps) { + if (this.props.value !== prevProps.value) { + this.setState({isEmpty: this.props.value === ''}); + } + } render() { var _a, _b, _c, _d, _e, _f, _g; const _h = this.props, { theme, cancelButtonProps, cancelButtonTitle, clearIcon, containerStyle, leftIconContainerStyle, rightIconContainerStyle, inputContainerStyle, inputStyle, placeholderTextColor, showLoading, loadingProps, searchIcon, showCancel } = _h, attributes = __rest(_h, ["theme", "cancelButtonProps", "cancelButtonTitle", "clearIcon", "containerStyle", "leftIconContainerStyle", "rightIconContainerStyle", "inputContainerStyle", "inputStyle", "placeholderTextColor", "showLoading", "loadingProps", "searchIcon", "showCancel"]); diff --git a/node_modules/react-native-elements/dist/searchbar/SearchBar.d.ts b/node_modules/react-native-elements/dist/searchbar/SearchBar.d.ts index 61844a8..a22a37c 100644 --- a/node_modules/react-native-elements/dist/searchbar/SearchBar.d.ts +++ b/node_modules/react-native-elements/dist/searchbar/SearchBar.d.ts @@ -21,6 +21,7 @@ export declare type SearchBarBaseProps = React.ComponentPropsWithRef void; }; export declare type SearchBarProps = SearchBarBaseProps & SearchBarDefaultProps & SearchBarAndroidProps & SearchBarIosProps; declare class SearchBar extends React.Component>> { diff --git a/node_modules/react-native-elements/dist/searchbar/SearchBar.js b/node_modules/react-native-elements/dist/searchbar/SearchBar.js index 43db650..6e8ebf5 100644 --- a/node_modules/react-native-elements/dist/searchbar/SearchBar.js +++ b/node_modules/react-native-elements/dist/searchbar/SearchBar.js @@ -23,6 +23,9 @@ class SearchBar extends React.Component { this.cancel = () => { this.searchbar.cancel && this.searchbar.cancel(); }; + this.setNativeProps = (nativeProps: object) => { + this.searchbar.setNativeProps && this.searchbar.setNativeProps(nativeProps); + }; } render() { const Component = SEARCHBAR_COMPONENTS[this.props.platform] || DefaultSearchBar;