react-native-complete-flatlist
Advanced tools
Comparing version 1.1.21 to 1.1.22
26
index.js
@@ -91,5 +91,8 @@ import React, { Component } from "react"; | ||
pullToRefreshCallback, | ||
isRefreshing, | ||
backgroundStyles, | ||
searchBarBackgroundStyles | ||
searchBarBackgroundStyles, | ||
onSearch | ||
} = this.props; | ||
const { searchText } = this.state | ||
const filteredData = this.filterText(); | ||
@@ -111,4 +114,6 @@ if (filteredData.length === 0) { | ||
onChangeText={searchText => this.setState({ searchText })} | ||
value={this.state.searchText} | ||
value={searchText} | ||
maxLength={100} | ||
returnKeyType='search' | ||
onSubmitEditing={() => onSearch ? onSearch() : null} | ||
/> | ||
@@ -127,8 +132,15 @@ </View> | ||
refreshControl={ | ||
pullToRefreshCallback !== null ? ( | ||
onSearch !== null ? ( | ||
<RefreshControl | ||
refreshing={this.props.isRefreshing} | ||
onRefresh={this.props.pullToRefreshCallback} | ||
refreshing={isRefreshing} | ||
onRefresh={() => onSearch(searchText)} | ||
/> | ||
) : null | ||
) | ||
: | ||
pullToRefreshCallback !== null ? ( | ||
<RefreshControl | ||
refreshing={isRefreshing} | ||
onRefresh={pullToRefreshCallback} | ||
/> | ||
) : null | ||
} | ||
@@ -157,2 +169,3 @@ data={filteredData} | ||
pullToRefreshCallback: PropTypes.func, | ||
onSearch: PropTypes.func, | ||
highlightColor: PropTypes.string, | ||
@@ -174,2 +187,3 @@ isRefreshing: PropTypes.bool, | ||
pullToRefreshCallback: null, | ||
onSearch: null, | ||
highlightColor: "", | ||
@@ -176,0 +190,0 @@ backgroundStyles: {}, |
{ | ||
"name": "react-native-complete-flatlist", | ||
"version": "1.1.21", | ||
"version": "1.1.22", | ||
"description": "A complete flatlist with search bar, highlighted search, pull to refresh, and etc is ready to use", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -83,2 +83,3 @@ # react-native-complete-flatlist | ||
|`elementBetweenSearchAndList`|JSX element|What to render between searchbar and the list|null|Optional| | ||
|`refreshOnLoad`|boolean|If `true`, prop `pullToRefreshCallback` will be called if available|true|Optional| | ||
|`refreshOnLoad`|boolean|If `true`, prop `pullToRefreshCallback` will be called if available|true|Optional| | ||
|`onSearch`|function that will replace `pullToRefreshCallback`|If exist, `pullToRefreshCallback` will be overrided, but search will not affect on key press, but on return key pressed. `onSearch` will automatic get `keyword` parameter|()=>null|Optional| |
12751
212
84