Commit 96171eb6 by Tonk

fix iOS edit timer, add search bar on smart device screen

parent 14a6e205
......@@ -160,7 +160,7 @@ export default class HistoryScreen extends React.Component {
svg={{ fontSize: 8, fill: color.grey }}
/>
</View>
<View style={{ paddingHorizontal: 10, marginBottom: isIphoneX() ? 120 : 55 }}>
<View style={{ paddingHorizontal: 10, marginBottom: isIphoneX() ? 120 : 85 }}>
<Text style={theme.normalText}>Info</Text>
<View style={{ backgroundColor: color.white, marginTop: 10, borderRadius: 8 }}>
<FlatList
......
......@@ -11,13 +11,12 @@ import RNPickerSelect from 'react-native-picker-select';
import CalendarPicker from 'react-native-calendar-picker';
import { TouchableWithoutFeedback } from 'react-native-gesture-handler';
import { withNavigationFocus } from 'react-navigation';
import dt2 from './notification.json';
const tabHeader = [
{ type: 'all', label: 'All' },
{ type: 'notification', label: 'Notification' },
{ type: 'log', label: 'Logging' },
];
const dt2 = require('./notification.json');
class NotificationScreen extends React.Component {
static navigationOptions = ({ navigation }) => ({
title: 'Notifications',
......
......@@ -31,7 +31,7 @@ export default class WifiSelectScreen extends React.Component {
ListHeaderComponent={() => <Text style={styles.header}>Choose a network</Text>}
keyExtractor={(item, index) => index}
ItemSeparatorComponent={() => <View style={styles.separator} />}
style={{ marginBottom: isIphoneX() ? 100 : 55 }}
style={{ marginBottom: isIphoneX() ? 100 : 65 }}
/>
);
}
......
......@@ -55,6 +55,25 @@ class SmartMeterScreen extends PureComponent {
return !error ? (
<>
<View
style={{
padding: 15,
flexDirection: 'row',
alignItems: 'center',
backgroundColor: color.defaultBg,
}}
>
<SearchBar
containerStyle={styles.searchBarContainer}
inputContainerStyle={styles.searchBarInputContainer}
inputStyle={styles.searchBarInput}
round
lightTheme
placeholder="Search..."
onChangeText={text => this.updateSearch(text)}
value={this.state.search}
/>
</View>
<FlatList
refreshControl={
<RefreshControl
......
......@@ -82,10 +82,12 @@ class TimerScreen extends Component {
}
setPickerSelectData = () => {
let pickerSelectData = [{ label: 'Main Device', value: 'main' }];
let pickerSelectData = [
{ label: `Main Device ${currentSelectedData.name ? `[${currentSelectedData.name}]` : ''}`, value: 'main' },
];
this.props.existedData.map((mcbLink, index) => {
pickerSelectData.push({ label: `MCB Link ${index + 1}`, value: index + 1 });
pickerSelectData.push({ label: `MCB Link ${index + 1} ${mcbLink.name ? `[${mcbLink.name}]` : ''} ` });
});
this.setState({ pickerSelectData });
};
......@@ -152,6 +154,10 @@ class TimerScreen extends Component {
saveTimer.setDate(0);
saveTimer.setSeconds(0);
let binary = this.state.repeatOn.map(x => (x.isRepeat ? 1 : 0)).join('');
let decimal = parseInt(binary, 2);
console.log('timer', Number(saveTimer));
const timerData = {
isActive: this.state.isActive,
isPowerOn: this.state.isPowerOn,
......@@ -259,7 +265,7 @@ class TimerScreen extends Component {
<Text style={[theme.modalText, 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"
style={{
......@@ -301,7 +307,7 @@ class TimerScreen extends Component {
containerStyle={styles.checkboxContainer}
fontFamily={'Avenir-Roman'}
textStyle={{ fontWeight: 'normal', color: color.darkGrey }}
title={`Sub breaker ${item.id} `}
title={`Sub Breaker ${item.id} ${item.name ? `[${item.name}]` : ''}`}
checked={this.state.subBreakerList[index].selected}
checkedIcon={
<Icon
......@@ -543,7 +549,7 @@ class TimerScreen extends Component {
containerStyle={styles.checkboxContainer}
fontFamily={'Avenir-Roman'}
textStyle={{ fontWeight: 'normal', color: color.darkGrey }}
title={'Sub breaker ' + item.id}
title={`Sub Breaker ${item.id} ${item.name ? `[${item.name}]` : ''}`}
checked={this.state.subBreakerList[index].selected}
checkedIcon={
<Icon name="md-checkbox" style={{ color: color.primary, fontSize: 26 }} />
......
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