react-native-complete-flatlist
Advanced tools
Comparing version 1.1.32 to 1.1.33
61
index.js
@@ -11,3 +11,2 @@ import React, { Component } from "react"; | ||
} from "react-native"; | ||
import PropTypes from "prop-types"; | ||
@@ -21,4 +20,23 @@ class CompleteFlatList extends Component { | ||
constructor(props) { | ||
super(props) | ||
static defaultProps = { | ||
searchKey: [], | ||
placeholder: "Search ...", | ||
data: [], | ||
isRefreshing: false, | ||
renderItem: null, | ||
renderSeparator: () => <View style={styles.defaultSeparator} />, | ||
pullToRefreshCallback: null, | ||
onSearch: null, | ||
highlightColor: "", | ||
backgroundStyles: {}, | ||
searchTextInputStyle: {}, | ||
searchBarBackgroundStyles: {}, | ||
renderEmptyRow: () => ( | ||
<Text style={styles.noData}>{"No data available"}</Text> | ||
), | ||
elementBetweenSearchAndList: null | ||
}; | ||
constructor(props, defaultProps) { | ||
super(props, defaultProps) | ||
const { refreshOnLoad = true, pullToRefreshCallback } = props | ||
@@ -30,2 +48,4 @@ if (pullToRefreshCallback !== null && refreshOnLoad) { | ||
clearSearch = () => this.searchInput.clear() | ||
onRefresh = () => { | ||
@@ -111,2 +131,3 @@ this.props.pullToRefreshCallback(); | ||
<TextInput | ||
ref={c => this.searchInput = c} | ||
style={[styles.searchBar, searchTextInputStyle]} | ||
@@ -169,36 +190,2 @@ placeholder={placeholder} | ||
CompleteFlatList.propTypes = { | ||
searchKey: PropTypes.array, | ||
data: PropTypes.array, | ||
renderItem: PropTypes.func, | ||
renderSeparator: PropTypes.func, | ||
pullToRefreshCallback: PropTypes.func, | ||
onSearch: PropTypes.func, | ||
highlightColor: PropTypes.string, | ||
isRefreshing: PropTypes.bool, | ||
backgroundStyles: PropTypes.object, | ||
searchBarBackgroundStyles: PropTypes.object, | ||
renderEmptyRow: PropTypes.func, | ||
placeholder: PropTypes.string, | ||
searchTextInputStyle: PropTypes.object, | ||
elementBetweenSearchAndList: PropTypes.element | ||
}; | ||
CompleteFlatList.defaultProps = { | ||
searchKey: [], | ||
placeholder: "Search ...", | ||
data: [], | ||
isRefreshing: false, | ||
renderItem: null, | ||
renderSeparator: () => <View style={styles.defaultSeparator} />, | ||
pullToRefreshCallback: null, | ||
onSearch: null, | ||
highlightColor: "", | ||
backgroundStyles: {}, | ||
searchTextInputStyle: {}, | ||
searchBarBackgroundStyles: {}, | ||
renderEmptyRow: () => ( | ||
<Text style={styles.noData}>{"No data available"}</Text> | ||
), | ||
elementBetweenSearchAndList: null | ||
}; | ||
@@ -205,0 +192,0 @@ const styles = StyleSheet.create({ |
{ | ||
"name": "react-native-complete-flatlist", | ||
"version": "1.1.32", | ||
"version": "1.1.33", | ||
"description": "An extension of ReactNative's flatlist with search bar, highlighted search, pull to refresh, and etc is ready to use", | ||
@@ -38,5 +38,4 @@ "main": "index.js", | ||
"dependencies": { | ||
"prop-types": "^15.5.10", | ||
"react-native-highlight-words": "git+https://github.com/fattahmuhyiddeen/react-native-highlight-words.git#master" | ||
} | ||
} |
@@ -75,2 +75,3 @@ # react-native-complete-flatlist | ||
data={data} | ||
ref={c => this.completeFlatList = c} | ||
renderSeparator={null} | ||
@@ -110,2 +111,21 @@ renderItem={this.cell} | ||
|`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. This will not triggered on key press, but on return key pressed. This props is introduced if search trigger result from API. If you just want local search (search from existing array), this props is not needed. `onSearch` will automatic get `keyword` parameter|()=>null|Optional| | ||
|`onSearch`|function that will replace `pullToRefreshCallback`|If exist, `pullToRefreshCallback` will be overrided. This will not triggered on key press, but on return key pressed. This props is introduced if search trigger result from API. If you just want local search (search from existing array), this props is not needed. `onSearch` will automatic get `keyword` parameter|()=>null|Optional| | ||
### Methods | ||
If you have ```ref``` to the component, | ||
``` | ||
<CompleteFlatList | ||
... | ||
ref={c => this.completeFlatList = c} | ||
... | ||
/> | ||
``` | ||
you can use any method(s) below | ||
```this.completeFlatList.methodName()``` | ||
|Method|Description| | ||
|------|-----------| | ||
|clearSearch|Clear search input programmatically| |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1
129
14428
205
- Removedprop-types@^15.5.10
- Removedjs-tokens@4.0.0(transitive)
- Removedloose-envify@1.4.0(transitive)
- Removedobject-assign@4.1.1(transitive)
- Removedprop-types@15.8.1(transitive)
- Removedreact-is@16.13.1(transitive)