@applicaster/zapp-react-native-ui-components 12.0.0-rc.31 → 12.0.0-rc.33

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.
@@ -202,7 +202,7 @@ export class CellComponent extends React.Component<Props> {
202
202
  groupId,
203
203
  isFocusable = true,
204
204
  skipFocusManagerRegistration,
205
- behavior
205
+ behavior,
206
206
  } = this.props;
207
207
 
208
208
  const { id } = item;
@@ -263,7 +263,7 @@ export class CellComponent extends React.Component<Props> {
263
263
  item,
264
264
  focused: this.isCellFocused(focused),
265
265
  scrollTo: this.scrollToIndex(event),
266
- behavior
266
+ behavior,
267
267
  }}
268
268
  />
269
269
  );
@@ -35,18 +35,18 @@ const useCellFocusedState = (groupId: string, id: string) => {
35
35
  };
36
36
 
37
37
  type Props = {
38
- item: ZappEntry,
39
- CellRenderer: React.ComponentType<{ item: Object, state: string }>,
40
- id: string,
41
- groupId: string,
42
- onFocus: Function,
43
- index: number,
44
- scrollTo: Function,
45
- preferredFocus?: boolean,
46
- skipFocusManagerRegistration?: boolean,
47
- isFocusable?: boolean,
48
- behavior: Behavior,
49
- selected?: boolean,
38
+ item: ZappEntry;
39
+ CellRenderer: React.ComponentType<{ item: Object; state: string }>;
40
+ id: string;
41
+ groupId: string;
42
+ onFocus: Function;
43
+ index: number;
44
+ scrollTo: Function;
45
+ preferredFocus?: boolean;
46
+ skipFocusManagerRegistration?: boolean;
47
+ isFocusable?: boolean;
48
+ behavior: Behavior;
49
+ selected?: boolean;
50
50
  };
51
51
 
52
52
  export function CellWithFocusable(props: Props) {
@@ -62,11 +62,18 @@ export function CellWithFocusable(props: Props) {
62
62
  skipFocusManagerRegistration,
63
63
  isFocusable,
64
64
  behavior,
65
- selected
65
+ selected,
66
66
  } = props;
67
67
 
68
68
  const isFocused = useCellFocusedState(groupId, id);
69
- const state = useCellState({ id: item.id, behavior, focused: isFocused, selected });
69
+
70
+ const state = useCellState({
71
+ id: item.id,
72
+ behavior,
73
+ focused: isFocused,
74
+ selected,
75
+ });
76
+
70
77
  const [focusedButtonId, setFocusedButtonId] = React.useState(undefined);
71
78
 
72
79
  // for horizontal scrolling
@@ -249,7 +249,7 @@ export class TvOSCellComponent extends React.Component<Props, State> {
249
249
  hasReceivedFocus,
250
250
  groupId,
251
251
  isFocusable,
252
- behavior
252
+ behavior,
253
253
  } = this.props;
254
254
 
255
255
  const { id } = item;
@@ -310,7 +310,7 @@ export class TvOSCellComponent extends React.Component<Props, State> {
310
310
  item,
311
311
  focused: this.props.focused || selectedCell || focused,
312
312
  scrollTo: this.scrollTo,
313
- behavior
313
+ behavior,
314
314
  }}
315
315
  />
316
316
  );
@@ -3,12 +3,12 @@ import { Platform } from "react-native";
3
3
  import { useCellState } from "../MasterCell/utils";
4
4
 
5
5
  type Props = {
6
- index: number,
7
- item: ZappEntry,
8
- focused: boolean,
9
- scrollTo?: (index: number) => void,
10
- CellRenderer: React.ComponentType<{ item: Object, state: string }>,
11
- behavior: Behavior
6
+ index: number;
7
+ item: ZappEntry;
8
+ focused: boolean;
9
+ scrollTo?: (index: number) => void;
10
+ CellRenderer: React.ComponentType<{ item: Object; state: string }>;
11
+ behavior: Behavior;
12
12
  };
13
13
 
14
14
  const isAndroid = Platform.OS === "android";
@@ -20,7 +20,7 @@ export function FocusableCell(props: Props) {
20
20
  CellRenderer,
21
21
  focused,
22
22
  scrollTo = null,
23
- behavior
23
+ behavior,
24
24
  } = props;
25
25
 
26
26
  const state = useCellState({ id: item.id, behavior, focused });
@@ -1,3 +1 @@
1
- import { HookRenderer as HookRendererComponent } from "./HookRenderer";
2
-
3
- export const HookRenderer = HookRendererComponent;
1
+ export { HookRenderer } from "./HookRenderer";
@@ -12,19 +12,7 @@ jest.mock("@applicaster/quick-brick-core/App/ActionSetters", () => ({
12
12
  useRiverInitialState: () => ({}),
13
13
  }));
14
14
 
15
- jest.mock("@applicaster/zapp-react-native-utils/reactHooks/screen", () => ({
16
- useCurrentScreenData: jest.fn(() => ({
17
- navigations: [
18
- {
19
- category: "menu",
20
- navigation_type: "menu",
21
- styles: {
22
- hide_secondary_level_menu: false,
23
- },
24
- },
25
- ],
26
- })),
27
- }));
15
+ jest.mock("@applicaster/zapp-react-native-utils/reactHooks/screen");
28
16
 
29
17
  const Layout = require("..").default;
30
18
 
@@ -23,7 +23,11 @@ export const Toggle = (props: Props) => {
23
23
  iosBackgroundColor,
24
24
  } = style;
25
25
 
26
- const isSelected = React.useMemo(() => (cellState === "selected"), [item?.id, cellState]);
26
+ const isSelected = React.useMemo(
27
+ () => cellState === "selected",
28
+ [item?.id, cellState]
29
+ );
30
+
27
31
  const actionContext = useActions(action?.identifier);
28
32
 
29
33
  const [actionState, setActionState] = useState(
@@ -285,8 +285,8 @@ export const useBehaviorUpdate = (behavior: Behavior) => {
285
285
  }
286
286
  }
287
287
  }, [behavior]);
288
-
289
- useEffect(() => {
288
+
289
+ useEffect(() => {
290
290
  if (!behavior) {
291
291
  return;
292
292
  }
@@ -78,7 +78,7 @@ export const getStyles = (config): Partial<TVTabsStyles> => {
78
78
  },
79
79
  tvos: {
80
80
  marginTop: -1,
81
- }
81
+ },
82
82
  }),
83
83
  },
84
84
  tabsBackground: {
@@ -1,249 +1,297 @@
1
1
  // Jest Snapshot v1, https://goo.gl/fbAQLP
2
2
 
3
3
  exports[`PlayerWrapper renders inline 1`] = `
4
- <RNCSafeAreaView
5
- edges={
6
- Object {
7
- "bottom": "off",
8
- "left": "off",
9
- "right": "off",
10
- "top": "additive",
11
- }
12
- }
4
+ <RNCSafeAreaProvider
5
+ onInsetsChange={[Function]}
13
6
  style={
14
7
  Array [
15
8
  Object {
16
- "flexDirection": "column",
17
- },
18
- Object {
19
- "backgroundColor": "transparent",
20
- },
21
- Object {
22
- "height": 800,
23
- "width": 300,
9
+ "flex": 1,
24
10
  },
25
- Object {},
11
+ undefined,
26
12
  ]
27
13
  }
28
14
  >
29
- <View
15
+ <RNCSafeAreaView
16
+ edges={
17
+ Object {
18
+ "bottom": "off",
19
+ "left": "off",
20
+ "right": "off",
21
+ "top": "additive",
22
+ }
23
+ }
30
24
  style={
31
25
  Array [
32
26
  Object {
33
- "alignSelf": "center",
34
- "position": "relative",
35
- "zIndex": 200,
27
+ "flexDirection": "column",
36
28
  },
37
29
  Object {
38
- "aspectRatio": 1.7777777777777777,
39
- "height": undefined,
40
- "width": "100%",
30
+ "backgroundColor": "transparent",
31
+ },
32
+ Object {
33
+ "height": 800,
34
+ "width": 300,
41
35
  },
42
- Object {},
43
36
  Object {},
44
37
  ]
45
38
  }
46
- testID="test-player-container"
47
- />
48
- <View
49
- configuration={
50
- Object {
51
- "tablet_landscape_player_container_background_color": "red",
52
- "tablet_landscape_sidebar_width": "35%",
39
+ >
40
+ <View
41
+ style={
42
+ Array [
43
+ Object {
44
+ "alignSelf": "center",
45
+ "position": "relative",
46
+ "zIndex": 200,
47
+ },
48
+ Object {
49
+ "aspectRatio": 1.7777777777777777,
50
+ "height": undefined,
51
+ "width": "100%",
52
+ },
53
+ Object {},
54
+ Object {},
55
+ ]
53
56
  }
54
- }
55
- entry={
56
- Object {
57
- "id": "test",
57
+ testID="test-player-container"
58
+ />
59
+ <View
60
+ configuration={
61
+ Object {
62
+ "tablet_landscape_player_container_background_color": "red",
63
+ "tablet_landscape_sidebar_width": "35%",
64
+ }
58
65
  }
59
- }
60
- isTabletLandscape={false}
61
- style={
62
- Object {
63
- "flex": 1,
64
- "paddingTop": 20,
66
+ entry={
67
+ Object {
68
+ "id": "test",
69
+ }
65
70
  }
66
- }
67
- />
68
- </RNCSafeAreaView>
71
+ isTabletLandscape={false}
72
+ style={
73
+ Object {
74
+ "flex": 1,
75
+ "paddingTop": 20,
76
+ }
77
+ }
78
+ />
79
+ </RNCSafeAreaView>
80
+ </RNCSafeAreaProvider>
69
81
  `;
70
82
 
71
83
  exports[`PlayerWrapper renders inline and docked 1`] = `
72
- <RNCSafeAreaView
73
- edges={
74
- Object {
75
- "bottom": "additive",
76
- "left": "off",
77
- "right": "off",
78
- "top": "off",
79
- }
80
- }
84
+ <RNCSafeAreaProvider
85
+ onInsetsChange={[Function]}
81
86
  style={
82
87
  Array [
83
88
  Object {
84
- "flexDirection": "column",
85
- },
86
- Object {
87
- "backgroundColor": "transparent",
88
- },
89
- Object {
90
- "height": 50,
91
- "width": 300,
89
+ "flex": 1,
92
90
  },
93
- Object {},
91
+ undefined,
94
92
  ]
95
93
  }
96
94
  >
97
- <View
95
+ <RNCSafeAreaView
96
+ edges={
97
+ Object {
98
+ "bottom": "additive",
99
+ "left": "off",
100
+ "right": "off",
101
+ "top": "off",
102
+ }
103
+ }
98
104
  style={
99
105
  Array [
100
106
  Object {
101
- "alignSelf": "center",
102
- "position": "relative",
103
- "zIndex": 200,
107
+ "flexDirection": "column",
108
+ },
109
+ Object {
110
+ "backgroundColor": "transparent",
104
111
  },
105
112
  Object {
106
- "aspectRatio": undefined,
107
113
  "height": 50,
108
- "width": "100%",
114
+ "width": 300,
109
115
  },
110
116
  Object {},
111
- Object {},
112
117
  ]
113
118
  }
114
- testID="test-player-container"
115
- />
116
- <View
117
- style={
118
- Object {
119
- "flex": 1,
120
- "paddingTop": 20,
119
+ >
120
+ <View
121
+ style={
122
+ Array [
123
+ Object {
124
+ "alignSelf": "center",
125
+ "position": "relative",
126
+ "zIndex": 200,
127
+ },
128
+ Object {
129
+ "aspectRatio": undefined,
130
+ "height": 50,
131
+ "width": "100%",
132
+ },
133
+ Object {},
134
+ Object {},
135
+ ]
121
136
  }
122
- }
123
- />
124
- </RNCSafeAreaView>
137
+ testID="test-player-container"
138
+ />
139
+ <View
140
+ style={
141
+ Object {
142
+ "flex": 1,
143
+ "paddingTop": 20,
144
+ }
145
+ }
146
+ />
147
+ </RNCSafeAreaView>
148
+ </RNCSafeAreaProvider>
125
149
  `;
126
150
 
127
151
  exports[`PlayerWrapper renders inline on tablet in landscape orientation 1`] = `
128
- <RNCSafeAreaView
129
- edges={
130
- Object {
131
- "bottom": "off",
132
- "left": "off",
133
- "right": "off",
134
- "top": "additive",
135
- }
136
- }
152
+ <RNCSafeAreaProvider
153
+ onInsetsChange={[Function]}
137
154
  style={
138
155
  Array [
139
156
  Object {
140
- "flexDirection": "row",
141
- },
142
- Object {
143
- "backgroundColor": "red",
144
- },
145
- Object {
146
- "height": 800,
147
- "width": 300,
157
+ "flex": 1,
148
158
  },
149
- Object {},
159
+ undefined,
150
160
  ]
151
161
  }
152
162
  >
153
- <View
163
+ <RNCSafeAreaView
164
+ edges={
165
+ Object {
166
+ "bottom": "off",
167
+ "left": "off",
168
+ "right": "off",
169
+ "top": "additive",
170
+ }
171
+ }
154
172
  style={
155
173
  Array [
156
174
  Object {
157
- "alignSelf": "center",
158
- "position": "relative",
159
- "zIndex": 200,
175
+ "flexDirection": "row",
160
176
  },
161
177
  Object {
162
- "aspectRatio": 1.7777777777777777,
163
- "height": undefined,
164
- "width": 195,
178
+ "backgroundColor": "red",
179
+ },
180
+ Object {
181
+ "height": 800,
182
+ "width": 300,
165
183
  },
166
- Object {},
167
184
  Object {},
168
185
  ]
169
186
  }
170
- testID="test-player-container"
171
- />
172
- <View
173
- configuration={
174
- Object {
175
- "tablet_landscape_player_container_background_color": "red",
176
- "tablet_landscape_sidebar_width": "35%",
187
+ >
188
+ <View
189
+ style={
190
+ Array [
191
+ Object {
192
+ "alignSelf": "center",
193
+ "position": "relative",
194
+ "zIndex": 200,
195
+ },
196
+ Object {
197
+ "aspectRatio": 1.7777777777777777,
198
+ "height": undefined,
199
+ "width": 195,
200
+ },
201
+ Object {},
202
+ Object {},
203
+ ]
177
204
  }
178
- }
179
- entry={
180
- Object {
181
- "id": "test",
205
+ testID="test-player-container"
206
+ />
207
+ <View
208
+ configuration={
209
+ Object {
210
+ "tablet_landscape_player_container_background_color": "red",
211
+ "tablet_landscape_sidebar_width": "35%",
212
+ }
182
213
  }
183
- }
184
- isTabletLandscape={true}
185
- style={
186
- Object {
187
- "flex": 1,
188
- "paddingTop": 20,
214
+ entry={
215
+ Object {
216
+ "id": "test",
217
+ }
189
218
  }
190
- }
191
- />
192
- </RNCSafeAreaView>
219
+ isTabletLandscape={true}
220
+ style={
221
+ Object {
222
+ "flex": 1,
223
+ "paddingTop": 20,
224
+ }
225
+ }
226
+ />
227
+ </RNCSafeAreaView>
228
+ </RNCSafeAreaProvider>
193
229
  `;
194
230
 
195
231
  exports[`PlayerWrapper renders properly 1`] = `
196
- <RNCSafeAreaView
197
- edges={
198
- Object {
199
- "bottom": "off",
200
- "left": "off",
201
- "right": "off",
202
- "top": "additive",
203
- }
204
- }
232
+ <RNCSafeAreaProvider
233
+ onInsetsChange={[Function]}
205
234
  style={
206
235
  Array [
207
236
  Object {
208
- "flexDirection": "column",
209
- },
210
- Object {
211
- "backgroundColor": "transparent",
212
- },
213
- Object {
214
- "height": 800,
215
- "width": 300,
237
+ "flex": 1,
216
238
  },
217
- Object {},
239
+ undefined,
218
240
  ]
219
241
  }
220
242
  >
221
- <View
243
+ <RNCSafeAreaView
244
+ edges={
245
+ Object {
246
+ "bottom": "off",
247
+ "left": "off",
248
+ "right": "off",
249
+ "top": "additive",
250
+ }
251
+ }
222
252
  style={
223
253
  Array [
224
254
  Object {
225
- "alignSelf": "center",
226
- "position": "relative",
227
- "zIndex": 200,
255
+ "flexDirection": "column",
228
256
  },
229
257
  Object {
230
- "aspectRatio": 1.7786666666666666,
231
- "height": undefined,
232
- "width": "100%",
258
+ "backgroundColor": "transparent",
259
+ },
260
+ Object {
261
+ "height": 800,
262
+ "width": 300,
233
263
  },
234
- Object {},
235
264
  Object {},
236
265
  ]
237
266
  }
238
- testID="test-player-container"
239
- />
240
- <View
241
- style={
242
- Object {
243
- "flex": 1,
244
- "paddingTop": 20,
267
+ >
268
+ <View
269
+ style={
270
+ Array [
271
+ Object {
272
+ "alignSelf": "center",
273
+ "position": "relative",
274
+ "zIndex": 200,
275
+ },
276
+ Object {
277
+ "aspectRatio": 1.7786666666666666,
278
+ "height": undefined,
279
+ "width": "100%",
280
+ },
281
+ Object {},
282
+ Object {},
283
+ ]
245
284
  }
246
- }
247
- />
248
- </RNCSafeAreaView>
285
+ testID="test-player-container"
286
+ />
287
+ <View
288
+ style={
289
+ Object {
290
+ "flex": 1,
291
+ "paddingTop": 20,
292
+ }
293
+ }
294
+ />
295
+ </RNCSafeAreaView>
296
+ </RNCSafeAreaProvider>
249
297
  `;
@@ -12,11 +12,16 @@ export function withComponentsMapProvider(Component: React.ComponentType<any>) {
12
12
  };
13
13
 
14
14
  const setComponentHeightById = (id: string | number, height: number) => {
15
- componentsHeightMapRef.current = { ...componentsHeightMapRef.current, [id]: height };
15
+ componentsHeightMapRef.current = {
16
+ ...componentsHeightMapRef.current,
17
+ [id]: height,
18
+ };
16
19
  };
17
20
 
18
21
  return (
19
- <ComponentsMapProvider {...{ setComponentHeightById, getComponentHeightById }}>
22
+ <ComponentsMapProvider
23
+ {...{ setComponentHeightById, getComponentHeightById }}
24
+ >
20
25
  <Component {...props} />
21
26
  </ComponentsMapProvider>
22
27
  );
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@applicaster/zapp-react-native-ui-components",
3
- "version": "12.0.0-rc.31",
3
+ "version": "12.0.0-rc.33",
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",
@@ -34,10 +34,10 @@
34
34
  "redux-mock-store": "^1.5.3"
35
35
  },
36
36
  "dependencies": {
37
- "@applicaster/applicaster-types": "12.0.0-rc.31",
38
- "@applicaster/zapp-react-native-bridge": "12.0.0-rc.31",
39
- "@applicaster/zapp-react-native-redux": "12.0.0-rc.31",
40
- "@applicaster/zapp-react-native-utils": "12.0.0-rc.31",
37
+ "@applicaster/applicaster-types": "12.0.0-rc.33",
38
+ "@applicaster/zapp-react-native-bridge": "12.0.0-rc.33",
39
+ "@applicaster/zapp-react-native-redux": "12.0.0-rc.33",
40
+ "@applicaster/zapp-react-native-utils": "12.0.0-rc.33",
41
41
  "promise": "^8.3.0",
42
42
  "react-router-native": "^5.1.2",
43
43
  "url": "^0.11.0",