Commit 4ac4e509 by Tonk

update search by timer name

parent d0ee40db
......@@ -83,6 +83,7 @@ class TimerScreen extends Component {
...initState,
pickerSelectData: [],
subBreakerList: [],
data: [],
};
constructor(props) {
super(props);
......@@ -138,6 +139,15 @@ class TimerScreen extends Component {
updateSearch = search => {
this.setState({ search });
const newData = this.props.allTimers.filter(item => {
const itemData = `${item.name.toUpperCase()}`;
const textData = search.toUpperCase();
return itemData.indexOf(textData) > -1;
});
this.setState({
data: newData,
});
};
createNewOrEditTimer = async () => {
......@@ -264,7 +274,7 @@ class TimerScreen extends Component {
<Text style={[theme.normalText, theme.textDark, theme.mt2]}>Set Time</Text>
<DatePicker
date={this.state.timer}
date={new Date(this.state.timer)}
onDateChange={date => this.setState({ timer: date })}
mode="time"
locale="fr"
......@@ -414,7 +424,7 @@ class TimerScreen extends Component {
{/* List Timer */}
<FlatList
contentContainerStyle={{ paddingBottom: isIphoneX() ? 90 : 55 }}
data={this.props.allTimers}
data={this.state.search ? this.state.data : this.props.allTimers}
refreshing={this.props.isLoading}
onRefresh={this.props.getTimers}
ListEmptyComponent={() => (
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment