@eohjsc/react-native-smart-city 0.3.25 → 0.3.26

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@eohjsc/react-native-smart-city",
3
3
  "title": "React Native Smart Home",
4
- "version": "0.3.25",
4
+ "version": "0.3.26",
5
5
  "description": "TODO",
6
6
  "main": "index.js",
7
7
  "files": [
@@ -12,11 +12,11 @@ const SliderRangeTemplate = memo(({ actionGroup, doAction, sensor }) => {
12
12
  const t = useTranslations();
13
13
  const { configuration } = actionGroup;
14
14
  const [valueBrightness, setValueBrightness] = useState(0);
15
+ const [valueBrightnessTemp, setValueBrightnessTemp] = useState(0);
15
16
  const [configValues] = useConfigGlobalState('configValues');
16
17
 
17
18
  const onChangeBrightness = useCallback(
18
19
  (value) => {
19
- setValueBrightness(value);
20
20
  doAction(
21
21
  configuration?.action_brightness_data,
22
22
  JSON.stringify({ value_brness: value })
@@ -26,17 +26,17 @@ const SliderRangeTemplate = memo(({ actionGroup, doAction, sensor }) => {
26
26
  );
27
27
 
28
28
  const percentBrightness = useMemo(() => {
29
- return valueBrightness || 0;
30
- }, [valueBrightness]);
29
+ return valueBrightnessTemp || valueBrightness || 0;
30
+ }, [valueBrightness, valueBrightnessTemp]);
31
31
 
32
32
  useEffect(() => {
33
33
  const { config } = configuration;
34
34
  const configValue = configValues[config];
35
35
  let valueBrness = configValue?.value;
36
- if (valueBrness >= 0) {
36
+ if (valueBrness >= 0 && valueBrightness >= 0) {
37
37
  setValueBrightness(valueBrness);
38
38
  }
39
- }, [configuration.config, configValues, configuration]);
39
+ }, [configuration.config, configValues, configuration, valueBrightness]);
40
40
 
41
41
  return (
42
42
  <View style={styles.viewBrightness}>
@@ -49,9 +49,9 @@ const SliderRangeTemplate = memo(({ actionGroup, doAction, sensor }) => {
49
49
  <View style={styles.RightBrightness}>
50
50
  <View style={styles.slider}>
51
51
  <SliderRange
52
- value={valueBrightness}
52
+ value={valueBrightnessTemp}
53
53
  onSlidingComplete={onChangeBrightness}
54
- onValueChange={setValueBrightness}
54
+ onValueChange={setValueBrightnessTemp}
55
55
  step={1}
56
56
  minimumValue={0}
57
57
  maximumValue={100}
@@ -1,5 +1,5 @@
1
1
  import React, { useState, useCallback, useEffect, memo } from 'react';
2
- import { View, ActivityIndicator } from 'react-native';
2
+ import { View, ActivityIndicator, Image } from 'react-native';
3
3
  import { useTranslations } from '../../hooks/Common/useTranslations';
4
4
  import { useNavigation } from '@react-navigation/native';
5
5
 
@@ -106,9 +106,16 @@ const GuestInfo = ({ route }) => {
106
106
  <>
107
107
  {!!guest && (
108
108
  <View style={styles.userWrap}>
109
- <CircleView size={88} center style={styles.avatar}>
110
- <IconOutline name="user" size={44} color={Colors.Pink1} />
111
- </CircleView>
109
+ {guest?.avatar ? (
110
+ <Image
111
+ source={{ uri: guest?.avatar }}
112
+ style={styles.avatar}
113
+ />
114
+ ) : (
115
+ <CircleView size={88} center style={styles.avatar}>
116
+ <IconOutline name="user" size={44} color={Colors.Pink1} />
117
+ </CircleView>
118
+ )}
112
119
  <Text type="H3" bold>
113
120
  {guest.name}
114
121
  </Text>
@@ -11,6 +11,13 @@ export default StyleSheet.create({
11
11
  alignItems: 'center',
12
12
  },
13
13
  avatar: {
14
+ height: 88,
15
+ width: 88,
16
+ borderRadius: 44,
17
+ borderWidth: 0.5,
18
+ borderColor: Colors.Gray5,
19
+ justifyContent: 'center',
20
+ alignItems: 'center',
14
21
  marginBottom: 16,
15
22
  backgroundColor: Colors.Primary,
16
23
  },
@@ -1,5 +1,6 @@
1
1
  import React, { useEffect, memo } from 'react';
2
2
  import {
3
+ Image,
3
4
  View,
4
5
  ScrollView,
5
6
  RefreshControl,
@@ -67,11 +68,19 @@ const ManageAccessScreen = memo(({ route }) => {
67
68
  key={index.toString()}
68
69
  index={index}
69
70
  leftIcon={
70
- <IconOutline
71
- name="user"
72
- size={20}
73
- color={Colors.White}
74
- />
71
+ item.user?.avatar ? (
72
+ <Image
73
+ source={{ uri: item.user?.avatar }}
74
+ style={styles.avatar}
75
+ // testID={TESTID.SIDE_MENU_AVATAR_USER}
76
+ />
77
+ ) : (
78
+ <IconOutline
79
+ name="user"
80
+ size={20}
81
+ color={Colors.White}
82
+ />
83
+ )
75
84
  }
76
85
  text={
77
86
  item.user?.name ||
@@ -61,6 +61,15 @@ export default StyleSheet.create({
61
61
  paddingLeft16: {
62
62
  paddingLeft: 16,
63
63
  },
64
+ avatar: {
65
+ height: 40,
66
+ width: 40,
67
+ borderRadius: 20,
68
+ borderWidth: 0.5,
69
+ borderColor: Colors.Gray5,
70
+ justifyContent: 'center',
71
+ alignItems: 'center',
72
+ },
64
73
  textNoGuest: {
65
74
  alignSelf: 'center',
66
75
  marginTop: Constants.height * 0.3,