@applicaster/zapp-react-native-ui-components 12.0.0-rc.99 → 12.0.1

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.
Files changed (62) hide show
  1. package/Components/Cell/Cell.tsx +29 -10
  2. package/Components/Focusable/__tests__/index.android.test.tsx +72 -0
  3. package/Components/Focusable/index.android.tsx +15 -9
  4. package/Components/FocusableList/FocusableChild.ts +2 -2
  5. package/Components/FocusableList/index.tsx +11 -12
  6. package/Components/FocusableScrollView/index.tsx +1 -1
  7. package/Components/FreezeWithCallback/Freeze.tsx +31 -0
  8. package/Components/FreezeWithCallback/LICENSE +21 -0
  9. package/Components/FreezeWithCallback/Suspender.tsx +17 -0
  10. package/Components/FreezeWithCallback/__tests__/index.test.tsx +170 -0
  11. package/Components/FreezeWithCallback/index.tsx +3 -0
  12. package/Components/Image/Image.android.tsx +1 -1
  13. package/Components/MasterCell/DefaultComponents/ActionButton.tsx +11 -7
  14. package/Components/MasterCell/DefaultComponents/BorderContainerView/index.tsx +1 -7
  15. package/Components/MasterCell/DefaultComponents/CellBadge/index.tsx +6 -1
  16. package/Components/MasterCell/DefaultComponents/FocusableView/index.tsx +12 -0
  17. package/Components/MasterCell/DefaultComponents/Image/Image.ios.tsx +6 -5
  18. package/Components/MasterCell/DefaultComponents/Image/Image.web.tsx +2 -2
  19. package/Components/MasterCell/DefaultComponents/ImageBorderContainer/index.ts +71 -0
  20. package/Components/MasterCell/DefaultComponents/__tests__/image.test.js +1 -1
  21. package/Components/MasterCell/DefaultComponents/index.ts +2 -0
  22. package/Components/MasterCell/SharedUI/ProgressBar/hooks/useFillInPercent.ts +7 -1
  23. package/Components/MasterCell/dataAdapter.ts +21 -7
  24. package/Components/MasterCell/index.tsx +5 -3
  25. package/Components/MasterCell/utils/index.ts +3 -4
  26. package/Components/PlayerContainer/PlayerContainer.tsx +14 -8
  27. package/Components/Screen/TV/hooks/index.ts +0 -2
  28. package/Components/Screen/TV/index.web.tsx +32 -19
  29. package/Components/Screen/__tests__/Screen.test.tsx +0 -49
  30. package/Components/Screen/index.tsx +2 -20
  31. package/Components/Screen/navigationHandler.ts +1 -3
  32. package/Components/Screen/orientationHandler.ts +18 -7
  33. package/Components/Screen/utils.ts +16 -0
  34. package/Components/ScreenResolver/index.tsx +6 -11
  35. package/Components/Transitioner/Scene.tsx +9 -2
  36. package/Components/Transitioner/Transitioner.tsx +38 -23
  37. package/Components/Transitioner/__tests__/Scene.test.js +7 -0
  38. package/Components/Transitioner/__tests__/__snapshots__/transitioner.test.js.snap +1 -0
  39. package/Components/VideoLive/__tests__/__snapshots__/PlayerLiveImageComponent.test.tsx.snap +5 -0
  40. package/Components/VideoModal/ModalAnimation/AnimatedPlayerModalWrapper.tsx +3 -9
  41. package/Components/VideoModal/ModalAnimation/AnimatedScrollModal.tsx +87 -41
  42. package/Components/VideoModal/ModalAnimation/AnimatedVideoPlayerComponent.tsx +20 -9
  43. package/Components/VideoModal/ModalAnimation/AnimationComponent.tsx +41 -22
  44. package/Components/VideoModal/PlayerDetails.tsx +16 -2
  45. package/Components/VideoModal/PlayerWrapper.tsx +84 -66
  46. package/Components/VideoModal/VideoModal.tsx +33 -27
  47. package/Components/VideoModal/__tests__/PlayerDetails.test.tsx +7 -0
  48. package/Components/VideoModal/__tests__/__snapshots__/PlayerDetails.test.tsx.snap +2 -0
  49. package/Components/VideoModal/__tests__/__snapshots__/PlayerWrapper.test.tsx.snap +72 -10
  50. package/Components/ZappFrameworkComponents/BarView/BarView.tsx +7 -3
  51. package/Components/ZappFrameworkComponents/BarView/Buttons/BackButton.tsx +7 -2
  52. package/Components/ZappFrameworkComponents/BarView/Buttons/CloseButton.tsx +7 -2
  53. package/Components/ZappFrameworkComponents/BarView/__tests__/BarView.test.tsx +87 -0
  54. package/Components/ZappFrameworkComponents/Buttons/ActionButton.tsx +9 -4
  55. package/Components/default-cell-renderer/__tests__/__snapshots__/defaultCellRenderer.test.tsx.snap +4 -4
  56. package/Contexts/CachedDimensionsContext/index.ts +13 -9
  57. package/Contexts/ConfirmDialogState/index.ts +1 -1
  58. package/Contexts/ScreenContext/index.tsx +6 -1
  59. package/const.ts +6 -0
  60. package/index.js +3 -0
  61. package/package.json +5 -5
  62. package/Components/Screen/TV/hooks/useRestoreFocus.ts +0 -22
@@ -1,5 +1,6 @@
1
1
  import { create, useStore } from "zustand";
2
2
  import { produce } from "immer";
3
+ import { useCallback, useMemo } from "react";
3
4
 
4
5
  type Dimensions = {
5
6
  width: Option<number>;
@@ -31,16 +32,19 @@ export const useCachedDimensions = (id: string) => {
31
32
  dimensionsStore
32
33
  ) as DimensionsState;
33
34
 
34
- const getCachedDimensions = () => {
35
+ const getCachedDimensions = useCallback(() => {
35
36
  return dimensions[id] || initialDimensions();
36
- };
37
+ }, [dimensions?.[id], id]);
37
38
 
38
- const handleSetCachedDimensions = (newDimensions) => {
39
+ const handleSetCachedDimensions = useCallback((newDimensions) => {
39
40
  setCachedDimensions(id, newDimensions);
40
- };
41
-
42
- return {
43
- getCachedDimensions,
44
- setCachedDimensions: handleSetCachedDimensions,
45
- };
41
+ }, []);
42
+
43
+ return useMemo(
44
+ () => ({
45
+ getCachedDimensions,
46
+ setCachedDimensions: handleSetCachedDimensions,
47
+ }),
48
+ [getCachedDimensions, handleSetCachedDimensions]
49
+ );
46
50
  };
@@ -2,7 +2,7 @@ import { createStore } from "zustand/vanilla";
2
2
  import { useStore } from "zustand";
3
3
  import { noop } from "@applicaster/zapp-react-native-utils/functionUtils";
4
4
 
5
- interface ConfirmationDialogState {
5
+ export interface ConfirmationDialogState {
6
6
  isDialogVisible: boolean;
7
7
  messages: string;
8
8
  confirmAction: () => void;
@@ -177,7 +177,12 @@ export function withScreenContext(Component: React.ComponentType<any>) {
177
177
  return function WithScreenContextWrapper(props) {
178
178
  return (
179
179
  <ScreenContext.Consumer>
180
- {(value) => <Component {...props} screenContext={value} />}
180
+ {useCallback(
181
+ (value) => (
182
+ <Component {...props} screenContext={value} />
183
+ ),
184
+ [Component, props]
185
+ )}
181
186
  </ScreenContext.Consumer>
182
187
  );
183
188
  };
package/const.ts CHANGED
@@ -1,3 +1,5 @@
1
+ import { ViewStyle } from "react-native";
2
+
1
3
  export const tvPluginsWithCellRenderer = [
2
4
  "group-qb",
3
5
  "gallery-qb",
@@ -5,3 +7,7 @@ export const tvPluginsWithCellRenderer = [
5
7
  "hero-qb",
6
8
  "list-qb",
7
9
  ];
10
+
11
+ // Can't be used in StyleSheet.create, need to be inline/defined as a constant
12
+ // https://github.com/necolas/react-native-web/issues/1427
13
+ export const flatListOverflowStyle: ViewStyle = { overflow: "visible" };
package/index.js CHANGED
@@ -1,3 +1,6 @@
1
1
  import * as QuickBrickComponents from "./Components";
2
+ import { flatListOverflowStyle } from "./const";
3
+
4
+ export { flatListOverflowStyle };
2
5
 
3
6
  export default QuickBrickComponents;
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.99",
3
+ "version": "12.0.1",
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.99",
38
- "@applicaster/zapp-react-native-bridge": "12.0.0-rc.99",
39
- "@applicaster/zapp-react-native-redux": "12.0.0-rc.99",
40
- "@applicaster/zapp-react-native-utils": "12.0.0-rc.99",
37
+ "@applicaster/applicaster-types": "12.0.1",
38
+ "@applicaster/zapp-react-native-bridge": "12.0.1",
39
+ "@applicaster/zapp-react-native-redux": "12.0.1",
40
+ "@applicaster/zapp-react-native-utils": "12.0.1",
41
41
  "promise": "^8.3.0",
42
42
  "react-router-native": "^5.1.2",
43
43
  "url": "^0.11.0",
@@ -1,22 +0,0 @@
1
- import * as React from "react";
2
- import { isNil } from "ramda";
3
- import { useIsScreenActive } from "@applicaster/zapp-react-native-utils/reactHooks/navigation";
4
- import { usePrevious } from "@applicaster/zapp-react-native-utils/reactHooks/utils";
5
- import { focusManager } from "@applicaster/zapp-react-native-utils/appUtils/focusManager";
6
-
7
- export const useRestoreFocus = (): void => {
8
- const isScreenActive = useIsScreenActive();
9
- const previousIsScreenActive = usePrevious(isScreenActive);
10
-
11
- React.useEffect(() => {
12
- if (isNil(previousIsScreenActive)) {
13
- // it's initial mounting of the screen, do nothing here
14
- return;
15
- }
16
-
17
- if (!previousIsScreenActive && isScreenActive) {
18
- // restore focus when we go back from next screen
19
- focusManager.setInitialFocus();
20
- }
21
- }, [previousIsScreenActive, isScreenActive]);
22
- };