@applicaster/zapp-react-native-ui-components 12.0.0-rc.136 → 12.0.0-rc.137

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.
@@ -66,11 +66,9 @@ export function ActionButton(props: Props) {
66
66
  );
67
67
 
68
68
  useEffect(() => {
69
- if ((actionDisabled || !actionContext) && actionState !== null) {
70
- return null;
69
+ if (!((actionDisabled || !actionContext) && actionState !== null)) {
70
+ setActionState(actionContext.initialEntryState(item));
71
71
  }
72
-
73
- setActionState(actionContext.initialEntryState(item));
74
72
  }, [actionDisabled, item?.id, actionContext, action]);
75
73
 
76
74
  const onPress = useCallback(() => {
@@ -83,7 +81,7 @@ export function ActionButton(props: Props) {
83
81
 
84
82
  useEffect(() => {
85
83
  if (typeof actionContext?.addListener === "function") {
86
- return actionContext?.addListener(item.id as string, (state) => {
84
+ return actionContext?.addListener(String(item.id), (state) => {
87
85
  setActionState(state);
88
86
  });
89
87
  }
@@ -61,6 +61,7 @@ export const AnimatedScrollModalComponent = ({ children }: Props) => {
61
61
  setStartComponentsAnimation,
62
62
  } = useModalAnimationContext();
63
63
 
64
+ const [enableGesture, setIEnableGesture] = React.useState<boolean>(true);
64
65
  const { isLanguageOverlayVisible } = React.useContext(PlayerContainerContext);
65
66
 
66
67
  const { maximiseVideoModal, minimiseVideoModal, videoModalState } =
@@ -76,6 +77,7 @@ export const AnimatedScrollModalComponent = ({ children }: Props) => {
76
77
  playerAnimationState !== PlayerAnimationStateEnum.maximaze;
77
78
 
78
79
  const isEnablePanGesture =
80
+ enableGesture &&
79
81
  !isLanguageOverlayVisible &&
80
82
  isNotMinimizeMaximazeAnimation &&
81
83
  (isMaximazedModal || isMinimizedModal);
@@ -169,15 +171,31 @@ export const AnimatedScrollModalComponent = ({ children }: Props) => {
169
171
  scrollPosition.current = nativeEvent.contentOffset.y;
170
172
  }, []);
171
173
 
174
+ // Workaround for onMomentumScrollEnd issue
175
+ // https://github.com/facebook/react-native/issues/32696#issuecomment-1104217223
176
+ const canMomentum = React.useRef(false);
177
+
178
+ const onMomentumScrollBegin = React.useCallback(() => {
179
+ canMomentum.current = true;
180
+ }, []);
181
+
172
182
  const onMomentumScrollEnd = React.useCallback(
173
183
  ({ nativeEvent }) => {
174
- if (nativeEvent.contentOffset.y === 0 && !isActiveGesture) {
175
- resetScrollAnimatedValues(
176
- lastScrollY,
177
- lastScrollYValue,
178
- dragScrollY,
179
- dragVideoPlayerY
180
- );
184
+ if (canMomentum.current && !isActiveGesture) {
185
+ if (nativeEvent.contentOffset.y === 0) {
186
+ resetScrollAnimatedValues(
187
+ lastScrollY,
188
+ lastScrollYValue,
189
+ dragScrollY,
190
+ dragVideoPlayerY
191
+ );
192
+
193
+ setIEnableGesture(true);
194
+ } else {
195
+ setIEnableGesture(false);
196
+ }
197
+
198
+ canMomentum.current = false;
181
199
  }
182
200
  },
183
201
  [isActiveGesture]
@@ -199,6 +217,14 @@ export const AnimatedScrollModalComponent = ({ children }: Props) => {
199
217
  React.useEffect(() => {
200
218
  const { mode, previousMode, item } = videoModalState;
201
219
 
220
+ if (
221
+ mode === "MAXIMIZED" &&
222
+ !enableGesture &&
223
+ scrollPosition.current === 0
224
+ ) {
225
+ setIEnableGesture(true);
226
+ }
227
+
202
228
  if (mode === "MINIMIZED" && previousMode === "MAXIMIZED") {
203
229
  // set animation to the minimize values if moving from the player to another screen
204
230
  if (playerAnimationState === null) {
@@ -347,6 +373,7 @@ export const AnimatedScrollModalComponent = ({ children }: Props) => {
347
373
  bounces={false}
348
374
  onScrollBeginDrag={onRegisterLastScroll}
349
375
  onScroll={onScroll}
376
+ onMomentumScrollBegin={onMomentumScrollBegin}
350
377
  onMomentumScrollEnd={onMomentumScrollEnd}
351
378
  scrollEventThrottle={1}
352
379
  showsVerticalScrollIndicator={false}
@@ -42,12 +42,17 @@ export const AnimatedVideoPlayer = ({ children }: Props) => {
42
42
  } = useNavigation();
43
43
 
44
44
  const { isLanguageOverlayVisible } = React.useContext(PlayerContainerContext);
45
-
46
45
  const isMaximazedModal = videoModalMode === "MAXIMIZED";
47
46
  const isMinimizedModal = videoModalMode === "MINIMIZED";
48
47
 
48
+ const isNotMinimizeMaximazeAnimation =
49
+ playerAnimationState !== PlayerAnimationStateEnum.minimize &&
50
+ playerAnimationState !== PlayerAnimationStateEnum.maximaze;
51
+
49
52
  const isEnablePanGesture =
50
- !isLanguageOverlayVisible && (isMaximazedModal || isMinimizedModal);
53
+ !isLanguageOverlayVisible &&
54
+ isNotMinimizeMaximazeAnimation &&
55
+ (isMaximazedModal || isMinimizedModal);
51
56
 
52
57
  const onGestureEvent = Animated.event(
53
58
  [{ nativeEvent: { translationY: dragVideoPlayerY } }],
@@ -148,7 +153,6 @@ export const AnimatedVideoPlayer = ({ children }: Props) => {
148
153
  return (
149
154
  <PanGestureHandler
150
155
  enabled={isEnablePanGesture}
151
- shouldCancelWhenOutside={isMaximazedModal}
152
156
  onGestureEvent={onGestureEvent}
153
157
  onHandlerStateChange={onHandlerStateChange}
154
158
  >
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.136",
3
+ "version": "12.0.0-rc.137",
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.136",
38
- "@applicaster/zapp-react-native-bridge": "12.0.0-rc.136",
39
- "@applicaster/zapp-react-native-redux": "12.0.0-rc.136",
40
- "@applicaster/zapp-react-native-utils": "12.0.0-rc.136",
37
+ "@applicaster/applicaster-types": "12.0.0-rc.137",
38
+ "@applicaster/zapp-react-native-bridge": "12.0.0-rc.137",
39
+ "@applicaster/zapp-react-native-redux": "12.0.0-rc.137",
40
+ "@applicaster/zapp-react-native-utils": "12.0.0-rc.137",
41
41
  "promise": "^8.3.0",
42
42
  "react-router-native": "^5.1.2",
43
43
  "url": "^0.11.0",