@applicaster/zapp-react-native-ui-components 12.0.0-alpha.5040434238 → 12.0.0-alpha.5061452310

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.
@@ -52,20 +52,21 @@ export const AnimatedVideoPlayer = ({ children }: Props) => {
52
52
 
53
53
  if (videoModalState.mode === "MAXIMIZED") {
54
54
  if (translationY > 0) {
55
- const endOffsetY = lastSnap + preparedTranslationY + dragToss * velocityY + 150;
55
+ const endOffsetY =
56
+ lastSnap + preparedTranslationY + dragToss * velocityY + 150;
56
57
 
57
58
  let destSnapPoint = modalSnapPoints[0];
58
-
59
+
59
60
  for (const snapPoint of modalSnapPoints) {
60
61
  const distFromSnap = Math.abs(snapPoint - endOffsetY);
61
-
62
+
62
63
  if (distFromSnap < Math.abs(destSnapPoint - endOffsetY)) {
63
64
  destSnapPoint = snapPoint;
64
65
  }
65
66
  }
66
-
67
+
67
68
  setLastSnap(destSnapPoint);
68
-
69
+
69
70
  if (destSnapPoint === modalSnapPoints[0]) {
70
71
  setPlayerAnimationState(PlayerAnimationStateEnum.maximaze);
71
72
  } else {
@@ -88,24 +89,36 @@ export const AnimatedVideoPlayer = ({ children }: Props) => {
88
89
  };
89
90
 
90
91
  React.useEffect(() => {
91
- const dragVideoPlayerYListenerId = dragVideoPlayerY.addListener(({ value }) => {
92
- const preparedValue = Math.round(Math.abs(value));
93
-
94
- if (preparedValue > 0 && playerAnimationState !== PlayerAnimationStateEnum.drag_scroll) {
95
- playerAnimationState !== PlayerAnimationStateEnum.drag_player &&
96
- setPlayerAnimationState(PlayerAnimationStateEnum.drag_player);
97
-
98
- let animatedValue = preparedValue;
99
-
100
- if (isMaximazedModal) {
101
- animatedValue = value >= 0 ? preparedValue : modalSnapPoints[0];
102
- } else if (isMinimizedModal) {
103
- animatedValue = value <= 0 ? modalSnapPoints[1] - preparedValue : modalSnapPoints[1];
92
+ const dragVideoPlayerYListenerId = dragVideoPlayerY.addListener(
93
+ ({ value }) => {
94
+ if (
95
+ (isMinimizedModal && value >= 0) ||
96
+ (isMaximazedModal && value <= 0)
97
+ ) {
98
+ if (playerAnimationState === PlayerAnimationStateEnum.drag_player) {
99
+ translateYOffset.setValue(
100
+ modalSnapPoints[isMinimizedModal ? 1 : 0]
101
+ );
102
+ }
103
+ } else {
104
+ const preparedValue = Math.round(Math.abs(value));
105
+
106
+ if (
107
+ preparedValue > 0 &&
108
+ playerAnimationState !== PlayerAnimationStateEnum.drag_scroll
109
+ ) {
110
+ playerAnimationState !== PlayerAnimationStateEnum.drag_player &&
111
+ setPlayerAnimationState(PlayerAnimationStateEnum.drag_player);
112
+
113
+ translateYOffset.setValue(
114
+ isMaximazedModal
115
+ ? preparedValue
116
+ : modalSnapPoints[1] - preparedValue
117
+ );
118
+ }
104
119
  }
105
-
106
- translateYOffset.setValue(animatedValue);
107
120
  }
108
- });
121
+ );
109
122
 
110
123
  return () => {
111
124
  dragVideoPlayerY.removeListener(dragVideoPlayerYListenerId);
@@ -115,7 +128,7 @@ export const AnimatedVideoPlayer = ({ children }: Props) => {
115
128
  return (
116
129
  <PanGestureHandler
117
130
  enabled={isMaximazedModal || isMinimizedModal}
118
- shouldCancelWhenOutside={false}
131
+ shouldCancelWhenOutside={isMaximazedModal}
119
132
  onGestureEvent={onGestureEvent}
120
133
  onHandlerStateChange={onHandlerStateChange}
121
134
  >
@@ -125,9 +138,7 @@ export const AnimatedVideoPlayer = ({ children }: Props) => {
125
138
  };
126
139
 
127
140
  export const AnimatedVideoPlayerComponent = ({ children }: Props) => {
128
- const Component = !isTV()
129
- ? AnimatedVideoPlayer
130
- : React.Fragment;
141
+ const Component = !isTV() ? AnimatedVideoPlayer : React.Fragment;
131
142
 
132
143
  return <Component>{children}</Component>;
133
144
  };
@@ -1,7 +1,10 @@
1
1
  import React, { useRef, useState } from "react";
2
2
  import { Animated, View, StyleSheet } from "react-native";
3
3
 
4
- import { useSafeAreaInsets, useSafeAreaFrame } from "react-native-safe-area-context";
4
+ import {
5
+ useSafeAreaInsets,
6
+ useSafeAreaFrame,
7
+ } from "react-native-safe-area-context";
5
8
 
6
9
  import {
7
10
  useModalAnimationContext,
@@ -29,7 +32,7 @@ type Props = {
29
32
  animationType: string;
30
33
  children: React.ReactNode;
31
34
  style?: Record<string, any>;
32
- additionalData?: { [key: string]: any; };
35
+ additionalData?: { [key: string]: any };
33
36
  };
34
37
 
35
38
  const styles = StyleSheet.create({
@@ -56,8 +59,13 @@ export const AnimationView = ({
56
59
  } = useModalAnimationContext();
57
60
 
58
61
  const isRTL = useIsRTL();
59
- const { height: screenHeight, deviceInfo: { isTablet, isLandscapeTablet } } = useDimensions("screen", { deviceInfo: true });
60
- const startAnimationDistance = Math.round(screenHeight * 60 / 100);
62
+
63
+ const {
64
+ height: screenHeight,
65
+ deviceInfo: { isTablet, isTabletLandscape },
66
+ } = useDimensions("screen", { deviceInfo: true });
67
+
68
+ const startAnimationDistance = Math.round((screenHeight * 60) / 100);
61
69
  const { videoModalState } = useNavigation();
62
70
  const bottomTabBarHeight = useGetBottomTabBarHeight();
63
71
  const minimisedWidth = defaultAspectRatioWidth(minimisedHeight);
@@ -67,10 +75,12 @@ export const AnimationView = ({
67
75
 
68
76
  // retrieving top position of the player for tablet landscape mode
69
77
  const measureView = React.useCallback(() => {
70
- if (isLandscapeTablet && tabletLandscapePlayerTopPosition === 0) {
71
- animationComponentRef.current.measure((x, y, width, height, pageX, pageY) => {
72
- setTabletLandscapePlayerTopPosition(pageY - 20);
73
- });
78
+ if (isTabletLandscape && tabletLandscapePlayerTopPosition === 0) {
79
+ animationComponentRef.current.measure(
80
+ (x, y, width, height, pageX, pageY) => {
81
+ setTabletLandscapePlayerTopPosition(pageY - 20);
82
+ }
83
+ );
74
84
  }
75
85
  }, [tabletLandscapePlayerTopPosition]);
76
86
 
@@ -92,31 +102,47 @@ export const AnimationView = ({
92
102
  [videoModalState.item]
93
103
  );
94
104
 
95
- const moveUpValue = additionalData.saveArea ? -insets.top : (isTablet ? (isLandscapeTablet && !isAudioItem ? -tabletLandscapePlayerTopPosition : -130) : -50);
96
- const moveComponentHorizontalValue = additionalData.moveValue ? additionalData.moveValue : 0;
105
+ const inlineAudioPlayer = additionalData.inlineAudioPlayer;
97
106
 
98
- const calculationData = React.useMemo(() => ({
99
- isAudioItem,
100
- bottomTabBarHeight,
101
- minimisedHeight,
102
- minimisedWidth,
103
- defaultValue,
104
- moveUpValue,
105
- moveComponentHorizontalValue,
106
- isTablet,
107
- isLandscapeTablet,
108
- isRTL,
109
- fromMiniPlayer: videoModalState.mode === "MINIMIZED",
110
- }),
111
- [
112
- bottomTabBarHeight,
113
- minimisedHeight,
114
- minimisedWidth,
115
- defaultValue,
116
- moveUpValue,
117
- moveComponentHorizontalValue,
118
- videoModalState.mode,
119
- ]);
107
+ const moveUpValue = additionalData.saveArea
108
+ ? -insets.top
109
+ : isTablet
110
+ ? isTabletLandscape && (!isAudioItem || (isAudioItem && inlineAudioPlayer))
111
+ ? -tabletLandscapePlayerTopPosition
112
+ : -130
113
+ : -50;
114
+
115
+ const moveComponentHorizontalValue = additionalData.moveValue
116
+ ? isRTL
117
+ ? additionalData.moveValue
118
+ : -additionalData.moveValue
119
+ : 0;
120
+
121
+ const calculationData = React.useMemo(
122
+ () => ({
123
+ isAudioItem,
124
+ bottomTabBarHeight,
125
+ minimisedHeight,
126
+ minimisedWidth,
127
+ defaultValue,
128
+ moveUpValue,
129
+ moveComponentHorizontalValue,
130
+ isTablet,
131
+ isTabletLandscape,
132
+ isRTL,
133
+ fromMiniPlayer: videoModalState.mode === "MINIMIZED",
134
+ inlineAudioPlayer,
135
+ }),
136
+ [
137
+ bottomTabBarHeight,
138
+ minimisedHeight,
139
+ minimisedWidth,
140
+ defaultValue,
141
+ moveUpValue,
142
+ moveComponentHorizontalValue,
143
+ videoModalState.mode,
144
+ ]
145
+ );
120
146
 
121
147
  React.useEffect(() => {
122
148
  if (additionalData.resetAnimationValue) {
@@ -129,13 +155,19 @@ export const AnimationView = ({
129
155
  let width, height;
130
156
 
131
157
  if (additionalData.aspectRatio) {
132
- width = isLandscapeTablet ? additionalData.width : screenWidth;
133
- height = (isLandscapeTablet ? additionalData.width : screenWidth) / additionalData.aspectRatio;
158
+ width = isTabletLandscape ? additionalData.width : screenWidth;
159
+
160
+ height =
161
+ (isTabletLandscape ? additionalData.width : screenWidth) /
162
+ additionalData.aspectRatio;
134
163
  } else {
135
- width = typeof additionalData.width === "number" && additionalData.width;
136
- height = typeof additionalData.height === "number" && additionalData.height;
164
+ width =
165
+ typeof additionalData.width === "number" && additionalData.width;
166
+
167
+ height =
168
+ typeof additionalData.height === "number" && additionalData.height;
137
169
  }
138
-
170
+
139
171
  if (defaultValue.x === 0 && width && height) {
140
172
  const value = { x: width, y: height };
141
173
  setDefaultValue(value);
@@ -165,7 +197,10 @@ export const AnimationView = ({
165
197
 
166
198
  case ComponentAnimationType.player: {
167
199
  if (state === PlayerAnimationStateEnum.minimize) {
168
- const minWidth = isAudioItem ? minimisedHeight : minimisedWidth;
200
+ const minWidth =
201
+ isAudioItem && !inlineAudioPlayer
202
+ ? minimisedHeight
203
+ : minimisedWidth;
169
204
 
170
205
  return {
171
206
  ...defaultConfig,
@@ -216,10 +251,10 @@ export const AnimationView = ({
216
251
 
217
252
  return defaultConfig;
218
253
  }
219
-
254
+
220
255
  case ComponentAnimationType.moveComponentHorizontal: {
221
256
  if (state === PlayerAnimationStateEnum.minimize) {
222
- defaultConfig.toValue = isRTL ? moveComponentHorizontalValue : -moveComponentHorizontalValue;
257
+ defaultConfig.toValue = moveComponentHorizontalValue;
223
258
 
224
259
  return defaultConfig;
225
260
  }
@@ -231,7 +266,9 @@ export const AnimationView = ({
231
266
 
232
267
  case ComponentAnimationType.audioPlayerPaddingHorizontal: {
233
268
  if (state === PlayerAnimationStateEnum.minimize) {
234
- defaultConfig.toValue = AUDIO_PLAYER_HORIZONTAL_PADDING;
269
+ defaultConfig.toValue = isRTL
270
+ ? AUDIO_PLAYER_HORIZONTAL_PADDING
271
+ : -AUDIO_PLAYER_HORIZONTAL_PADDING;
235
272
 
236
273
  return defaultConfig;
237
274
  }
@@ -256,8 +293,11 @@ export const AnimationView = ({
256
293
  );
257
294
 
258
295
  React.useEffect(() => {
259
- if (playerAnimationState === PlayerAnimationStateEnum.minimize &&
260
- startComponentsAnimation && videoModalState.mode === "MAXIMIZED") {
296
+ if (
297
+ playerAnimationState === PlayerAnimationStateEnum.minimize &&
298
+ startComponentsAnimation &&
299
+ videoModalState.mode === "MAXIMIZED"
300
+ ) {
261
301
  Animated.timing(
262
302
  animatedValue,
263
303
  getAnimationValue(animationType, playerAnimationState)
@@ -265,31 +305,43 @@ export const AnimationView = ({
265
305
  } else if (playerAnimationState === PlayerAnimationStateEnum.maximaze) {
266
306
  animatedValue.setValue(defaultValue);
267
307
  }
268
- }, [playerAnimationState, startComponentsAnimation, videoModalState.mode, defaultValue]);
308
+ }, [
309
+ playerAnimationState,
310
+ startComponentsAnimation,
311
+ videoModalState.mode,
312
+ defaultValue,
313
+ ]);
269
314
 
270
315
  React.useEffect(() => {
271
- const dragVideoPlayerYListenerId = dragVideoPlayerY.addListener(({ value }) => {
272
- if (playerAnimationState === PlayerAnimationStateEnum.drag_player) {
273
- const preparedValue = Math.round(Math.abs(value));
274
-
275
- gestureListenerHelper({
276
- listenerValue: value,
277
- preparedValue,
278
- animationType,
279
- animatedValue,
280
- calculationData,
281
- modalSnapPoint: modalSnapPoints[1],
282
- startAnimationDistance,
283
- startComponentsAnimation,
284
- setStartComponentsAnimation,
285
- getAnimationValue,
286
- });
316
+ const dragVideoPlayerYListenerId = dragVideoPlayerY.addListener(
317
+ ({ value }) => {
318
+ if (playerAnimationState === PlayerAnimationStateEnum.drag_player) {
319
+ const preparedValue = Math.round(Math.abs(value));
320
+
321
+ gestureListenerHelper({
322
+ listenerValue: value,
323
+ preparedValue,
324
+ animationType,
325
+ animatedValue,
326
+ calculationData,
327
+ modalSnapPoint: modalSnapPoints[1],
328
+ startAnimationDistance,
329
+ startComponentsAnimation,
330
+ setStartComponentsAnimation,
331
+ getAnimationValue,
332
+ });
333
+ }
287
334
  }
288
- });
335
+ );
289
336
 
290
337
  const dragListenerId = dragScrollY.addListener(({ value }) => {
291
- if (scrollPosition.current === 0 && playerAnimationState === PlayerAnimationStateEnum.drag_scroll) {
292
- const preparedValue = Math.round(Math.abs(value) - lastScrollYValue.current);
338
+ if (
339
+ scrollPosition.current === 0 &&
340
+ playerAnimationState === PlayerAnimationStateEnum.drag_scroll
341
+ ) {
342
+ const preparedValue = Math.round(
343
+ Math.abs(value) - lastScrollYValue.current
344
+ );
293
345
 
294
346
  gestureListenerHelper({
295
347
  listenerValue: value,
@@ -305,7 +357,7 @@ export const AnimationView = ({
305
357
  });
306
358
  }
307
359
  });
308
-
360
+
309
361
  return () => {
310
362
  dragScrollY.removeListener(dragListenerId);
311
363
  dragVideoPlayerY.removeListener(dragVideoPlayerYListenerId);
@@ -321,7 +373,8 @@ export const AnimationView = ({
321
373
  style={[
322
374
  ...preparedStyles,
323
375
  additionalData.saveArea ? styles.flex : null,
324
- (videoModalState.mode === "MAXIMIZED" || videoModalState.mode === "MINIMIZED") &&
376
+ (videoModalState.mode === "MAXIMIZED" ||
377
+ videoModalState.mode === "MINIMIZED") &&
325
378
  getAnimationStyle(animationType, animatedValue),
326
379
  ]}
327
380
  >
@@ -337,7 +390,9 @@ export const AnimationComponent = (props: Props) => {
337
390
  videoModalState: { visible },
338
391
  } = useNavigation();
339
392
 
340
- const useAnimation = visible && !additionalData.disableAnimatedComponent && !isTV();
393
+ const useAnimation =
394
+ visible && !additionalData.disableAnimatedComponent && !isTV();
395
+
341
396
  const isReactFragment = !useAnimation && !style;
342
397
 
343
398
  const Component = useAnimation
@@ -346,11 +401,12 @@ export const AnimationComponent = (props: Props) => {
346
401
  ? View
347
402
  : React.Fragment;
348
403
 
349
- if (additionalData.extraAnimation &&
350
- typeof additionalData.extraAnimation === "object" &&
351
- !Array.isArray(additionalData.extraAnimation) &&
352
- !!Object.keys(additionalData.extraAnimation).length
353
- ) {
404
+ if (
405
+ additionalData.extraAnimation &&
406
+ typeof additionalData.extraAnimation === "object" &&
407
+ !Array.isArray(additionalData.extraAnimation) &&
408
+ !!Object.keys(additionalData.extraAnimation).length
409
+ ) {
354
410
  const animationType = Object.keys(additionalData.extraAnimation)[0];
355
411
  const animationProps = additionalData.extraAnimation[animationType] || {};
356
412
  delete additionalData.extraAnimation[animationType];
@@ -362,9 +418,12 @@ export const AnimationComponent = (props: Props) => {
362
418
  animationType={animationType}
363
419
  additionalData={{
364
420
  ...animationProps.additionalData,
365
- extraAnimation: !!Object.keys(additionalData.extraAnimation).length && additionalData.extraAnimation
366
- }}>
367
- {props.children}
421
+ extraAnimation:
422
+ !!Object.keys(additionalData.extraAnimation).length &&
423
+ additionalData.extraAnimation,
424
+ }}
425
+ >
426
+ {props.children}
368
427
  </AnimationComponent>
369
428
  </Component>
370
429
  );
@@ -69,19 +69,20 @@ const Provider = ({ children }: { children: React.ReactNode }) => {
69
69
  const [playerAnimationState, setPlayerAnimationState] =
70
70
  React.useState<PlayerAnimationStateT>(null);
71
71
 
72
- const [tabletLandscapePlayerTopPosition, setTabletLandscapePlayerTopPosition] =
73
- React.useState<number>(0);
72
+ const [
73
+ tabletLandscapePlayerTopPosition,
74
+ setTabletLandscapePlayerTopPosition,
75
+ ] = React.useState<number>(0);
74
76
 
75
- const [startComponentsAnimation, setStartComponentsAnimation] = React.useState<boolean>(false);
77
+ const [startComponentsAnimation, setStartComponentsAnimation] =
78
+ React.useState<boolean>(false);
76
79
 
77
80
  const { minimised_height: minimisedHeight } = useConfiguration();
78
81
 
79
- const resetPlayerAnimationState = React.useCallback(
80
- () => {
81
- setPlayerAnimationState(null);
82
- setStartComponentsAnimation(false);
83
- }, []
84
- );
82
+ const resetPlayerAnimationState = React.useCallback(() => {
83
+ setPlayerAnimationState(null);
84
+ setStartComponentsAnimation(false);
85
+ }, []);
85
86
 
86
87
  // Animated values
87
88
  const lastScrollY = React.useRef(new Animated.Value(0)).current;
@@ -69,11 +69,7 @@ export const getAnimationDefaultValue = (component, bottomTabBarHeight) => {
69
69
  }
70
70
  };
71
71
 
72
- export const calculateAnimationValue = (
73
- animationType,
74
- dragPosition,
75
- data
76
- ) => {
72
+ export const calculateAnimationValue = (animationType, dragPosition, data) => {
77
73
  const {
78
74
  isAudioItem,
79
75
  bottomTabBarHeight,
@@ -83,33 +79,55 @@ export const calculateAnimationValue = (
83
79
  moveUpValue,
84
80
  moveComponentHorizontalValue,
85
81
  isTablet,
86
- isLandscapeTablet,
82
+ isTabletLandscape,
87
83
  isRTL,
88
84
  fromMiniPlayer,
85
+ inlineAudioPlayer,
89
86
  } = data;
90
87
 
91
88
  switch (animationType) {
92
89
  case ComponentAnimationType.bottomBar: {
93
90
  if (fromMiniPlayer) {
94
- return dragPosition < bottomTabBarHeight ? dragPosition : bottomTabBarHeight;
91
+ return dragPosition < bottomTabBarHeight
92
+ ? dragPosition
93
+ : bottomTabBarHeight;
95
94
  }
96
95
 
97
- return dragPosition < bottomTabBarHeight ? bottomTabBarHeight - dragPosition : 0;
96
+ return dragPosition < bottomTabBarHeight
97
+ ? bottomTabBarHeight - dragPosition
98
+ : 0;
98
99
  }
99
100
 
100
101
  case ComponentAnimationType.player: {
101
- const value = isAudioItem
102
- ? (isLandscapeTablet ? (fromMiniPlayer ? { forWidth: 4, forHeight: 4.5 } : { forWidth: 3, forHeight: 3 }) : { forWidth: 2, forHeight: 2 })
103
- : (isLandscapeTablet ? { forWidth: 8, forHeight: 6.5 } : { forWidth: 3.5, forHeight: 2 });
104
-
105
- const minWidth = isAudioItem ? minimisedHeight : minimisedWidth;
102
+ const value =
103
+ isAudioItem && !inlineAudioPlayer
104
+ ? isTabletLandscape
105
+ ? fromMiniPlayer
106
+ ? { forWidth: 4, forHeight: 4.5 }
107
+ : { forWidth: 3, forHeight: 3 }
108
+ : { forWidth: 2, forHeight: 2 }
109
+ : isTabletLandscape
110
+ ? { forWidth: 8, forHeight: 6.5 }
111
+ : { forWidth: 3.5, forHeight: 2 };
112
+
113
+ const minWidth =
114
+ isAudioItem && !inlineAudioPlayer ? minimisedHeight : minimisedWidth;
106
115
 
107
116
  if (fromMiniPlayer) {
108
- const calculationWidth = dragPosition * value.forWidth < minWidth ? minWidth : dragPosition * value.forWidth;
109
- const calculationHeight = dragPosition * value.forHeight < minimisedHeight ? minimisedHeight : dragPosition * value.forHeight;
117
+ const calculationWidth =
118
+ dragPosition * value.forWidth < minWidth
119
+ ? minWidth
120
+ : dragPosition * value.forWidth;
121
+ const calculationHeight =
122
+ dragPosition * value.forHeight < minimisedHeight
123
+ ? minimisedHeight
124
+ : dragPosition * value.forHeight;
110
125
 
111
126
  return {
112
- x: calculationWidth < defaultValue.x ? calculationWidth : defaultValue.x,
127
+ x:
128
+ calculationWidth < defaultValue.x
129
+ ? calculationWidth
130
+ : defaultValue.x,
113
131
  y:
114
132
  calculationHeight < defaultValue.y
115
133
  ? calculationHeight
@@ -117,11 +135,9 @@ export const calculateAnimationValue = (
117
135
  };
118
136
  }
119
137
 
120
- const calculationWidth =
121
- defaultValue.x - dragPosition * value.forWidth;
138
+ const calculationWidth = defaultValue.x - dragPosition * value.forWidth;
122
139
 
123
- const calculationHeight =
124
- defaultValue.y - dragPosition * value.forHeight;
140
+ const calculationHeight = defaultValue.y - dragPosition * value.forHeight;
125
141
 
126
142
  return {
127
143
  x: calculationWidth > minWidth ? calculationWidth : minWidth,
@@ -158,38 +174,53 @@ export const calculateAnimationValue = (
158
174
 
159
175
  case ComponentAnimationType.moveUpComponent: {
160
176
  if (fromMiniPlayer) {
161
- const calculation = moveUpValue + (dragPosition / (isLandscapeTablet ? 1 : 4));
177
+ const calculation =
178
+ moveUpValue + dragPosition / (isTabletLandscape ? 1 : 4);
162
179
 
163
180
  return calculation < 0 ? calculation : 0;
164
181
  }
165
-
166
- const calculation = 0 - dragPosition / (isLandscapeTablet ? 1 : 2);
182
+
183
+ const calculation = 0 - dragPosition / (isTabletLandscape ? 1 : 2);
167
184
 
168
185
  return calculation > moveUpValue ? calculation : moveUpValue;
169
186
  }
170
187
 
171
188
  case ComponentAnimationType.moveComponentHorizontal: {
172
189
  if (fromMiniPlayer) {
173
- const calculation = moveComponentHorizontalValue - (dragPosition * 2);
190
+ const calculation = isRTL
191
+ ? moveComponentHorizontalValue - dragPosition * 2
192
+ : moveComponentHorizontalValue + dragPosition * 2;
193
+ const condition = isRTL ? calculation > 0 : calculation < 0;
174
194
 
175
- return calculation > 0 ? calculation : 0;
195
+ return condition ? calculation : 0;
176
196
  }
177
197
 
178
- const calculation = dragPosition * 2;
198
+ const calculation = isRTL ? dragPosition * 2 : -(dragPosition * 2);
199
+ const condition = isRTL
200
+ ? calculation < moveComponentHorizontalValue
201
+ : calculation > moveComponentHorizontalValue;
179
202
 
180
- return calculation < moveComponentHorizontalValue ? calculation : moveComponentHorizontalValue;
203
+ return condition ? calculation : moveComponentHorizontalValue;
181
204
  }
182
205
 
183
206
  case ComponentAnimationType.audioPlayerPaddingHorizontal: {
207
+ const padding = isRTL
208
+ ? AUDIO_PLAYER_HORIZONTAL_PADDING
209
+ : -AUDIO_PLAYER_HORIZONTAL_PADDING;
210
+
184
211
  if (fromMiniPlayer) {
185
- const calculation = AUDIO_PLAYER_HORIZONTAL_PADDING - (dragPosition / 5);
212
+ const calculation = isRTL
213
+ ? padding - dragPosition / 5
214
+ : padding + dragPosition / 5;
215
+ const condition = isRTL ? calculation > 0 : calculation < 0;
186
216
 
187
- return calculation > 0 ? calculation : 0;
217
+ return condition ? calculation : 0;
188
218
  }
189
219
 
190
- const calculation = dragPosition / 5;
220
+ const calculation = isRTL ? dragPosition / 5 : -(dragPosition / 5);
221
+ const condition = isRTL ? calculation < padding : calculation > padding;
191
222
 
192
- return calculation < AUDIO_PLAYER_HORIZONTAL_PADDING ? calculation : AUDIO_PLAYER_HORIZONTAL_PADDING;
223
+ return condition ? calculation : padding;
193
224
  }
194
225
  }
195
226
  };
@@ -210,7 +241,10 @@ export const gestureListenerHelper = (data) => {
210
241
 
211
242
  if (calculationData.fromMiniPlayer) {
212
243
  if (listenerValue <= 0) {
213
- if (preparedValue >= 0 && preparedValue <= (modalSnapPoint - startAnimationDistance)) {
244
+ if (
245
+ preparedValue >= 0 &&
246
+ preparedValue <= modalSnapPoint - startAnimationDistance
247
+ ) {
214
248
  !startComponentsAnimation && setStartComponentsAnimation(true);
215
249
 
216
250
  animatedValue.setValue(
@@ -218,11 +252,9 @@ export const gestureListenerHelper = (data) => {
218
252
  );
219
253
  } else {
220
254
  animatedValue.setValue(calculationData.defaultValue);
221
- startComponentsAnimation && setTimeout(() => setStartComponentsAnimation(false));
255
+ startComponentsAnimation && setStartComponentsAnimation(false);
222
256
  }
223
257
  } else {
224
- !startComponentsAnimation && setStartComponentsAnimation(true);
225
-
226
258
  const value = getAnimationValue(
227
259
  animationType,
228
260
  PlayerAnimationStateEnum.minimize
@@ -240,7 +272,7 @@ export const gestureListenerHelper = (data) => {
240
272
  );
241
273
  } else {
242
274
  animatedValue.setValue(calculationData.defaultValue);
243
- startComponentsAnimation && setTimeout(() => setStartComponentsAnimation(false));
275
+ startComponentsAnimation && setStartComponentsAnimation(false);
244
276
  }
245
277
  }
246
278
  };
@@ -258,7 +290,7 @@ export const resetScrollAnimatedValues = (
258
290
  lastScrollY,
259
291
  lastScrollYValue,
260
292
  dragScrollY,
261
- dragVideoPlayerY,
293
+ dragVideoPlayerY
262
294
  ) => {
263
295
  lastScrollY.setValue(0);
264
296
  lastScrollYValue.current = 0;
@@ -90,10 +90,7 @@ const safeAreaStyles = (
90
90
  };
91
91
  };
92
92
 
93
- const getEdges = (
94
- isTablet: boolean,
95
- isInlineModal: boolean
96
- ) => {
93
+ const getEdges = (isTablet: boolean, isInlineModal: boolean) => {
97
94
  if (isTablet) {
98
95
  return ["top"];
99
96
  }