@applicaster/zapp-react-native-ui-components 14.0.0-alpha.1235043154 → 14.0.0-alpha.1355728993

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 (56) hide show
  1. package/Components/AnimatedInOut/index.tsx +3 -5
  2. package/Components/AudioPlayer/{tv/index.tsx → AudioPlayer.tsx} +59 -12
  3. package/Components/AudioPlayer/{tv/Layout.tsx → AudioPlayerLayout.tsx} +72 -31
  4. package/Components/AudioPlayer/{mobile/__tests__/__snapshots__/audioPlayerMobileLayout.test.js.snap → __tests__/__snapshots__/audioPlayer.test.js.snap} +8 -2
  5. package/Components/AudioPlayer/__tests__/__snapshots__/audioPlayerLayout.test.js.snap +72 -0
  6. package/Components/AudioPlayer/{tv/__tests__ → __tests__}/audioPlayer.test.js +3 -7
  7. package/Components/AudioPlayer/__tests__/audioPlayerLayout.test.js +26 -0
  8. package/Components/AudioPlayer/{tv/helpers.tsx → helpers.tsx} +2 -1
  9. package/Components/AudioPlayer/index.ts +1 -0
  10. package/Components/Focusable/FocusableTvOS.tsx +3 -3
  11. package/Components/HandlePlayable/HandlePlayable.tsx +8 -14
  12. package/Components/MasterCell/elementMapper.tsx +2 -1
  13. package/Components/OfflineHandler/NotificationView/__tests__/index.test.tsx +18 -13
  14. package/Components/OfflineHandler/__tests__/__snapshots__/index.test.tsx.snap +0 -9
  15. package/Components/PlayerContainer/PlayerContainer.tsx +20 -8
  16. package/Components/PlayerImageBackground/index.tsx +1 -1
  17. package/Components/River/ComponentsMap/ComponentsMap.tsx +1 -0
  18. package/Components/River/TV/withTVEventHandler.tsx +1 -1
  19. package/Components/River/__tests__/__snapshots__/componentsMap.test.js.snap +0 -2
  20. package/Components/Touchable/__tests__/__snapshots__/touchable.test.tsx.snap +0 -34
  21. package/Components/Transitioner/__tests__/__snapshots__/Scene.test.js.snap +9 -15
  22. package/Components/VideoLive/animationUtils.ts +3 -3
  23. package/Components/VideoModal/ModalAnimation/ModalAnimationContext.tsx +9 -1
  24. package/Components/VideoModal/PlayerDetails.tsx +24 -2
  25. package/Components/VideoModal/PlayerWrapper.tsx +26 -142
  26. package/Components/VideoModal/VideoModal.tsx +3 -17
  27. package/Components/VideoModal/__tests__/PlayerWrapper.test.tsx +1 -7
  28. package/Components/VideoModal/__tests__/__snapshots__/PlayerWrapper.test.tsx.snap +44 -240
  29. package/Components/VideoModal/hooks/index.ts +0 -2
  30. package/Components/VideoModal/utils.ts +6 -0
  31. package/Components/Viewport/ViewportAware/__tests__/viewportAware.test.js +16 -12
  32. package/Components/Viewport/ViewportTracker/__tests__/viewportTracker.test.js +24 -84
  33. package/Decorators/ConfigurationWrapper/withConfigurationProvider.tsx +2 -2
  34. package/package.json +6 -5
  35. package/Components/AudioPlayer/index.tsx +0 -15
  36. package/Components/AudioPlayer/mobile/Layout.tsx +0 -66
  37. package/Components/AudioPlayer/mobile/__tests__/audioPlayerMobileLayout.test.js +0 -18
  38. package/Components/AudioPlayer/mobile/index.tsx +0 -18
  39. package/Components/AudioPlayer/tv/__tests__/__snapshots__/audioPlayer.test.js.snap +0 -170
  40. package/Components/AudioPlayer/types.ts +0 -40
  41. package/Components/VideoModal/hooks/useBackgroundColor.ts +0 -10
  42. /package/Components/AudioPlayer/{tv/Artwork.tsx → Artwork.tsx} +0 -0
  43. /package/Components/AudioPlayer/{tv/Channel.tsx → Channel.tsx} +0 -0
  44. /package/Components/AudioPlayer/{tv/Runtime.tsx → Runtime.tsx} +0 -0
  45. /package/Components/AudioPlayer/{tv/Summary.tsx → Summary.tsx} +0 -0
  46. /package/Components/AudioPlayer/{tv/Title.tsx → Title.tsx} +0 -0
  47. /package/Components/AudioPlayer/{tv/__tests__ → __tests__}/Runtime.test.js +0 -0
  48. /package/Components/AudioPlayer/{tv/__tests__ → __tests__}/__snapshots__/Runtime.test.js.snap +0 -0
  49. /package/Components/AudioPlayer/{tv/__tests__ → __tests__}/__snapshots__/artWork.test.js.snap +0 -0
  50. /package/Components/AudioPlayer/{tv/__tests__ → __tests__}/__snapshots__/channel.test.js.snap +0 -0
  51. /package/Components/AudioPlayer/{tv/__tests__ → __tests__}/__snapshots__/summary.test.js.snap +0 -0
  52. /package/Components/AudioPlayer/{tv/__tests__ → __tests__}/__snapshots__/title.test.js.snap +0 -0
  53. /package/Components/AudioPlayer/{tv/__tests__ → __tests__}/artWork.test.js +0 -0
  54. /package/Components/AudioPlayer/{tv/__tests__ → __tests__}/channel.test.js +0 -0
  55. /package/Components/AudioPlayer/{tv/__tests__ → __tests__}/summary.test.js +0 -0
  56. /package/Components/AudioPlayer/{tv/__tests__ → __tests__}/title.test.js +0 -0
@@ -4,11 +4,9 @@ import { usePrevious } from "@applicaster/zapp-react-native-utils/reactHooks/uti
4
4
  import { toBooleanWithDefaultFalse } from "@applicaster/zapp-react-native-utils/booleanUtils";
5
5
  import { noop } from "@applicaster/zapp-react-native-utils/functionUtils";
6
6
 
7
- type AnimatedInterpolatedStyle = any;
8
-
9
- // type AnimatedInterpolatedStyle =
10
- // | Animated.AnimatedInterpolation
11
- // | [{ [Key: string]: Animated.AnimatedInterpolation }];
7
+ type AnimatedInterpolatedStyle =
8
+ | Animated.AnimatedInterpolation
9
+ | [{ [Key: string]: Animated.AnimatedInterpolation }];
12
10
 
13
11
  type AnimationConfig = {
14
12
  duration: number;
@@ -1,24 +1,60 @@
1
1
  import React, { useCallback, useMemo } from "react";
2
2
 
3
3
  import { platformSelect } from "@applicaster/zapp-react-native-utils/reactUtils";
4
- import { useArtworkImage } from "@applicaster/zapp-react-native-utils/audioPlayerUtils";
5
4
 
6
- import { AudioPlayerTVLayout } from "./Layout";
5
+ import { imageSrcFromMediaItem } from "@applicaster/zapp-react-native-utils/configurationUtils";
7
6
 
7
+ import { AudioPlayerLayout } from "./AudioPlayerLayout";
8
8
  import { Channel } from "./Channel";
9
9
  import { Title } from "./Title";
10
10
  import { Summary } from "./Summary";
11
11
  import { Runtime } from "./Runtime";
12
12
  import { getPropertyFromEntryOrConfig } from "./helpers";
13
-
14
- import { Props } from "../types";
15
-
16
- export function AudioPlayerTV(props: Props) {
17
- const { audio_item, plugin_configuration, style = {} } = props;
13
+ import { ViewStyle } from "react-native";
14
+
15
+ type Props = {
16
+ audio_item: ZappEntry & {
17
+ extensions?: {
18
+ audio_player_artwork_aspect_ratio?: string;
19
+ audio_player_background_image?: string;
20
+ audio_player_background_color?: string;
21
+ audio_player_channel_icon?: string;
22
+ audio_player_title_color?: string;
23
+ audio_player_summary_color?: string;
24
+ audio_player_rtl?: boolean;
25
+ audio_player_background_image_default_color?: string;
26
+ start_time?: string;
27
+ end_time?: string;
28
+ };
29
+ };
30
+ plugin_configuration: {
31
+ audio_player_background_color?: string;
32
+ audio_player_title_color?: string;
33
+ audio_player_summary_color?: string;
34
+ audio_player_rtl?: string;
35
+ audio_player_background_image_default_color?: string;
36
+ audio_player_background_image?: string;
37
+ audio_player_artwork_aspect_ratio?: string;
38
+ lg_tv_audio_player_title_font_family?: string;
39
+ lg_tv_audio_player_title_font_size?: number;
40
+ lg_tv_audio_player_summary_font_family?: string;
41
+ lg_tv_audio_player_summary_font_size?: number;
42
+ samsung_tv_audio_player_title_font_family?: string;
43
+ samsung_tv_audio_player_title_font_size?: number;
44
+ samsung_tv_audio_player_summary_font_family?: string;
45
+ samsung_tv_audio_player_summary_font_size?: number;
46
+ tv_os_audio_player_title_font_family?: string;
47
+ tv_os_audio_player_title_font_size?: number;
48
+ tv_os_audio_player_summary_font_family?: string;
49
+ tv_os_audio_player_summary_font_size?: number;
50
+ };
51
+ style?: ViewStyle;
52
+ };
53
+
54
+ export function AudioPlayer(props: Props) {
55
+ const { audio_item, plugin_configuration } = props;
18
56
  const { extensions, title, summary } = audio_item;
19
57
 
20
- const artwork = useArtworkImage(audio_item);
21
-
22
58
  const getProp = useCallback(
23
59
  getPropertyFromEntryOrConfig({
24
60
  entry: audio_item,
@@ -28,15 +64,20 @@ export function AudioPlayerTV(props: Props) {
28
64
  );
29
65
 
30
66
  const config = useMemo(() => {
31
- // Checking if we are receiving items from the DSP
67
+ // Checking if we are recieving items from the DSP
32
68
  const titleColor = getProp("audio_player_title_color");
33
69
  const summaryColor = getProp("audio_player_summary_color");
34
70
  const backgroundColor = getProp("audio_player_background_color");
35
71
  const backgroundImage = getProp("audio_player_background_image");
72
+ const artworkAspectRatio = getProp("audio_player_artwork_aspect_ratio");
36
73
  const channelIcon = getProp("audio_player_channel_icon");
37
74
  const rtlFlag = getProp("audio_player_rtl");
38
75
  const artworkBorderRadius = getProp("audio_player_artwork_border_radius");
39
76
 
77
+ const audioPlayerBackgroundImageDefaultColor = getProp(
78
+ "audio_player_background_image_default_color"
79
+ );
80
+
40
81
  const isRTL = rtlFlag === "1" || rtlFlag === "true" || rtlFlag === true;
41
82
 
42
83
  const titleFontFamily = getProp(
@@ -111,17 +152,23 @@ export function AudioPlayerTV(props: Props) {
111
152
  summaryFontSize,
112
153
  runTimeFontFamily,
113
154
  runTimeFontSize,
155
+ artworkAspectRatio,
114
156
  channelIcon,
157
+ audioPlayerBackgroundImageDefaultColor,
115
158
  artworkBorderRadius,
116
159
  };
117
160
  }, [getProp]);
118
161
 
162
+ const artwork = imageSrcFromMediaItem(audio_item, [
163
+ config?.artworkAspectRatio,
164
+ ]);
165
+
119
166
  return (
120
- <AudioPlayerTVLayout artwork={artwork} config={config} style={style}>
167
+ <AudioPlayerLayout artwork={artwork} config={config}>
121
168
  <Channel srcImage={config?.channelIcon} config={config} />
122
169
  <Title title={title} config={config} />
123
170
  <Summary summary={summary} config={config} />
124
171
  <Runtime {...extensions} config={config} />
125
- </AudioPlayerTVLayout>
172
+ </AudioPlayerLayout>
126
173
  );
127
174
  }
@@ -1,5 +1,5 @@
1
- import * as React from "react";
2
- import { View, ImageBackground, ViewStyle } from "react-native";
1
+ import React, { useRef } from "react";
2
+ import { View, ImageBackground, Animated } from "react-native";
3
3
 
4
4
  import { platformSelect } from "@applicaster/zapp-react-native-utils/reactUtils";
5
5
 
@@ -7,30 +7,34 @@ import { Artwork } from "./Artwork";
7
7
  import { directionStyles } from "./helpers";
8
8
 
9
9
  type Props = {
10
- artwork: string;
10
+ artwork?: string;
11
11
  config: {
12
12
  titleColor: string;
13
13
  summaryColor: string;
14
14
  backgroundColor: string;
15
- backgroundImage: Option<string>;
15
+ backgroundImage: string;
16
16
  isRTL: boolean;
17
17
  artworkBorderRadius: Option<number>;
18
18
  };
19
19
  children: React.ReactNode;
20
- style: ViewStyle;
21
20
  };
22
21
 
23
- export function AudioPlayerTVLayout({
24
- artwork,
25
- config,
26
- children,
27
- style,
28
- }: Props) {
22
+ export function AudioPlayerLayout({ artwork, config, children }: Props) {
23
+ const fadeAnimation = useRef(new Animated.Value(0)).current;
24
+
25
+ const fadeAudioPlayerIn = () => {
26
+ Animated.timing(fadeAnimation, {
27
+ toValue: 1,
28
+ duration: 3000,
29
+ useNativeDriver: true,
30
+ }).start();
31
+ };
32
+
29
33
  const { isRTL, backgroundColor, backgroundImage } = config;
30
34
 
31
- const backgroundImageSource = { uri: backgroundImage };
35
+ const backgroundImageSource = { uri: backgroundImage || artwork };
32
36
 
33
- const backgroundColorStyle = backgroundImage
37
+ const backgroundColorStyle = backgroundImageSource.uri
34
38
  ? "transparent"
35
39
  : backgroundColor;
36
40
 
@@ -62,7 +66,8 @@ export function AudioPlayerTVLayout({
62
66
  native: {
63
67
  backgroundColor: backgroundColorStyle,
64
68
  overflow: "hidden",
65
- ...style,
69
+ width: "100%",
70
+ height: "100%",
66
71
  },
67
72
  samsung_tv: {
68
73
  position: "absolute",
@@ -114,6 +119,9 @@ export function AudioPlayerTVLayout({
114
119
  alignItems: "center",
115
120
  justifyContent: "center",
116
121
  },
122
+ native: {
123
+ flex: 1,
124
+ },
117
125
  });
118
126
 
119
127
  const textContainerStyles = platformSelect({
@@ -137,25 +145,58 @@ export function AudioPlayerTVLayout({
137
145
  },
138
146
  });
139
147
 
140
- if (backgroundImage) {
141
- return (
142
- <ImageBackground
143
- source={backgroundImageSource}
144
- style={backgroundImgStyles}
145
- resizeMode="cover"
146
- >
147
- <View style={mainContainerStyles}>
148
- <Artwork srcImage={artwork} config={config} />
149
- <View style={textContainerStyles}>{children}</View>
150
- </View>
151
- </ImageBackground>
152
- );
153
- }
154
-
155
- return (
148
+ const audioPlayerLayoutTV = backgroundImageSource?.uri ? (
149
+ <ImageBackground
150
+ source={backgroundImageSource}
151
+ style={backgroundImgStyles}
152
+ resizeMode="cover"
153
+ >
154
+ <View style={mainContainerStyles}>
155
+ {!!artwork && <Artwork srcImage={artwork} config={config} />}
156
+ <View style={textContainerStyles}>{children}</View>
157
+ </View>
158
+ </ImageBackground>
159
+ ) : (
156
160
  <View style={mainContainerStyles}>
157
- <Artwork srcImage={artwork} config={config} />
161
+ {!!artwork && <Artwork srcImage={artwork} config={config} />}
158
162
  <View style={textContainerStyles}>{children}</View>
159
163
  </View>
160
164
  );
165
+
166
+ const audioPlayerLayoutMobile = () => {
167
+ fadeAudioPlayerIn();
168
+
169
+ return (
170
+ <View style={mainContainerStyles} pointerEvents="none">
171
+ <Animated.View
172
+ style={[
173
+ mainContainerStyles,
174
+ {
175
+ opacity: fadeAnimation,
176
+ },
177
+ ]}
178
+ >
179
+ <ImageBackground
180
+ source={backgroundImageSource}
181
+ style={backgroundImgStyles}
182
+ resizeMode="cover"
183
+ >
184
+ <View style={mainContainerStyles} />
185
+ </ImageBackground>
186
+ </Animated.View>
187
+ </View>
188
+ );
189
+ };
190
+
191
+ const audioPlayerLayout = platformSelect({
192
+ tvos: audioPlayerLayoutTV,
193
+ android_tv: audioPlayerLayoutTV,
194
+ web: audioPlayerLayoutTV,
195
+ samsung_tv: audioPlayerLayoutTV,
196
+ lg_tv: audioPlayerLayoutTV,
197
+ ios: audioPlayerLayoutMobile(),
198
+ android: audioPlayerLayoutMobile(),
199
+ });
200
+
201
+ return audioPlayerLayout;
161
202
  }
@@ -1,12 +1,14 @@
1
1
  // Jest Snapshot v1, https://goo.gl/fbAQLP
2
2
 
3
- exports[`<AudioPlayerMobileLayout /> renders correctly 1`] = `
3
+ exports[`<AudioPlayer /> renders correctly 1`] = `
4
4
  <View
5
5
  pointerEvents="none"
6
6
  style={
7
7
  {
8
8
  "backgroundColor": "transparent",
9
+ "height": "100%",
9
10
  "overflow": "hidden",
11
+ "width": "100%",
10
12
  }
11
13
  }
12
14
  >
@@ -15,8 +17,10 @@ exports[`<AudioPlayerMobileLayout /> renders correctly 1`] = `
15
17
  style={
16
18
  {
17
19
  "backgroundColor": "transparent",
20
+ "height": "100%",
18
21
  "opacity": 0,
19
22
  "overflow": "hidden",
23
+ "width": "100%",
20
24
  }
21
25
  }
22
26
  >
@@ -32,7 +36,7 @@ exports[`<AudioPlayerMobileLayout /> renders correctly 1`] = `
32
36
  resizeMode="cover"
33
37
  source={
34
38
  {
35
- "uri": "background_image_url",
39
+ "uri": "https://example.com",
36
40
  }
37
41
  }
38
42
  style={
@@ -56,7 +60,9 @@ exports[`<AudioPlayerMobileLayout /> renders correctly 1`] = `
56
60
  style={
57
61
  {
58
62
  "backgroundColor": "transparent",
63
+ "height": "100%",
59
64
  "overflow": "hidden",
65
+ "width": "100%",
60
66
  }
61
67
  }
62
68
  />
@@ -0,0 +1,72 @@
1
+ // Jest Snapshot v1, https://goo.gl/fbAQLP
2
+
3
+ exports[`<AudioPlayerLayout /> renders correctly 1`] = `
4
+ <View
5
+ pointerEvents="none"
6
+ style={
7
+ {
8
+ "backgroundColor": "transparent",
9
+ "height": "100%",
10
+ "overflow": "hidden",
11
+ "width": "100%",
12
+ }
13
+ }
14
+ >
15
+ <View
16
+ collapsable={false}
17
+ style={
18
+ {
19
+ "backgroundColor": "transparent",
20
+ "height": "100%",
21
+ "opacity": 0,
22
+ "overflow": "hidden",
23
+ "width": "100%",
24
+ }
25
+ }
26
+ >
27
+ <View
28
+ accessibilityIgnoresInvertColors={true}
29
+ style={
30
+ {
31
+ "flex": 1,
32
+ }
33
+ }
34
+ >
35
+ <Image
36
+ resizeMode="cover"
37
+ source={
38
+ {
39
+ "uri": "https://example.com",
40
+ }
41
+ }
42
+ style={
43
+ [
44
+ {
45
+ "bottom": 0,
46
+ "left": 0,
47
+ "position": "absolute",
48
+ "right": 0,
49
+ "top": 0,
50
+ },
51
+ {
52
+ "height": undefined,
53
+ "width": undefined,
54
+ },
55
+ undefined,
56
+ ]
57
+ }
58
+ />
59
+ <View
60
+ style={
61
+ {
62
+ "backgroundColor": "transparent",
63
+ "height": "100%",
64
+ "overflow": "hidden",
65
+ "width": "100%",
66
+ }
67
+ }
68
+ />
69
+ </View>
70
+ </View>
71
+ </View>
72
+ `;
@@ -1,11 +1,7 @@
1
1
  import React from "react";
2
2
  import { render } from "@testing-library/react-native";
3
3
 
4
- import { AudioPlayerTV } from "..";
5
-
6
- jest.mock("@applicaster/zapp-react-native-utils/audioPlayerUtils", () => ({
7
- useArtworkImage: jest.fn(() => "artwork_url"),
8
- }));
4
+ import { AudioPlayer } from "../AudioPlayer";
9
5
 
10
6
  const audioPlayerProps = {
11
7
  audio_item: {
@@ -49,9 +45,9 @@ const audioPlayerProps = {
49
45
  styles: {},
50
46
  };
51
47
 
52
- describe("<AudioPlayerTV />", () => {
48
+ describe("<AudioPlayer />", () => {
53
49
  it("renders correctly", () => {
54
- const { toJSON } = render(<AudioPlayerTV {...audioPlayerProps} />);
50
+ const { toJSON } = render(<AudioPlayer {...audioPlayerProps} />);
55
51
  expect(toJSON()).toMatchSnapshot();
56
52
  });
57
53
  });
@@ -0,0 +1,26 @@
1
+ import React from "react";
2
+ import { render } from "@testing-library/react-native";
3
+
4
+ import { AudioPlayerLayout } from "../AudioPlayerLayout";
5
+
6
+ const audioPlayerLayoutProps = {
7
+ artwork: "string",
8
+ config: {
9
+ titleColor: "white",
10
+ summaryColor: "white",
11
+ backgroundColor: "black",
12
+ backgroundImage: "https://example.com",
13
+ isRTL: true,
14
+ },
15
+ children: [],
16
+ };
17
+
18
+ describe("<AudioPlayerLayout />", () => {
19
+ it("renders correctly", () => {
20
+ const { toJSON } = render(
21
+ <AudioPlayerLayout {...audioPlayerLayoutProps} />
22
+ );
23
+
24
+ expect(toJSON()).toMatchSnapshot();
25
+ });
26
+ });
@@ -2,8 +2,9 @@ const defaults = {
2
2
  audio_player_title_color: "white",
3
3
  audio_player_summary_color: "white",
4
4
  audio_player_background_color: "black",
5
- audio_player_background_image: undefined,
5
+ audio_player_artwork_aspect_ratio: "1:1",
6
6
  audio_player_rtl: false,
7
+ audio_player_background_image_default_color: "",
7
8
  };
8
9
 
9
10
  export function getPropertyFromEntryOrConfig({ entry, plugin_configuration }) {
@@ -0,0 +1 @@
1
+ export { AudioPlayer } from "./AudioPlayer";
@@ -16,9 +16,9 @@ function noop() {}
16
16
  type Props = {
17
17
  id: string;
18
18
  groupId: string;
19
- onPress?: (nativeEvent: any) => void;
20
- onFocus?: (nativeEvent: any) => void;
21
- onBlur?: (nativeEvent: any) => void;
19
+ onPress?: (nativeEvent: React.SyntheticEvent) => void;
20
+ onFocus?: (nativeEvent: React.SyntheticEvent) => void;
21
+ onBlur?: (nativeEvent: React.SyntheticEvent) => void;
22
22
  children: (focused?: boolean) => React.ReactNode;
23
23
  isParallaxDisabled: boolean;
24
24
  preferredFocus?: boolean;
@@ -13,7 +13,6 @@ import {
13
13
  import { BufferAnimation } from "../PlayerContainer/BufferAnimation";
14
14
  import { PlayerContainer } from "../PlayerContainer";
15
15
  import { useModalSize } from "../VideoModal/hooks";
16
- import { ViewStyle } from "react-native";
17
16
 
18
17
  type Props = {
19
18
  item: ZappEntry;
@@ -141,19 +140,14 @@ export function HandlePlayable({
141
140
  const modalSize = useModalSize();
142
141
 
143
142
  const style = React.useMemo(
144
- () =>
145
- ({
146
- width: isModal
147
- ? modalSize.width
148
- : mode === "PIP"
149
- ? "100%"
150
- : screenWidth,
151
- height: isModal
152
- ? modalSize.height
153
- : mode === "PIP"
154
- ? "100%"
155
- : screenHeight,
156
- }) as ViewStyle,
143
+ () => ({
144
+ width: isModal ? modalSize.width : mode === "PIP" ? "100%" : screenWidth,
145
+ height: isModal
146
+ ? modalSize.height
147
+ : mode === "PIP"
148
+ ? "100%"
149
+ : screenHeight,
150
+ }),
157
151
  [screenWidth, screenHeight, modalSize, isModal, mode]
158
152
  );
159
153
 
@@ -73,6 +73,7 @@ export function elementMapper(
73
73
  : {};
74
74
 
75
75
  const componentProps = {
76
+ key,
76
77
  style,
77
78
  skipButtons: otherProps?.skipButtons,
78
79
  emitAsyncElementRegistrate: otherProps?.emitAsyncElementRegistrate,
@@ -90,7 +91,7 @@ export function elementMapper(
90
91
  const fn = mapElementWithKey(elementMapper(components, otherProps));
91
92
 
92
93
  return (
93
- <Component key={key} {...componentProps}>
94
+ <Component {...componentProps}>
94
95
  {focusableTypes.has(type) && elements.length > 0
95
96
  ? elements.map(fn)
96
97
  : null}
@@ -1,12 +1,9 @@
1
1
  import React from "react";
2
2
  import { Text, Animated } from "react-native";
3
- import { render } from "@testing-library/react-native";
4
3
 
5
- import {
6
- NotificationView,
7
- onlinePhrase,
8
- offlinePhrase,
9
- } from "../NotificationView";
4
+ import renderer from "react-test-renderer";
5
+
6
+ jest.useFakeTimers();
10
7
 
11
8
  jest.mock("@applicaster/zapp-react-native-redux/hooks", () => ({
12
9
  usePickFromState: () => ({
@@ -35,31 +32,39 @@ jest.mock("react-native-safe-area-context", () => ({
35
32
 
36
33
  const dismiss = jest.fn();
37
34
 
35
+ const {
36
+ NotificationView,
37
+ onlinePhrase,
38
+ offlinePhrase,
39
+ } = require("../NotificationView");
40
+
38
41
  describe("NotificationView", () => {
39
42
  it("Show online message when Online", () => {
40
- const component = render(<NotificationView online dismiss={dismiss} />);
43
+ const component = renderer.create(
44
+ <NotificationView online dismiss={dismiss} />
45
+ );
41
46
 
42
- expect(component.UNSAFE_getByType(Text).props.children).toBe(onlinePhrase);
47
+ expect(component.root.findByType(Text).props.children).toBe(onlinePhrase);
43
48
  });
44
49
 
45
50
  it("Show offline message when Online", () => {
46
- const component = render(
51
+ const component = renderer.create(
47
52
  <NotificationView online={false} dismiss={dismiss} />
48
53
  );
49
54
 
50
- expect(component.UNSAFE_getByType(Text).props.children).toBe(offlinePhrase);
55
+ expect(component.root.findByType(Text).props.children).toBe(offlinePhrase);
51
56
  });
52
57
 
53
58
  it("When hidden is false to true notification is visible", () => {
54
- const component = render(
59
+ const component = renderer.create(
55
60
  <NotificationView online={false} hidden={false} dismiss={dismiss} />
56
61
  );
57
62
 
58
- component.rerender(
63
+ component.update(
59
64
  <NotificationView online={false} hidden={true} dismiss={dismiss} />
60
65
  );
61
66
 
62
- const animatedView = component.UNSAFE_getByType(Animated.View);
67
+ const animatedView = component.root.findByType(Animated.View);
63
68
  const animatedViewStyles = animatedView.props.style;
64
69
 
65
70
  expect(animatedViewStyles.opacity).toBe(1);
@@ -21,15 +21,6 @@ exports[`OfflineHandler renders 1`] = `
21
21
  }
22
22
  >
23
23
  <View
24
- accessibilityState={
25
- {
26
- "busy": undefined,
27
- "checked": undefined,
28
- "disabled": undefined,
29
- "expanded": undefined,
30
- "selected": undefined,
31
- }
32
- }
33
24
  accessible={true}
34
25
  collapsable={false}
35
26
  focusable={true}