Commit a44a6e17 by OuiAtichat

update

parent 3aa4cff0
......@@ -6,61 +6,66 @@ import { RectButton } from 'react-native-gesture-handler';
import Swipeable from 'react-native-gesture-handler/Swipeable';
import IconMaterialIcons from 'react-native-vector-icons/MaterialIcons';
import { Overlay } from 'react-native-elements';
import { format } from 'date-fns';
const AnimatedIcon = Animated.createAnimatedComponent(IconMaterialIcons);
const Row = ({ data }) => (
<RectButton style={styles.rectButton} onPress={() => alert('hello ' + data.name)}>
<View style={{ flexDirection: 'row', paddingVertical: 5 }}>
<View style={{ flex: 1 }}>
<Text style={[theme.title]}>
{data.time} <Text style={[theme.description, theme.textDark]}>{data.period}</Text>
</Text>
<View style={theme.rowContainer}>
{data.day.map((item, index) => (
const Row = ({ data }) => {
console.log(data);
return (
<RectButton style={styles.rectButton} onPress={() => alert('hello ' + data.name)}>
<View style={{ flexDirection: 'row', paddingVertical: 5 }}>
<View style={{ flex: 1 }}>
<Text style={[theme.title]}>
{format(data.time, 'h:mm')}{' '}
<Text style={[theme.description, theme.textDark]}>{format(data.time, 'A')}</Text>
</Text>
<View style={theme.rowContainer}>
{data.repeatDays.map((item, index) => (
<Text
key={index}
style={[
theme.description,
{
color: data.active
? item.isRepeat
? color.primary
: color.grey
: item.isRepeat
? color.darkGrey
: color.grey,
},
]}
>
{item.day}{' '}
</Text>
))}
</View>
</View>
<View style={{ flex: 1 }}>
<Text style={[theme.title, { fontWeight: 'normal' }]}>{data.name}</Text>
<Text style={theme.description}>{data.active ? 'Active' : 'Inactive'} </Text>
</View>
<View style={{ flex: 1, alignItems: 'flex-end' }}>
<View style={{ alignItems: 'center' }}>
<Text
key={index}
style={[
theme.description,
theme.title,
{
color: data.active
? item.dayActive
? color.primary
: color.grey
: item.dayActive
? color.darkGrey
: color.grey,
color: data.active ? (data.power ? color.success : color.primary) : color.grey,
fontWeight: 'normal',
},
]}
>
{item.day}{' '}
{data.power ? 'ON' : 'OFF'}
</Text>
))}
</View>
</View>
<View style={{ flex: 1 }}>
<Text style={[theme.title, { fontWeight: 'normal' }]}>{data.name}</Text>
<Text style={theme.description}>{data.active ? 'Active' : 'Inactive'} </Text>
</View>
<View style={{ flex: 1, alignItems: 'flex-end' }}>
<View style={{ alignItems: 'center' }}>
<Text
style={[
theme.title,
{
color: data.active ? (data.power ? color.success : color.primary) : color.grey,
fontWeight: 'normal',
},
]}
>
{data.power ? 'ON' : 'OFF'}
</Text>
<Text style={theme.description}>Power</Text>
<Text style={theme.description}>Power</Text>
</View>
</View>
</View>
</View>
</RectButton>
);
</RectButton>
);
};
class SwipeableRow extends Component {
selectedRow = null;
......@@ -91,17 +96,19 @@ class SwipeableRow extends Component {
isVisible={this.state.isVisible}
onBackdropPress={() => this.setState({ isVisible: false })}
>
<Text style={[theme.smallTitle, theme.textDark, theme.centerText, { marginHorizontal: 30 }]}>
Are you sure you want to delete this item?{' '}
</Text>
<View style={{ flexDirection: 'row', justifyContent: 'space-between' }}>
<Button transparent style={{ width: '40%' }} onPress={this.cancel}>
<Text style={{ color: color.grey }}>Cancel</Text>
</Button>
<Button style={styles.delBtn} onPress={this.delete}>
<Text>Delete</Text>
</Button>
</View>
<>
<Text style={[theme.smallTitle, theme.textDark, theme.centerText, { marginHorizontal: 30 }]}>
Are you sure you want to delete this item?{' '}
</Text>
<View style={{ flexDirection: 'row', justifyContent: 'space-between' }}>
<Button transparent style={{ width: '40%' }} onPress={this.cancel} rounded>
<Text style={{ color: color.grey }}>Cancel</Text>
</Button>
<Button style={styles.delBtn} onPress={this.delete} rounded>
<Text>Delete</Text>
</Button>
</View>
</>
</Overlay>
</>
);
......
......@@ -12,9 +12,12 @@
"dependencies": {
"@eva-design/eva": "^1.0.1",
"@react-native-community/async-storage": "^1.6.1",
"date-fns": "^1.30.1",
"firebase": "^6.3.5",
"lodash.set": "^4.3.2",
"native-base": "^2.12.2",
"react": "^16.9.0",
"react-addons-update": "^15.6.2",
"react-native": "^0.60.4",
"react-native-barcode-mask": "^1.0.5",
"react-native-camera": "^2.11.1",
......
......@@ -33,7 +33,7 @@ class CameraScreen extends Component {
//short delay to increase frmaerate when open this screen
setTimeout(() => {
this.setState({ isWaiting: true });
}, 500);
}, 250);
};
handleBarCodeScanned = ({ type, data }) => {
......
......@@ -2289,6 +2289,11 @@ data-urls@^1.0.0:
whatwg-mimetype "^2.2.0"
whatwg-url "^7.0.0"
date-fns@^1.30.1:
version "1.30.1"
resolved "https://registry.yarnpkg.com/date-fns/-/date-fns-1.30.1.tgz#2e71bf0b119153dbb4cc4e88d9ea5acfb50dc05c"
integrity sha512-hBSVCvSmWC+QypYObzwGOd9wqdDpOt+0wl0KbU+R+uuZBS1jN8VsD1ss3irQDknRj5NvxiTF6oj/nDRnN/UQNw==
debounce@^1.2.0:
version "1.2.0"
resolved "https://registry.yarnpkg.com/debounce/-/debounce-1.2.0.tgz#44a540abc0ea9943018dc0eaa95cce87f65cd131"
......@@ -4491,6 +4496,11 @@ lodash.merge@^4.6.1:
resolved "https://registry.yarnpkg.com/lodash.merge/-/lodash.merge-4.6.2.tgz#558aa53b43b661e1925a0afdfa36a9a1085fe57a"
integrity sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==
lodash.set@^4.3.2:
version "4.3.2"
resolved "https://registry.yarnpkg.com/lodash.set/-/lodash.set-4.3.2.tgz#d8757b1da807dde24816b0d6a84bea1a76230b23"
integrity sha1-2HV7HagH3eJIFrDWqEvqGnYjCyM=
lodash.sortby@^4.7.0:
version "4.7.0"
resolved "https://registry.yarnpkg.com/lodash.sortby/-/lodash.sortby-4.7.0.tgz#edd14c824e2cc9c1e0b0a1b42bb5210516a42438"
......@@ -5858,6 +5868,14 @@ rc@^1.2.7:
minimist "^1.2.0"
strip-json-comments "~2.0.1"
react-addons-update@^15.6.2:
version "15.6.2"
resolved "https://registry.yarnpkg.com/react-addons-update/-/react-addons-update-15.6.2.tgz#e53753c5b34887974510c882d7fb075851d5e504"
integrity sha1-5TdTxbNIh5dFEMiC1/sHWFHV5QQ=
dependencies:
fbjs "^0.8.9"
object-assign "^4.1.0"
react-deep-force-update@^1.0.0:
version "1.1.2"
resolved "https://registry.yarnpkg.com/react-deep-force-update/-/react-deep-force-update-1.1.2.tgz#3d2ae45c2c9040cbb1772be52f8ea1ade6ca2ee1"
......
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