Commit dd12ef10 by Tonk

update notification tab header style, fix invalid custom filter

parent e5ba164c
...@@ -28,8 +28,8 @@ export default class NotificationScreen extends React.Component { ...@@ -28,8 +28,8 @@ export default class NotificationScreen extends React.Component {
filterData: [], filterData: [],
initial: [], initial: [],
isfilterVisible: false, isfilterVisible: false,
selectedStartDate: null, selectedStartDate: new Date(),
selectedEndDate: null, selectedEndDate: new Date(),
filterBy: null, filterBy: null,
toggleCalendar: false, toggleCalendar: false,
}; };
...@@ -135,11 +135,14 @@ export default class NotificationScreen extends React.Component { ...@@ -135,11 +135,14 @@ export default class NotificationScreen extends React.Component {
console.log('filter last month'); console.log('filter last month');
} else if (filterBy === 'custom') { } else if (filterBy === 'custom') {
console.log('filter custom'); console.log('filter custom');
const start = getTime(selectedStartDate); const start = getTime(selectedStartDate);
const end = endOfDay(getTime(selectedEndDate)); const end = endOfDay(getTime(selectedEndDate === null ? selectedStartDate : selectedEndDate));
const newData = initial.filter(x => { const newData = initial.filter(x => {
return x.time * 1000 <= end && x.time * 1000 > start; return x.time * 1000 <= end && x.time * 1000 > start;
}); });
console.log('start', start, 'end', end, 'start state', selectedStartDate, 'end state', selectedEndDate);
this.setState({ filterData: newData }); this.setState({ filterData: newData });
} else if (filterBy === 'all') { } else if (filterBy === 'all') {
this.setState({ filterData: initial }); this.setState({ filterData: initial });
...@@ -165,9 +168,11 @@ export default class NotificationScreen extends React.Component { ...@@ -165,9 +168,11 @@ export default class NotificationScreen extends React.Component {
<View style={{ display: 'flex', flexDirection: 'column', flex: 1 }}> <View style={{ display: 'flex', flexDirection: 'column', flex: 1 }}>
<View style={[theme.rowContainer, { justifyContent: 'space-between', marginBottom: 5 }]}> <View style={[theme.rowContainer, { justifyContent: 'space-between', marginBottom: 5 }]}>
{/* operate's username */} {/* operate's username */}
<Text style={[theme.smDescription]}>{data.user || 'unknown'}</Text> <Text style={[theme.smDescription, { color: '#b9babc' }]}>{data.user || 'unknown'}</Text>
{/* operate time */} {/* operate time */}
<Text style={[theme.smDescription]}>{format(data.time * 1000, 'hh:mm A')}</Text> <Text style={[theme.smDescription, { color: '#b9babc' }]}>
{format(data.time * 1000, 'hh:mm A')}
</Text>
</View> </View>
{/* operate action. */} {/* operate action. */}
<Text style={[theme.normalText, theme.textDark]}> <Text style={[theme.normalText, theme.textDark]}>
...@@ -233,7 +238,8 @@ export default class NotificationScreen extends React.Component { ...@@ -233,7 +238,8 @@ export default class NotificationScreen extends React.Component {
style={[styles.pickerContainer, theme.mt2, theme.rowContainer, { justifyContent: 'space-between' }]} style={[styles.pickerContainer, theme.mt2, theme.rowContainer, { justifyContent: 'space-between' }]}
> >
<Text style={[theme.normalText, theme.textDark]}> <Text style={[theme.normalText, theme.textDark]}>
{format(startDate, 'DD-MM-YYYY')} - {format(endDate, 'DD-MM-YYYY')} {format(startDate, 'DD-MM-YYYY')}
{endDate === '' ? '' : ' - ' + format(endDate, 'DD-MM-YYYY')}
</Text> </Text>
<Icon <Icon
type="MaterialCommunityIcons" type="MaterialCommunityIcons"
...@@ -282,9 +288,9 @@ export default class NotificationScreen extends React.Component { ...@@ -282,9 +288,9 @@ export default class NotificationScreen extends React.Component {
render() { render() {
const TabStyle = { const TabStyle = {
textStyle: theme.description, textStyle: theme.description,
activeTextStyle: [theme.description, theme.textWhite], activeTextStyle: [theme.description, theme.textDark],
tabStyle: { backgroundColor: color.white, borderRadius: 100, margin: 10 }, tabStyle: { backgroundColor: 'transparent', borderRadius: 100, margin: 10 },
activeTabStyle: { backgroundColor: color.primary, borderRadius: 100, margin: 10 }, activeTabStyle: { backgroundColor: 'rgba(238, 84, 84, 0.15)', borderRadius: 100, margin: 10 },
style: { backgroundColor: color.defaultBg }, style: { backgroundColor: color.defaultBg },
}; };
return ( return (
......
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