@applicaster/zapp-react-native-ui-components 11.1.1 → 12.0.0-alpha.4534459584

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.
@@ -9,10 +9,11 @@ type Props = {
9
9
  type?: string;
10
10
  };
11
11
  style: Styles;
12
+ cellState: CellState;
12
13
  };
13
14
 
14
15
  export const Toggle = (props: Props) => {
15
- const { style, item, action } = props;
16
+ const { style, item, action, cellState } = props;
16
17
 
17
18
  const {
18
19
  trackColor,
@@ -22,6 +23,7 @@ export const Toggle = (props: Props) => {
22
23
  iosBackgroundColor,
23
24
  } = style;
24
25
 
26
+ const isSelected = React.useMemo(() => (cellState === "selected"), [item?.id, cellState]);
25
27
  const actionContext = useActions(action?.identifier);
26
28
 
27
29
  const [actionState, setActionState] = useState(
@@ -37,10 +39,10 @@ export const Toggle = (props: Props) => {
37
39
  return (
38
40
  <Switch
39
41
  trackColor={{ false: trackColor, true: trackColorActive }}
40
- thumbColor={actionState?.state ? thumbColorActive : thumbColor}
42
+ thumbColor={isSelected ? thumbColorActive : thumbColor}
41
43
  ios_backgroundColor={iosBackgroundColor}
42
44
  onValueChange={onPress}
43
- value={!!actionState?.state}
45
+ value={isSelected}
44
46
  />
45
47
  );
46
48
  };
@@ -4,6 +4,7 @@ import { Text, TextStyle, View, ViewStyle } from "react-native";
4
4
 
5
5
  import { getLocalizations } from "@applicaster/zapp-react-native-utils/localizationUtils";
6
6
  import { getAppStylesColor } from "@applicaster/zapp-react-native-utils/stylesUtils";
7
+ import { useDimensions } from "@applicaster/zapp-react-native-utils/reactHooks/layout";
7
8
  import { useTheme } from "@applicaster/zapp-react-native-utils/theme";
8
9
  import { styleKeys } from "@applicaster/zapp-react-native-utils/styleKeysUtils";
9
10
 
@@ -25,10 +26,10 @@ const textStyles = (appStyles = defaultAppStyles): TextStyle => ({
25
26
  textAlign: "center",
26
27
  });
27
28
 
28
- const errorStyles = ({ backgroundColor }): ViewStyle => ({
29
+ const errorStyles = ({ width, height, backgroundColor }): ViewStyle => ({
29
30
  flex: 1,
30
- width: "100%",
31
- height: "100%",
31
+ width,
32
+ height,
32
33
  justifyContent: "center",
33
34
  alignItems: "center",
34
35
  position: "absolute",
@@ -40,6 +41,8 @@ export function ErrorDisplayComponent({
40
41
  styles,
41
42
  remoteConfigurations: { localizations },
42
43
  }: Props) {
44
+ const { width, height } = useDimensions("window");
45
+
43
46
  const theme = useTheme();
44
47
  const backgroundColor = theme?.app_background_color;
45
48
 
@@ -50,7 +53,7 @@ export function ErrorDisplayComponent({
50
53
  const appStyles = R.prop(styleKeys.style_namespace, styles);
51
54
 
52
55
  return (
53
- <View style={errorStyles({ backgroundColor })}>
56
+ <View style={errorStyles({ width, height, backgroundColor })}>
54
57
  <Text style={textStyles(appStyles)}>{stream_error_message}</Text>
55
58
  </View>
56
59
  );
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@applicaster/zapp-react-native-ui-components",
3
- "version": "11.1.1",
3
+ "version": "12.0.0-alpha.4534459584",
4
4
  "description": "Applicaster Zapp React Native ui components for the Quick Brick App",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
@@ -35,10 +35,10 @@
35
35
  "redux-mock-store": "^1.5.3"
36
36
  },
37
37
  "dependencies": {
38
- "@applicaster/applicaster-types": "11.1.1",
39
- "@applicaster/zapp-react-native-bridge": "11.1.1",
40
- "@applicaster/zapp-react-native-redux": "11.1.1",
41
- "@applicaster/zapp-react-native-utils": "11.1.1",
38
+ "@applicaster/applicaster-types": "12.0.0-alpha.4534459584",
39
+ "@applicaster/zapp-react-native-bridge": "12.0.0-alpha.4534459584",
40
+ "@applicaster/zapp-react-native-redux": "12.0.0-alpha.4534459584",
41
+ "@applicaster/zapp-react-native-utils": "12.0.0-alpha.4534459584",
42
42
  "promise": "^8.3.0",
43
43
  "react-router-native": "^5.1.2",
44
44
  "url": "^0.11.0",