Skip to content

Commit c3ffe83

Browse files
bug fix
1 parent 984e109 commit c3ffe83

File tree

2 files changed

+15
-5
lines changed

2 files changed

+15
-5
lines changed

index.js

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -90,14 +90,20 @@ class CompleteFlatList extends Component {
9090
renderEmptyRow = () => <Text style={styles.noData}>No data available</Text>;
9191

9292
render() {
93-
const { renderItem, renderSeparator, pullToRefreshCallback } = this.props;
93+
const {
94+
renderItem,
95+
renderSeparator,
96+
pullToRefreshCallback,
97+
backgroundStyles,
98+
searchBarBackgroundStyles,
99+
} = this.props;
94100
const filteredData = this.filterText();
95101
if (filteredData.length === 0) {
96102
filteredData.push({ showEmptyRow: true });
97103
}
98104

99105
const searchbar = (
100-
<View style={styles.searchBarContainer}>
106+
<View style={[styles.searchBarContainer, searchBarBackgroundStyles]}>
101107
<TextInput
102108
style={styles.searchBar}
103109
placeholder="Search ..."
@@ -127,7 +133,7 @@ class CompleteFlatList extends Component {
127133
return (
128134
<KeyboardAvoidingView
129135
behavior={this.state.behavior}
130-
style={styles.container}
136+
style={[styles.container, backgroundStyles]}
131137
>
132138
{this.props.searchKey.length > 0 && searchbar}
133139
<FlatList
@@ -156,6 +162,8 @@ CompleteFlatList.propTypes = {
156162
pullToRefreshCallback: PropTypes.func,
157163
highlightColor: PropTypes.string,
158164
isRefreshing: PropTypes.bool,
165+
backgroundStyles: PropTypes.object,
166+
searchBarBackgroundStyles: PropTypes.object,
159167
};
160168
CompleteFlatList.defaultProps = {
161169
searchKey: [],
@@ -165,6 +173,8 @@ CompleteFlatList.defaultProps = {
165173
renderSeparator: () => <View style={styles.defaultSeparator} />,
166174
pullToRefreshCallback: null,
167175
highlightColor: '',
176+
backgroundStyles: {},
177+
searchBarBackgroundStyles: {},
168178
};
169179

170180
const styles = StyleSheet.create({

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-native-complete-flatlist",
3-
"version": "1.1.5",
3+
"version": "1.1.6",
44
"description": "A complete flatlist with search bar, highlighted search, pull to refresh, and etc is ready to use",
55
"main": "index.js",
66
"scripts": {
@@ -41,4 +41,4 @@
4141
"prop-types": "^15.5.10",
4242
"react-native-highlight-words": "git+https://github.com/fattahmuhyiddeen/react-native-highlight-words#master"
4343
}
44-
}
44+
}

0 commit comments

Comments
 (0)