@applicaster/zapp-react-native-ui-components 13.0.0-rc.110 → 13.0.0-rc.111

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.
@@ -22,7 +22,6 @@ type Props = {
22
22
  audio_player_title_color?: string;
23
23
  audio_player_summary_color?: string;
24
24
  audio_player_rtl?: boolean;
25
- magic_background?: boolean;
26
25
  audio_player_background_image_query?: string;
27
26
  audio_player_background_image_default_color?: string;
28
27
  start_time?: string;
@@ -34,7 +33,6 @@ type Props = {
34
33
  audio_player_title_color?: string;
35
34
  audio_player_summary_color?: string;
36
35
  audio_player_rtl?: string;
37
- magic_background?: string;
38
36
  audio_player_background_image_query?: string;
39
37
  audio_player_background_image_default_color?: string;
40
38
  audio_player_background_image?: string;
@@ -76,7 +74,6 @@ export function AudioPlayer(props: Props) {
76
74
  const artworkAspectRatio = getProp("audio_player_artwork_aspect_ratio");
77
75
  const channelIcon = getProp("audio_player_channel_icon");
78
76
  const rtlFlag = getProp("audio_player_rtl");
79
- const magicBackground = getProp("magic_background");
80
77
 
81
78
  const audioPlayerBackgroundImageQuery = getProp(
82
79
  "audio_player_background_image_query"
@@ -162,7 +159,6 @@ export function AudioPlayer(props: Props) {
162
159
  runTimeFontSize,
163
160
  artworkAspectRatio,
164
161
  channelIcon,
165
- magicBackground,
166
162
  audioPlayerBackgroundImageQuery,
167
163
  audioPlayerBackgroundImageDefaultColor,
168
164
  };
@@ -4,7 +4,6 @@ const defaults = {
4
4
  audio_player_background_color: "black",
5
5
  audio_player_artwork_aspect_ratio: "1:1",
6
6
  audio_player_rtl: false,
7
- magic_background: false,
8
7
  audio_player_background_image_query: "",
9
8
  audio_player_background_image_default_color: "",
10
9
  };
@@ -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>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@applicaster/zapp-react-native-ui-components",
3
- "version": "13.0.0-rc.110",
3
+ "version": "13.0.0-rc.111",
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-rc.110",
35
- "@applicaster/zapp-react-native-bridge": "13.0.0-rc.110",
36
- "@applicaster/zapp-react-native-redux": "13.0.0-rc.110",
37
- "@applicaster/zapp-react-native-utils": "13.0.0-rc.110",
34
+ "@applicaster/applicaster-types": "13.0.0-rc.111",
35
+ "@applicaster/zapp-react-native-bridge": "13.0.0-rc.111",
36
+ "@applicaster/zapp-react-native-redux": "13.0.0-rc.111",
37
+ "@applicaster/zapp-react-native-utils": "13.0.0-rc.111",
38
38
  "promise": "^8.3.0",
39
39
  "react-router-native": "^5.1.2",
40
40
  "url": "^0.11.0",