@applicaster/zapp-react-native-ui-components 16.0.0-rc.37 → 16.0.0-rc.38

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.
@@ -1,6 +1,6 @@
1
1
  import * as React from "react";
2
2
  import { View } from "react-native";
3
- import { append, compose, identity, isNil, tail, take, update } from "ramda";
3
+ import { append, compose, identity, tail, take, update } from "ramda";
4
4
 
5
5
  import { AnimationManager } from "./AnimationManager";
6
6
  import { Scene } from "./Scene";
@@ -10,6 +10,7 @@ import {
10
10
  shouldSkipAnimationForPreviousWebViewScene,
11
11
  } from "./utils";
12
12
  import { v4 as uuid_v4 } from "uuid";
13
+ import { isScreenActiveForRoute } from "@applicaster/zapp-react-native-utils/reactHooks/navigation/useIsScreenActive";
13
14
 
14
15
  export const NAV_ACTION_PUSH = "PUSH";
15
16
 
@@ -50,16 +51,16 @@ function scenesForBackTransition(props: SceneProps, { scenes }) {
50
51
  : [prepareScene(props.children), scenes[0]];
51
52
  }
52
53
 
53
- const isModalClosed = (navigator) => {
54
- return !!isNil(navigator?.modalData);
55
- };
56
-
57
54
  type Props = {
58
55
  transitionConfig: any;
59
56
  children: React.ReactNode;
60
57
  navigator: {
61
58
  previousAction: string;
62
59
  currentRoute: string;
60
+ videoModalState?: {
61
+ visible?: boolean;
62
+ mode?: string;
63
+ };
63
64
  screenData: {
64
65
  [key: string]: any;
65
66
  };
@@ -283,8 +284,10 @@ export class TransitionerComponent extends React.PureComponent<Props, State> {
283
284
  // so only a single scene should be rendered,
284
285
  // instead of dangerous nulls or duplicates.
285
286
  renderSingleScene({ scenes, to }) {
286
- const { contentStyle } = this.props;
287
- const screenData = this.props.children.props.screenData;
287
+ const { contentStyle, navigator, children } = this.props;
288
+
289
+ const { currentRoute, videoModalState } = navigator;
290
+ const screenData = children.props.screenData;
288
291
  const pathname = scenes[to.index].key;
289
292
 
290
293
  return (
@@ -293,7 +296,11 @@ export class TransitionerComponent extends React.PureComponent<Props, State> {
293
296
  <Scene
294
297
  {...{ style: to?.style || {} }}
295
298
  pathname={pathname}
296
- isActive={pathname === this.props.navigator.currentRoute}
299
+ isActive={isScreenActiveForRoute(
300
+ pathname,
301
+ currentRoute,
302
+ videoModalState
303
+ )}
297
304
  contentStyle={contentStyle}
298
305
  key={scenes[to.index].key}
299
306
  screenUniqueId={scenes[to.index].screenUniqueId}
@@ -311,16 +318,19 @@ export class TransitionerComponent extends React.PureComponent<Props, State> {
311
318
  // Looks redundant, but when written like this
312
319
  // we do not need to pass or generate keys.
313
320
  renderScenes({ scenes, from, to }) {
314
- const { contentStyle } = this.props;
321
+ const { contentStyle, navigator } = this.props;
322
+
323
+ const { currentRoute, videoModalState } = navigator;
315
324
 
316
325
  const fromScene = scenes[from.index] && (
317
326
  <Scene
318
327
  key={scenes[from.index].key}
319
328
  pathname={scenes[from.index].key}
320
- isActive={
321
- scenes[from.index].key === this.props.navigator.currentRoute &&
322
- isModalClosed(this.props.navigator)
323
- }
329
+ isActive={isScreenActiveForRoute(
330
+ scenes[from.index].key,
331
+ currentRoute,
332
+ videoModalState
333
+ )}
324
334
  style={from.style}
325
335
  pointerEvents="none"
326
336
  overlayStyle={from.overlayStyle}
@@ -336,10 +346,11 @@ export class TransitionerComponent extends React.PureComponent<Props, State> {
336
346
  const toScene = scenes[to.index] && (
337
347
  <Scene
338
348
  pathname={scenes[to.index].key}
339
- isActive={
340
- scenes[to.index].key === this.props.navigator.currentRoute &&
341
- isModalClosed(this.props.navigator)
342
- }
349
+ isActive={isScreenActiveForRoute(
350
+ scenes[to.index].key,
351
+ currentRoute,
352
+ videoModalState
353
+ )}
343
354
  key={scenes[to.index].key}
344
355
  style={to.style}
345
356
  overlayStyle={to.overlayStyle}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@applicaster/zapp-react-native-ui-components",
3
- "version": "16.0.0-rc.37",
3
+ "version": "16.0.0-rc.38",
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",
@@ -28,10 +28,10 @@
28
28
  },
29
29
  "homepage": "https://github.com/applicaster/quickbrick#readme",
30
30
  "dependencies": {
31
- "@applicaster/applicaster-types": "16.0.0-rc.37",
32
- "@applicaster/zapp-react-native-bridge": "16.0.0-rc.37",
33
- "@applicaster/zapp-react-native-redux": "16.0.0-rc.37",
34
- "@applicaster/zapp-react-native-utils": "16.0.0-rc.37",
31
+ "@applicaster/applicaster-types": "16.0.0-rc.38",
32
+ "@applicaster/zapp-react-native-bridge": "16.0.0-rc.38",
33
+ "@applicaster/zapp-react-native-redux": "16.0.0-rc.38",
34
+ "@applicaster/zapp-react-native-utils": "16.0.0-rc.38",
35
35
  "fast-json-stable-stringify": "^2.1.0",
36
36
  "promise": "^8.3.0",
37
37
  "url": "^0.11.0",