vn-verdnaturachat/app/views/RoomsListView/ListHeader/SearchBar.js

37 lines
873 B
JavaScript
Raw Normal View History

2019-04-17 18:57:46 +00:00
import React from 'react';
import PropTypes from 'prop-types';
import SearchBox from '../../../containers/SearchBox';
import { isIOS } from '../../../utils/deviceInfo';
2019-12-04 16:39:53 +00:00
import { withTheme } from '../../../theme';
2019-04-17 18:57:46 +00:00
2020-02-13 19:24:39 +00:00
const SearchBar = React.memo(({
theme, onChangeSearchText, inputRef, searching, onCancelSearchPress, onSearchFocus
}) => {
2019-04-17 18:57:46 +00:00
if (isIOS) {
2019-12-04 16:39:53 +00:00
return (
<SearchBox
onChangeText={onChangeSearchText}
testID='rooms-list-view-search'
inputRef={inputRef}
theme={theme}
2020-02-13 19:24:39 +00:00
hasCancel={searching}
onCancelPress={onCancelSearchPress}
onFocus={onSearchFocus}
2019-12-04 16:39:53 +00:00
/>
);
2019-04-17 18:57:46 +00:00
}
return null;
});
SearchBar.propTypes = {
2019-12-04 16:39:53 +00:00
theme: PropTypes.string,
2020-02-13 19:24:39 +00:00
searching: PropTypes.bool,
2019-11-25 20:01:17 +00:00
inputRef: PropTypes.func,
2020-02-13 19:24:39 +00:00
onChangeSearchText: PropTypes.func,
onCancelSearchPress: PropTypes.func,
onSearchFocus: PropTypes.func
2019-04-17 18:57:46 +00:00
};
2019-12-04 16:39:53 +00:00
export default withTheme(SearchBar);