@applicaster/zapp-react-native-ui-components 13.0.0-alpha.5049772260 → 13.0.0-alpha.5131435627

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.
@@ -6,7 +6,7 @@ import { useIsScreenActive } from "@applicaster/zapp-react-native-utils/reactHoo
6
6
  import { useSubscriberFor } from "@applicaster/zapp-react-native-utils/reactHooks/useSubscriberFor";
7
7
 
8
8
  export const useEventAlerts = (screenData: ZappRiver) => {
9
- const localizedStrings = useLocalizedStrings({
9
+ const localizations = useLocalizedStrings({
10
10
  localizations: screenData?.localizations || {},
11
11
  });
12
12
 
@@ -14,15 +14,17 @@ export const useEventAlerts = (screenData: ZappRiver) => {
14
14
 
15
15
  const onMaxTagsReached = React.useCallback(() => {
16
16
  // We can't skip subscribe hook call, so we have to check.
17
- if (!isActive) return;
17
+ if (!isActive || !localizations?.msg_maximum_selection_reached_message) {
18
+ return;
19
+ }
18
20
 
19
21
  showAlertDialog({
20
22
  title: "",
21
- message:
22
- localizedStrings?.max_items_reached_message || "Max items reached",
23
- okButtonText: localizedStrings?.ok_button_text || "OK",
23
+ message: localizations.msg_maximum_selection_reached_message,
24
+ okButtonText:
25
+ localizations.msg_maximum_selection_reached_message_ok_button || "OK",
24
26
  });
25
- }, [localizedStrings, isActive]);
27
+ }, [localizations, isActive]);
26
28
 
27
29
  useSubscriberFor(TOGGLE_FLAG_MAX_ITEMS_REACHED_EVENT, onMaxTagsReached);
28
30
  };
@@ -1,11 +1,5 @@
1
- import React, {
2
- useCallback,
3
- useEffect,
4
- useMemo,
5
- useRef,
6
- useState,
7
- } from "react";
8
- import { View, LayoutChangeEvent, ScrollView } from "react-native";
1
+ import React, { useCallback, useEffect, useMemo, useRef } from "react";
2
+ import { View, ScrollView, StyleSheet, Platform } from "react-native";
9
3
  import { Button } from "./Button";
10
4
  import { ItemIconProps } from "./Button/ItemIcon";
11
5
  import { ItemProps } from "./Button/Item";
@@ -16,6 +10,7 @@ import { useTheme } from "@applicaster/zapp-react-native-utils/theme";
16
10
  import type { PluginConfiguration } from "./";
17
11
 
18
12
  import { ModalHeader } from "./Header";
13
+ import { useSafeAreaInsets } from "react-native-safe-area-context";
19
14
 
20
15
  type ModalComponentProps = {
21
16
  items: any[];
@@ -44,11 +39,16 @@ type ModalComponentProps = {
44
39
  iconPlacement?: "left" | "right";
45
40
  };
46
41
 
42
+ const styles = StyleSheet.create({
43
+ container: {
44
+ maxHeight: "100%",
45
+ },
46
+ });
47
+
47
48
  export function BottomSheetModalContent(props: ModalComponentProps) {
48
49
  const {
49
50
  items,
50
51
  currentRoute,
51
- maxHeight,
52
52
  current_selection = null,
53
53
  onPress,
54
54
  dismiss,
@@ -61,20 +61,11 @@ export function BottomSheetModalContent(props: ModalComponentProps) {
61
61
  iconPlacement,
62
62
  } = props;
63
63
 
64
- const [headerHeight, setHeaderHeight] = useState(0);
65
64
  const route = useRef(currentRoute);
66
65
  const theme = useTheme<BaseThemePropertiesMobile>();
67
66
  const paddingTop = Number(theme.modal_bottom_sheet_padding_top);
68
67
  const paddingBottom = Number(theme.modal_bottom_sheet_padding_bottom);
69
68
 
70
- const maxContentHeight = maxHeight
71
- ? maxHeight - headerHeight - paddingTop
72
- : undefined;
73
-
74
- const onHeaderLayout = useCallback((event: LayoutChangeEvent) => {
75
- setHeaderHeight(event.nativeEvent.layout.height);
76
- }, []);
77
-
78
69
  useEffect(() => {
79
70
  if (currentRoute !== route.current) {
80
71
  props.dismiss();
@@ -101,33 +92,32 @@ export function BottomSheetModalContent(props: ModalComponentProps) {
101
92
  [onPress, dismiss]
102
93
  );
103
94
 
95
+ const bottomInset = useSafeAreaInsets().bottom;
96
+
104
97
  return (
105
98
  <View
106
- style={{
107
- maxWidth: props.width,
108
- paddingTop,
109
- }}
99
+ style={[
100
+ styles.container,
101
+ {
102
+ paddingTop: paddingTop,
103
+ },
104
+ ]}
110
105
  >
111
106
  <ModalHeader
112
- width={props.width}
113
107
  dismiss={dismiss}
114
108
  configuration={theme}
115
- onLayout={onHeaderLayout}
116
109
  summary={summary}
117
110
  title={title}
118
111
  />
119
112
  <ScrollView
120
- bounces={false}
121
- style={{ maxHeight: maxContentHeight }}
122
113
  contentContainerStyle={{
123
- paddingBottom,
124
- paddingTop,
114
+ paddingBottom:
115
+ Platform.OS === "ios" ? paddingBottom + bottomInset : paddingBottom,
125
116
  }}
126
117
  >
127
118
  {items.map((item, index) => (
128
119
  <ButtonComponent
129
120
  key={index}
130
- width={props.width}
131
121
  configuration={theme}
132
122
  selectedItem={current_selection}
133
123
  item={item}
@@ -7,7 +7,6 @@ import { defaultSelectedAsset } from "./assets";
7
7
 
8
8
  type ButtonProps = {
9
9
  configuration: any;
10
- width: number;
11
10
  selectedItem?: any;
12
11
  item: any; // Adjust type as needed
13
12
  onPress: (item: any) => void; // Adjust type as needed
@@ -33,7 +32,6 @@ export function Button({
33
32
  item,
34
33
  onPress,
35
34
  configuration,
36
- width,
37
35
  iconBaseProps,
38
36
  itemBaseProps: itemProps,
39
37
  labelBaseProps,
@@ -65,34 +63,32 @@ export function Button({
65
63
  if (disabled) return null;
66
64
 
67
65
  return (
68
- <View style={{ maxWidth: width }}>
69
- <TouchableOpacity
70
- activeOpacity={1}
71
- onPress={() => onPress(item)}
72
- onPressIn={() => setFocused(true)}
73
- onPressOut={() => setFocused(false)}
74
- >
75
- <Item {...itemProps} focused={focused} selected={selected}>
76
- <View style={styles.label_icon_container}>
77
- {iconPlacement === "left" && renderItemIcon}
66
+ <TouchableOpacity
67
+ activeOpacity={1}
68
+ onPress={() => onPress(item)}
69
+ onPressIn={() => setFocused(true)}
70
+ onPressOut={() => setFocused(false)}
71
+ >
72
+ <Item {...itemProps} focused={focused} selected={selected}>
73
+ <View style={styles.label_icon_container}>
74
+ {iconPlacement === "left" && renderItemIcon}
78
75
 
79
- {label ? (
80
- <ItemLabel
81
- {...labelBaseProps}
82
- label={label ?? null}
83
- focused={focused}
84
- selected={selected}
85
- />
86
- ) : null}
87
- </View>
76
+ {label ? (
77
+ <ItemLabel
78
+ {...labelBaseProps}
79
+ label={label ?? null}
80
+ focused={focused}
81
+ selected={selected}
82
+ />
83
+ ) : null}
84
+ </View>
88
85
 
89
- {selected ? (
90
- <ItemIcon {...iconBaseProps} asset={selectedItemIconPropsAssets} />
91
- ) : (
92
- iconPlacement === "right" && renderItemIcon
93
- )}
94
- </Item>
95
- </TouchableOpacity>
96
- </View>
86
+ {selected ? (
87
+ <ItemIcon {...iconBaseProps} asset={selectedItemIconPropsAssets} />
88
+ ) : (
89
+ iconPlacement === "right" && renderItemIcon
90
+ )}
91
+ </Item>
92
+ </TouchableOpacity>
97
93
  );
98
94
  }
@@ -8,13 +8,18 @@ import { PluginConfiguration } from "../index";
8
8
  type Props = {
9
9
  dismiss: () => void;
10
10
  configuration: PluginConfiguration;
11
- width: number;
12
11
  onLayout?: (event: LayoutChangeEvent) => void;
13
12
  summary?: string;
14
13
  title?: string;
15
14
  };
16
15
 
17
16
  const styles = StyleSheet.create({
17
+ noFlex: {
18
+ flex: 0,
19
+ },
20
+ flex: {
21
+ flex: 1,
22
+ },
18
23
  container: {
19
24
  flexDirection: "row",
20
25
  alignItems: "center",
@@ -22,7 +27,7 @@ const styles = StyleSheet.create({
22
27
  });
23
28
 
24
29
  export function ModalHeader(props: Props) {
25
- const { configuration, dismiss, width, onLayout, summary, title } = props;
30
+ const { configuration, dismiss, onLayout, summary, title } = props;
26
31
 
27
32
  const closeButtonProps = useMemo<CloseButtonProps>(
28
33
  () => ({
@@ -55,15 +60,11 @@ export function ModalHeader(props: Props) {
55
60
 
56
61
  return (
57
62
  <View onLayout={onLayout} style={styles.container}>
58
- <View
59
- style={{
60
- width: width - buttonsContainerWidth,
61
- }}
62
- >
63
+ <View style={styles.flex}>
63
64
  {title ? <Title {...titleProps} /> : null}
64
65
  {summary ? <Title {...summaryProps} /> : null}
65
66
  </View>
66
- <View style={{ width: buttonsContainerWidth }}>
67
+ <View style={[styles.noFlex, { width: buttonsContainerWidth }]}>
67
68
  <CloseButton {...closeButtonProps} />
68
69
  </View>
69
70
  </View>
@@ -10,6 +10,7 @@ import {
10
10
  import { useTargetScreenData } from "@applicaster/zapp-react-native-utils/reactHooks/screen";
11
11
  import { ComponentsMap } from "@applicaster/zapp-react-native-ui-components/Components/River/ComponentsMap";
12
12
  import { useSafeAreaInsets } from "react-native-safe-area-context";
13
+ import { isNilOrEmpty } from "@applicaster/zapp-react-native-utils/reactUtils/helpers";
13
14
 
14
15
  const { width: SCREEN_WIDTH } = Dimensions.get("screen");
15
16
 
@@ -78,6 +79,10 @@ export const PlayerDetails = ({
78
79
  }
79
80
  }, [isAudioPlayer]);
80
81
 
82
+ if (isNilOrEmpty(screenData?.ui_components)) {
83
+ return null;
84
+ }
85
+
81
86
  return (
82
87
  <Animated.View
83
88
  style={[
@@ -1,43 +1,5 @@
1
1
  // Jest Snapshot v1, https://goo.gl/fbAQLP
2
2
 
3
- exports[`PlayerDetails renders properly 1`] = `
4
- <View
5
- collapsable={false}
6
- style={
7
- {
8
- "backgroundColor": "transparent",
9
- "flex": 1,
10
- "marginTop": -8,
11
- "paddingTop": -8,
12
- "width": 750,
13
- }
14
- }
15
- >
16
- <View
17
- feed="test-source"
18
- riverComponents={[]}
19
- riverId="test-id"
20
- />
21
- </View>
22
- `;
3
+ exports[`PlayerDetails renders properly 1`] = `null`;
23
4
 
24
- exports[`PlayerDetails renders properly on tablet in landscape orientation 1`] = `
25
- <View
26
- collapsable={false}
27
- style={
28
- {
29
- "backgroundColor": "transparent",
30
- "flex": 1,
31
- "marginTop": -20,
32
- "paddingTop": 40,
33
- "width": 750,
34
- }
35
- }
36
- >
37
- <View
38
- feed="test-source"
39
- riverComponents={[]}
40
- riverId="test-id"
41
- />
42
- </View>
43
- `;
5
+ exports[`PlayerDetails renders properly on tablet in landscape orientation 1`] = `null`;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@applicaster/zapp-react-native-ui-components",
3
- "version": "13.0.0-alpha.5049772260",
3
+ "version": "13.0.0-alpha.5131435627",
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",
@@ -31,10 +31,10 @@
31
31
  "redux-mock-store": "^1.5.3"
32
32
  },
33
33
  "dependencies": {
34
- "@applicaster/applicaster-types": "13.0.0-alpha.5049772260",
35
- "@applicaster/zapp-react-native-bridge": "13.0.0-alpha.5049772260",
36
- "@applicaster/zapp-react-native-redux": "13.0.0-alpha.5049772260",
37
- "@applicaster/zapp-react-native-utils": "13.0.0-alpha.5049772260",
34
+ "@applicaster/applicaster-types": "13.0.0-alpha.5131435627",
35
+ "@applicaster/zapp-react-native-bridge": "13.0.0-alpha.5131435627",
36
+ "@applicaster/zapp-react-native-redux": "13.0.0-alpha.5131435627",
37
+ "@applicaster/zapp-react-native-utils": "13.0.0-alpha.5131435627",
38
38
  "promise": "^8.3.0",
39
39
  "react-router-native": "^5.1.2",
40
40
  "url": "^0.11.0",