react-native-screen-transitions 3.0.0 → 3.1.0

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.
package/README.md CHANGED
@@ -211,51 +211,85 @@ import { interpolate } from "react-native-reanimated";
211
211
 
212
212
  ### Interpolator Props
213
213
 
214
- | Prop | Description |
215
- | ----------------------- | -------------------------------------------------------- |
216
- | `progress` | Combined progress (0-2). 0=entering, 1=active, 2=exiting |
217
- | `stackProgress` | Accumulated progress across entire stack (0, 1, 2, 3...) |
218
- | `current` | Current screen state (progress, closing, gesture, meta) |
219
- | `previous` | Previous screen state (may be undefined) |
220
- | `next` | Next screen state (may be undefined) |
221
- | `layouts.screen` | Screen dimensions `{ width, height }` |
222
- | `insets` | Safe area insets `{ top, right, bottom, left }` |
223
- | `focused` | Whether current screen is the topmost |
224
- | `active` | The screen driving the transition |
225
- | `isActiveTransitioning` | Whether active screen is animating |
226
- | `isDismissing` | Whether active screen is being dismissed |
227
- | `bounds` | Function to access shared element positions |
228
-
229
- ### Screen State (`current`, `previous`, `next`)
214
+ | Prop | Description |
215
+ | ---------------- | -------------------------------------------------------- |
216
+ | `progress` | Combined progress (0-2). 0=entering, 1=active, 2=exiting |
217
+ | `stackProgress` | Accumulated progress across entire stack (0, 1, 2, 3...) |
218
+ | `current` | Current screen state (progress, closing, gesture, meta) |
219
+ | `previous` | Previous screen state (may be undefined) |
220
+ | `next` | Next screen state (may be undefined) |
221
+ | `layouts.screen` | Screen dimensions `{ width, height }` |
222
+ | `insets` | Safe area insets `{ top, right, bottom, left }` |
223
+ | `focused` | Whether current screen is the topmost |
224
+ | `active` | The screen driving the transition |
225
+ | `inactive` | The screen NOT driving the transition |
226
+ | `bounds` | Function to access shared element positions |
227
+
228
+ ### Screen State (`current`, `previous`, `next`, `active`, `inactive`)
230
229
 
231
230
  Each screen state contains:
232
231
 
233
- | Property | Description |
234
- | ---------- | -------------------------------------------------- |
235
- | `progress` | Animation progress for this screen (0 or 1) |
236
- | `closing` | Whether screen is closing (0 or 1) |
237
- | `animating`| Whether screen is currently animating (0 or 1) |
238
- | `gesture` | Gesture values (x, y, normalizedX, normalizedY, etc.) |
239
- | `meta` | Custom metadata from screen options |
232
+ | Property | Description |
233
+ | ----------- | ----------------------------------------------------- |
234
+ | `progress` | Animation progress for this screen (0 or 1) |
235
+ | `closing` | Whether screen is closing (0 or 1) |
236
+ | `animating` | Whether screen is currently animating (0 or 1) |
237
+ | `gesture` | Gesture values (x, y, normalizedX, normalizedY, etc.) |
238
+ | `meta` | Custom metadata from screen options |
239
+
240
+ ### Understanding `active` and `inactive`
241
+
242
+ The `active` and `inactive` props help you write cleaner conditional logic:
243
+
244
+ - **`active`** – The screen driving the transition. When focused, this is `current`. When not focused, this is `next`.
245
+ - **`inactive`** – The screen NOT driving the transition. When focused, this is `previous`. When not focused, this is `current`.
246
+
247
+ ```tsx
248
+ // Check if the inactive screen wants to disable an animation
249
+ const disableTranslateY = props.inactive?.meta?.disableTranslateYAnimation;
250
+
251
+ // Check if the active screen is animating or closing
252
+ const isAnimating = props.active.animating;
253
+ const isClosing = props.active.closing;
254
+ ```
240
255
 
241
256
  ### Using `meta` for Conditional Logic
242
257
 
243
258
  Use `meta` to pass custom data for conditional animation logic. This is more robust than checking route names:
244
259
 
245
260
  ```tsx
246
- // In screen options
261
+ // Screen A sets meta to affect how Screen B animates
247
262
  <Stack.Screen
248
- name="Detail"
263
+ name="ScreenA"
264
+ options={{
265
+ meta: { disableTranslateYAnimation: true },
266
+ }}
267
+ />
268
+
269
+ // Screen B checks inactive screen's meta
270
+ <Stack.Screen
271
+ name="ScreenB"
249
272
  options={{
250
- meta: { scalesOthers: true },
251
- screenStyleInterpolator: ({ progress }) => {
273
+ screenStyleInterpolator: (props) => {
252
274
  "worklet";
253
- return { contentStyle: { opacity: progress } };
275
+
276
+ // When entering from ScreenA, inactive = ScreenA (previous)
277
+ // When going back to ScreenA, inactive = ScreenB (current)
278
+ const disableY = props.inactive?.meta?.disableTranslateYAnimation;
279
+
280
+ return {
281
+ contentStyle: {
282
+ transform: [{ translateY: disableY ? 0 : translateY }],
283
+ },
284
+ };
254
285
  },
255
286
  }}
256
287
  />
288
+ ```
289
+
290
+ You can also react to screen state changes within components:
257
291
 
258
- // In a component on a previous screen
292
+ ```tsx
259
293
  const animation = useScreenAnimation();
260
294
 
261
295
  useAnimatedReaction(
@@ -390,11 +424,11 @@ screenStyleInterpolator: ({ bounds, progress }) => {
390
424
  };
391
425
  ```
392
426
 
393
- | Method | Description |
394
- | ------------------------------------------ | ----------------------------------------------------- |
395
- | `bounds.getLink(id)` | Get source/destination bounds and styles for a tag |
396
- | `bounds.interpolateStyle(id, prop, fallback?)` | Interpolate a numeric style between source and dest |
397
- | `bounds.getSnapshot(id, key)` | Manual lookup by specific screen key (edge cases) |
427
+ | Method | Description |
428
+ | ---------------------------------------------- | --------------------------------------------------- |
429
+ | `bounds.getLink(id)` | Get source/destination bounds and styles for a tag |
430
+ | `bounds.interpolateStyle(id, prop, fallback?)` | Interpolate a numeric style between source and dest |
431
+ | `bounds.getSnapshot(id, key)` | Manual lookup by specific screen key (edge cases) |
398
432
 
399
433
  ---
400
434
 
@@ -508,15 +542,15 @@ An overlay that moves with screen content:
508
542
 
509
543
  ### Overlay Props
510
544
 
511
- | Prop | Description |
512
- | ------------------ | ------------------------------------------------------------ |
513
- | `focusedRoute` | Currently focused route |
514
- | `focusedIndex` | Index of focused screen |
515
- | `routes` | All routes in the stack |
516
- | `meta` | Custom metadata passed from screen options |
517
- | `navigation` | Navigation prop |
518
- | `overlayAnimation` | Animation values with `progress` accumulated across stack |
519
- | `screenAnimation` | Animation values for the current focused screen |
545
+ | Prop | Description |
546
+ | ------------------ | --------------------------------------------------------- |
547
+ | `focusedRoute` | Currently focused route |
548
+ | `focusedIndex` | Index of focused screen |
549
+ | `routes` | All routes in the stack |
550
+ | `meta` | Custom metadata passed from screen options |
551
+ | `navigation` | Navigation prop |
552
+ | `overlayAnimation` | Animation values with `progress` accumulated across stack |
553
+ | `screenAnimation` | Animation values for the current focused screen |
520
554
 
521
555
  ### Passing Custom Data
522
556
 
@@ -616,10 +650,12 @@ transitionSpec: {
616
650
 
617
651
  ## Masked View Setup
618
652
 
619
- Required for `SharedIGImage` and `SharedAppleMusic` presets.
653
+ Required for `SharedIGImage` and `SharedAppleMusic` presets. The masked view creates the "reveal" effect where content appears to expand from the shared element.
620
654
 
621
655
  > **Note**: Requires native code. Will not work in Expo Go.
622
656
 
657
+ ### Installation
658
+
623
659
  ```bash
624
660
  # Expo
625
661
  npx expo install @react-native-masked-view/masked-view
@@ -629,18 +665,100 @@ npm install @react-native-masked-view/masked-view
629
665
  cd ios && pod install
630
666
  ```
631
667
 
632
- Wrap destination screen content:
668
+ ### Complete Example
669
+
670
+ Here's a full example showing how to set up an Apple Music-style shared element transition:
671
+
672
+ **1. Source Screen** – Tag pressable elements with `sharedBoundTag`:
673
+
674
+ ```tsx
675
+ // app/index.tsx
676
+ import { router } from "expo-router";
677
+ import { View } from "react-native";
678
+ import Transition from "react-native-screen-transitions";
679
+
680
+ export default function HomeScreen() {
681
+ return (
682
+ <View style={{ flex: 1, alignItems: "center", justifyContent: "center" }}>
683
+ <Transition.Pressable
684
+ sharedBoundTag="album-art"
685
+ style={{
686
+ width: 200,
687
+ height: 200,
688
+ backgroundColor: "#1DB954",
689
+ borderRadius: 12,
690
+ }}
691
+ onPress={() => {
692
+ router.push({
693
+ pathname: "/details",
694
+ params: { sharedBoundTag: "album-art" },
695
+ });
696
+ }}
697
+ />
698
+ </View>
699
+ );
700
+ }
701
+ ```
702
+
703
+ **2. Destination Screen** – Wrap content with `MaskedView` and match the `sharedBoundTag`:
633
704
 
634
705
  ```tsx
635
- export default function DetailScreen() {
706
+ // app/details.tsx
707
+ import { useLocalSearchParams } from "expo-router";
708
+ import Transition from "react-native-screen-transitions";
709
+
710
+ export default function DetailsScreen() {
711
+ const { sharedBoundTag } = useLocalSearchParams<{ sharedBoundTag: string }>();
712
+
636
713
  return (
637
- <Transition.MaskedView style={{ flex: 1 }}>
638
- {/* screen content */}
714
+ <Transition.MaskedView style={{ flex: 1, backgroundColor: "#121212" }}>
715
+ <Transition.View
716
+ sharedBoundTag={sharedBoundTag}
717
+ style={{
718
+ backgroundColor: "#1DB954",
719
+ width: 400,
720
+ height: 400,
721
+ alignSelf: "center",
722
+ borderRadius: 12,
723
+ }}
724
+ />
725
+ {/* Additional screen content */}
639
726
  </Transition.MaskedView>
640
727
  );
641
728
  }
642
729
  ```
643
730
 
731
+ **3. Layout** – Apply the shared element preset with dynamic `sharedBoundTag`:
732
+
733
+ ```tsx
734
+ // app/_layout.tsx
735
+ import Transition from "react-native-screen-transitions";
736
+ import { Stack } from "./stack";
737
+
738
+ export default function RootLayout() {
739
+ return (
740
+ <Stack>
741
+ <Stack.Screen name="index" />
742
+ <Stack.Screen
743
+ name="details"
744
+ options={({ route }) => ({
745
+ ...Transition.Presets.SharedAppleMusic({
746
+ sharedBoundTag: route.params?.sharedBoundTag ?? "",
747
+ }),
748
+ })}
749
+ />
750
+ </Stack>
751
+ );
752
+ }
753
+ ```
754
+
755
+ ### How It Works
756
+
757
+ 1. `Transition.Pressable` measures its bounds when pressed and stores them with the `sharedBoundTag`
758
+ 2. `Transition.View` on the destination screen registers as the target for that tag
759
+ 3. `Transition.MaskedView` clips the destination content to the animating shared element bounds
760
+ 4. The preset interpolates position, size, and the mask to create the seamless expand/collapse effect
761
+
644
762
  ---
645
763
 
646
764
  ## Native Stack
@@ -725,6 +843,19 @@ To avoid collisions with custom gesture options, some native options are renamed
725
843
 
726
844
  ---
727
845
 
846
+ ## Migrating from Earlier Versions
847
+
848
+ ### Deprecated Props
849
+
850
+ The following props are deprecated and will be removed in a future version:
851
+
852
+ | Deprecated Prop | Use Instead |
853
+ | ----------------------- | ------------------ |
854
+ | `isActiveTransitioning` | `active.animating` |
855
+ | `isDismissing` | `active.closing` |
856
+
857
+ ---
858
+
728
859
  ## Support
729
860
 
730
861
  This package is developed in my spare time. Updates and bug fixes may take time.
@@ -98,6 +98,7 @@ function _useScreenAnimation() {
98
98
  progress,
99
99
  ...helpers
100
100
  } = (0, _derivations.derivations)({
101
+ previous,
101
102
  current,
102
103
  next
103
104
  });
@@ -1 +1 @@
1
- {"version":3,"names":["_react","require","_reactNative","_reactNativeReanimated","_reactNativeSafeAreaContext","_constants","_flags","_keys","_routes","_animation","_gesture","_computeStackProgress","_derivations","_bounds","createScreenTransitionState","route","meta","progress","closing","animating","gesture","x","y","normalizedX","normalizedY","isDismissing","isDragging","direction","unwrapInto","s","out","unwrapped","value","useBuildScreenTransitionState","descriptor","key","options","useMemo","undefined","AnimationStore","getAnimation","GestureStore","getRouteGestures","hasTransitionsEnabled","alwaysOn","enableTransitions","_useScreenAnimation","dimensions","useWindowDimensions","insets","useSafeAreaInsets","flags","useFlagsContext","transitionsAlwaysOn","TRANSITIONS_ALWAYS_ON","current","currentDescriptor","next","nextDescriptor","previous","previousDescriptor","useKeys","currentAnimation","nextAnimation","prevAnimation","currentRouteKey","stackAnimationValues","useStackAnimationValues","screenInterpolatorProps","useDerivedValue","DEFAULT_SCREEN_TRANSITION_STATE","helpers","derivations","stackProgress","computeStackProgress","layouts","screen","nextInterpolator","screenStyleInterpolator","currentInterpolator","useScreenAnimation","props","bounds","createBounds"],"sourceRoot":"../../../../../src","sources":["shared/hooks/animation/use-screen-animation.tsx"],"mappings":";;;;;;;AACA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,sBAAA,GAAAF,OAAA;AACA,IAAAG,2BAAA,GAAAH,OAAA;AAEA,IAAAI,UAAA,GAAAJ,OAAA;AACA,IAAAK,MAAA,GAAAL,OAAA;AACA,IAAAM,KAAA,GAAAN,OAAA;AAIA,IAAAO,OAAA,GAAAP,OAAA;AACA,IAAAQ,UAAA,GAAAR,OAAA;AACA,IAAAS,QAAA,GAAAT,OAAA;AAMA,IAAAU,qBAAA,GAAAV,OAAA;AACA,I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MAC/BE,MAAM;MACNU,QAAQ;MACRJ,OAAO;MACPE,IAAI;MACJxC,QAAQ;MACRwD,aAAa;MACb,GAAGF;IACJ,CAAC;EACF,CAAC,CAAC;EAEF,MAAMM,gBAAgB,GAAGnB,cAAc,EAAEtB,OAAO,CAAC0C,uBAAuB;EACxE,MAAMC,mBAAmB,GACxBvB,iBAAiB,EAAEpB,OAAO,CAAC0C,uBAAuB;EAEnD,MAAMA,uBAAuB,GAAGD,gBAAgB,IAAIE,mBAAmB;EAEvE,OAAO;IAAEX,uBAAuB;IAAEU;EAAwB,CAAC;AAC5D;AAEO,SAASE,kBAAkBA,CAAA,EAAG;EACpC,MAAM;IAAEZ;EAAwB,CAAC,GAAGtB,mBAAmB,CAAC,CAAC;EAEzD,OAAO,IAAAuB,sCAAe,EAA2B,MAAM;IACtD,MAAMY,KAAK,GAAGb,uBAAuB,CAACpC,KAAK;IAC3C,OAAO;MACN,GAAGiD,KAAK;MACRC,MAAM,EAAE,IAAAC,oBAAY,EAACF,KAAK;IAC3B,CAAC;EACF,CAAC,CAAC;AACH","ignoreList":[]}
1
+ {"version":3,"names":["_react","require","_reactNative","_reactNativeReanimated","_reactNativeSafeAreaContext","_constants","_flags","_keys","_routes","_animation","_gesture","_computeStackProgress","_derivations","_bounds","createScreenTransitionState","route","meta","progress","closing","animating","gesture","x","y","normalizedX","normalizedY","isDismissing","isDragging","direction","unwrapInto","s","out","unwrapped","value","useBuildScreenTransitionState","descriptor","key","options","useMemo","undefined","AnimationStore","getAnimation","GestureStore","getRouteGestures","hasTransitionsEnabled","alwaysOn","enableTransitions","_useScreenAnimation","dimensions","useWindowDimensions","insets","useSafeAreaInsets","flags","useFlagsContext","transitionsAlwaysOn","TRANSITIONS_ALWAYS_ON","current","currentDescriptor","next","nextDescriptor","previous","previousDescriptor","useKeys","currentAnimation","nextAnimation","prevAnimation","currentRouteKey","stackAnimationValues","useStackAnimationValues","screenInterpolatorProps","useDerivedValue","DEFAULT_SCREEN_TRANSITION_STATE","helpers","derivations","stackProgress","computeStackProgress","layouts","screen","nextInterpolator","screenStyleInterpolator","currentInterpolator","useScreenAnimation","props","bounds","createBounds"],"sourceRoot":"../../../../../src","sources":["shared/hooks/animation/use-screen-animation.tsx"],"mappings":";;;;;;;AACA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,sBAAA,GAAAF,OAAA;AACA,IAAAG,2BAAA,GAAAH,OAAA;AAEA,IAAAI,UAAA,GAAAJ,OAAA;AACA,IAAAK,MAAA,GAAAL,OAAA;AACA,IAAAM,KAAA,GAAAN,OAAA;AAIA,IAAAO,OAAA,GAAAP,OAAA;AACA,IAAAQ,UAAA,GAAAR,OAAA;AACA,IAAAS,QAAA,GAAAT,OAAA;AAMA,IAAAU,qBAAA,GAAAV,OAAA;AACA,IAAAW,YAAA,GAAAX,OAAA;AACA,IAAAY,OAAA,GAAAZ,OAAA;AAYA,MAAMa,2BAA2B,GAAGA,CACnCC,KAA+B,EAC/BC,IAA8B,MACF;EAC5BC,QAAQ,EAAE,CAAC;EACXC,OAAO,EAAE,CAAC;EACVC,SAAS,EAAE,CAAC;EACZC,OAAO,EAAE;IACRC,CAAC,EAAE,CAAC;IACJC,CAAC,EAAE,CAAC;IACJC,WAAW,EAAE,CAAC;IACdC,WAAW,EAAE,CAAC;IACdC,YAAY,EAAE,CAAC;IACfC,UAAU,EAAE,CAAC;IACbC,SAAS,EAAE;EACZ,CAAC;EACDZ,KAAK;EACLC;AACD,CAAC,CAAC;AAEF,MAAMY,UAAU,GAAIC,CAAa,IAA4B;EAC5D,SAAS;;EACT,MAAMC,GAAG,GAAGD,CAAC,CAACE,SAAS;EACvBD,GAAG,CAACb,QAAQ,GAAGY,CAAC,CAACZ,QAAQ,CAACe,KAAK;EAC/BF,GAAG,CAACZ,OAAO,GAAGW,CAAC,CAACX,OAAO,CAACc,KAAK;EAC7BF,GAAG,CAACX,SAAS,GAAGU,CAAC,CAACV,SAAS,CA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 @@ exports.derivations = void 0;
8
8
  * Additional values to help make defining animations easier.
9
9
  */
10
10
  const derivations = ({
11
+ previous,
11
12
  current,
12
13
  next
13
14
  }) => {
@@ -18,13 +19,19 @@ const derivations = ({
18
19
 
19
20
  // Whether the current screen is focused
20
21
  const focused = !next;
22
+
23
+ // The screen driving the transition
21
24
  const active = focused ? current : next ?? current;
25
+
26
+ // The screen NOT driving the transition
27
+ const inactive = focused ? previous : current;
22
28
  const isActiveTransitioning = !!(active.gesture.isDragging || active.animating);
23
29
  const isDismissing = !!(active.gesture.isDismissing || active.closing);
24
30
  return {
25
31
  progress,
26
32
  focused,
27
33
  active,
34
+ inactive,
28
35
  isActiveTransitioning,
29
36
  isDismissing
30
37
  };
@@ -1 +1 @@
1
- {"version":3,"names":["derivations","current","next","progress","focused","active","isActiveTransitioning","gesture","isDragging","animating","isDismissing","closing","exports"],"sourceRoot":"../../../../../src","sources":["shared/utils/animation/derivations.ts"],"mappings":";;;;;;AAOA;AACA;AACA;AACO,MAAMA,WAAW,GAAGA,CAAC;EAAEC,OAAO;EAAEC;AAAwB,CAAC,KAAK;EACpE,SAAS;;EAET;EACA,MAAMC,QAAQ,GAAGF,OAAO,CAACE,QAAQ,IAAID,IAAI,EAAEC,QAAQ,IAAI,CAAC,CAAC;;EAEzD;EACA,MAAMC,OAAO,GAAG,CAACF,IAAI;EAErB,MAAMG,MAAM,GAAGD,OAAO,GAAGH,OAAO,GAAIC,IAAI,IAAID,OAAQ;EACpD,MAAMK,qBAAqB,GAAG,CAAC,EAC9BD,MAAM,CAACE,OAAO,CAACC,UAAU,IAAIH,MAAM,CAACI,SAAS,CAC7C;EAED,MAAMC,YAAY,GAAG,CAAC,EAAEL,MAAM,CAACE,OAAO,CAACG,YAAY,IAAIL,MAAM,CAACM,OAAO,CAAC;EAEtE,OAAO;IACNR,QAAQ;IACRC,OAAO;IACPC,MAAM;IACNC,qBAAqB;IACrBI;EACD,CAAC;AACF,CAAC;AAACE,OAAA,CAAAZ,WAAA,GAAAA,WAAA","ignoreList":[]}
1
+ {"version":3,"names":["derivations","previous","current","next","progress","focused","active","inactive","isActiveTransitioning","gesture","isDragging","animating","isDismissing","closing","exports"],"sourceRoot":"../../../../../src","sources":["shared/utils/animation/derivations.ts"],"mappings":";;;;;;AAQA;AACA;AACA;AACO,MAAMA,WAAW,GAAGA,CAAC;EAAEC,QAAQ;EAAEC,OAAO;EAAEC;AAAwB,CAAC,KAAK;EAC9E,SAAS;;EAET;EACA,MAAMC,QAAQ,GAAGF,OAAO,CAACE,QAAQ,IAAID,IAAI,EAAEC,QAAQ,IAAI,CAAC,CAAC;;EAEzD;EACA,MAAMC,OAAO,GAAG,CAACF,IAAI;;EAErB;EACA,MAAMG,MAAM,GAAGD,OAAO,GAAGH,OAAO,GAAIC,IAAI,IAAID,OAAQ;;EAEpD;EACA,MAAMK,QAAQ,GAAGF,OAAO,GAAGJ,QAAQ,GAAGC,OAAO;EAE7C,MAAMM,qBAAqB,GAAG,CAAC,EAC9BF,MAAM,CAACG,OAAO,CAACC,UAAU,IAAIJ,MAAM,CAACK,SAAS,CAC7C;EAED,MAAMC,YAAY,GAAG,CAAC,EAAEN,MAAM,CAACG,OAAO,CAACG,YAAY,IAAIN,MAAM,CAACO,OAAO,CAAC;EAEtE,OAAO;IACNT,QAAQ;IACRC,OAAO;IACPC,MAAM;IACNC,QAAQ;IACRC,qBAAqB;IACrBI;EACD,CAAC;AACF,CAAC;AAACE,OAAA,CAAAd,WAAA,GAAAA,WAAA","ignoreList":[]}
@@ -93,6 +93,7 @@ export function _useScreenAnimation() {
93
93
  progress,
94
94
  ...helpers
95
95
  } = derivations({
96
+ previous,
96
97
  current,
97
98
  next
98
99
  });
@@ -1 +1 @@
1
- {"version":3,"names":["useMemo","useWindowDimensions","useDerivedValue","useSafeAreaInsets","DEFAULT_SCREEN_TRANSITION_STATE","useFlagsContext","useKeys","useStackAnimationValues","AnimationStore","GestureStore","computeStackProgress","derivations","createBounds","createScreenTransitionState","route","meta","progress","closing","animating","gesture","x","y","normalizedX","normalizedY","isDismissing","isDragging","direction","unwrapInto","s","out","unwrapped","value","useBuildScreenTransitionState","descriptor","key","options","undefined","getAnimation","getRouteGestures","hasTransitionsEnabled","alwaysOn","enableTransitions","_useScreenAnimation","dimensions","insets","flags","transitionsAlwaysOn","TRANSITIONS_ALWAYS_ON","current","currentDescriptor","next","nextDescriptor","previous","previousDescriptor","currentAnimation","nextAnimation","prevAnimation","currentRouteKey","stackAnimationValues","screenInterpolatorProps","helpers","stackProgress","layouts","screen","nextInterpolator","screenStyleInterpolator","currentInterpolator","useScreenAnimation","props","bounds"],"sourceRoot":"../../../../../src","sources":["shared/hooks/animation/use-screen-animation.tsx"],"mappings":";;AACA,SAASA,OAAO,QAAQ,OAAO;AAC/B,SAASC,mBAAmB,QAAQ,cAAc;AAClD,SAA2BC,eAAe,QAAQ,yBAAyB;AAC3E,SAASC,iBAAiB,QAAQ,gCAAgC;AAElE,SAASC,+BAA+B,QAAQ,iBAAiB;AACjE,SAASC,eAAe,QAAQ,gCAAgC;AAChE,SAECC,OAAO,QACD,+BAA+B;AACtC,SAASC,uBAAuB,QAAQ,iCAAiC;AACzE,SAASC,cAAc,QAAQ,8BAA8B;AAC7D,SAASC,YAAY,QAA8B,4BAA4B;AAM/E,SAASC,oBAAoB,QAAQ,8CAA8C;AACnF,SAASC,WAAW,QAAQ,mCAAmC;AAC/D,SAASC,YAAY,QAAQ,oBAAoB;AAYjD,MAAMC,2BAA2B,GAAGA,CACnCC,KAA+B,EAC/BC,IAA8B,MACF;EAC5BC,QAAQ,EAAE,CAAC;EACXC,OAAO,EAAE,CAAC;EACVC,SAAS,EAAE,CAAC;EACZC,OAAO,EAAE;IACRC,CAAC,EAAE,CAAC;IACJC,CAAC,EAAE,CAAC;IACJC,WAAW,EAAE,CAAC;IACdC,WAAW,EAAE,CAAC;IACdC,YAAY,EAAE,CAAC;IACfC,UAAU,EAAE,CAAC;IACbC,SAAS,EAAE;EACZ,CAAC;EACDZ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CAAC,GAAGjB,mBAAmB,CAAC,CAAC;EAEzD,OAAOxC,eAAe,CAA2B,MAAM;IACtD,MAAMkE,KAAK,GAAGT,uBAAuB,CAAC5B,KAAK;IAC3C,OAAO;MACN,GAAGqC,KAAK;MACRC,MAAM,EAAEzD,YAAY,CAACwD,KAAK;IAC3B,CAAC;EACF,CAAC,CAAC;AACH","ignoreList":[]}
1
+ {"version":3,"names":["useMemo","useWindowDimensions","useDerivedValue","useSafeAreaInsets","DEFAULT_SCREEN_TRANSITION_STATE","useFlagsContext","useKeys","useStackAnimationValues","AnimationStore","GestureStore","computeStackProgress","derivations","createBounds","createScreenTransitionState","route","meta","progress","closing","animating","gesture","x","y","normalizedX","normalizedY","isDismissing","isDragging","direction","unwrapInto","s","out","unwrapped","value","useBuildScreenTransitionState","descriptor","key","options","undefined","getAnimation","getRouteGestures","hasTransitionsEnabled","alwaysOn","enableTransitions","_useScreenAnimation","dimensions","insets","flags","transitionsAlwaysOn","TRANSITIONS_ALWAYS_ON","current","currentDescriptor","next","nextDescriptor","previous","previousDescriptor","currentAnimation","nextAnimation","prevAnimation","currentRouteKey","stackAnimationValues","screenInterpolatorProps","helpers","stackProgress","layouts","screen","nextInterpolator","screenStyleInterpolator","currentInterpolator","useScreenAnimation","props","bounds"],"sourceRoot":"../../../../../src","sources":["shared/hooks/animation/use-screen-animation.tsx"],"mappings":";;AACA,SAASA,OAAO,QAAQ,OAAO;AAC/B,SAASC,mBAAmB,QAAQ,cAAc;AAClD,SAA2BC,eAAe,QAAQ,yBAAyB;AAC3E,SAASC,iBAAiB,QAAQ,gCAAgC;AAElE,SAASC,+BAA+B,QAAQ,iBAAiB;AACjE,SAASC,eAAe,QAAQ,gCAAgC;AAChE,SAECC,OAAO,QACD,+BAA+B;AACtC,SAASC,uBAAuB,QAAQ,iCAAiC;AACzE,SAASC,cAAc,QAAQ,8BAA8B;AAC7D,SAASC,YAAY,QAA8B,4BAA4B;AAM/E,SAASC,oBAAoB,QAAQ,8CAA8C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AM;MACNQ,QAAQ;MACRJ,OAAO;MACPE,IAAI;MACJlC,QAAQ;MACR6C,aAAa;MACb,GAAGD;IACJ,CAAC;EACF,CAAC,CAAC;EAEF,MAAMI,gBAAgB,GAAGb,cAAc,EAAEhB,OAAO,CAAC8B,uBAAuB;EACxE,MAAMC,mBAAmB,GACxBjB,iBAAiB,EAAEd,OAAO,CAAC8B,uBAAuB;EAEnD,MAAMA,uBAAuB,GAAGD,gBAAgB,IAAIE,mBAAmB;EAEvE,OAAO;IAAEP,uBAAuB;IAAEM;EAAwB,CAAC;AAC5D;AAEA,OAAO,SAASE,kBAAkBA,CAAA,EAAG;EACpC,MAAM;IAAER;EAAwB,CAAC,GAAGjB,mBAAmB,CAAC,CAAC;EAEzD,OAAOxC,eAAe,CAA2B,MAAM;IACtD,MAAMkE,KAAK,GAAGT,uBAAuB,CAAC5B,KAAK;IAC3C,OAAO;MACN,GAAGqC,KAAK;MACRC,MAAM,EAAEzD,YAAY,CAACwD,KAAK;IAC3B,CAAC;EACF,CAAC,CAAC;AACH","ignoreList":[]}
@@ -4,6 +4,7 @@
4
4
  * Additional values to help make defining animations easier.
5
5
  */
6
6
  export const derivations = ({
7
+ previous,
7
8
  current,
8
9
  next
9
10
  }) => {
@@ -14,13 +15,19 @@ export const derivations = ({
14
15
 
15
16
  // Whether the current screen is focused
16
17
  const focused = !next;
18
+
19
+ // The screen driving the transition
17
20
  const active = focused ? current : next ?? current;
21
+
22
+ // The screen NOT driving the transition
23
+ const inactive = focused ? previous : current;
18
24
  const isActiveTransitioning = !!(active.gesture.isDragging || active.animating);
19
25
  const isDismissing = !!(active.gesture.isDismissing || active.closing);
20
26
  return {
21
27
  progress,
22
28
  focused,
23
29
  active,
30
+ inactive,
24
31
  isActiveTransitioning,
25
32
  isDismissing
26
33
  };
@@ -1 +1 @@
1
- {"version":3,"names":["derivations","current","next","progress","focused","active","isActiveTransitioning","gesture","isDragging","animating","isDismissing","closing"],"sourceRoot":"../../../../../src","sources":["shared/utils/animation/derivations.ts"],"mappings":";;AAOA;AACA;AACA;AACA,OAAO,MAAMA,WAAW,GAAGA,CAAC;EAAEC,OAAO;EAAEC;AAAwB,CAAC,KAAK;EACpE,SAAS;;EAET;EACA,MAAMC,QAAQ,GAAGF,OAAO,CAACE,QAAQ,IAAID,IAAI,EAAEC,QAAQ,IAAI,CAAC,CAAC;;EAEzD;EACA,MAAMC,OAAO,GAAG,CAACF,IAAI;EAErB,MAAMG,MAAM,GAAGD,OAAO,GAAGH,OAAO,GAAIC,IAAI,IAAID,OAAQ;EACpD,MAAMK,qBAAqB,GAAG,CAAC,EAC9BD,MAAM,CAACE,OAAO,CAACC,UAAU,IAAIH,MAAM,CAACI,SAAS,CAC7C;EAED,MAAMC,YAAY,GAAG,CAAC,EAAEL,MAAM,CAACE,OAAO,CAACG,YAAY,IAAIL,MAAM,CAACM,OAAO,CAAC;EAEtE,OAAO;IACNR,QAAQ;IACRC,OAAO;IACPC,MAAM;IACNC,qBAAqB;IACrBI;EACD,CAAC;AACF,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["derivations","previous","current","next","progress","focused","active","inactive","isActiveTransitioning","gesture","isDragging","animating","isDismissing","closing"],"sourceRoot":"../../../../../src","sources":["shared/utils/animation/derivations.ts"],"mappings":";;AAQA;AACA;AACA;AACA,OAAO,MAAMA,WAAW,GAAGA,CAAC;EAAEC,QAAQ;EAAEC,OAAO;EAAEC;AAAwB,CAAC,KAAK;EAC9E,SAAS;;EAET;EACA,MAAMC,QAAQ,GAAGF,OAAO,CAACE,QAAQ,IAAID,IAAI,EAAEC,QAAQ,IAAI,CAAC,CAAC;;EAEzD;EACA,MAAMC,OAAO,GAAG,CAACF,IAAI;;EAErB;EACA,MAAMG,MAAM,GAAGD,OAAO,GAAGH,OAAO,GAAIC,IAAI,IAAID,OAAQ;;EAEpD;EACA,MAAMK,QAAQ,GAAGF,OAAO,GAAGJ,QAAQ,GAAGC,OAAO;EAE7C,MAAMM,qBAAqB,GAAG,CAAC,EAC9BF,MAAM,CAACG,OAAO,CAACC,UAAU,IAAIJ,MAAM,CAACK,SAAS,CAC7C;EAED,MAAMC,YAAY,GAAG,CAAC,EAAEN,MAAM,CAACG,OAAO,CAACG,YAAY,IAAIN,MAAM,CAACO,OAAO,CAAC;EAEtE,OAAO;IACNT,QAAQ;IACRC,OAAO;IACPC,MAAM;IACNC,QAAQ;IACRC,qBAAqB;IACrBI;EACD,CAAC;AACF,CAAC","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"use-screen-animation.d.ts","sourceRoot":"","sources":["../../../../../src/shared/hooks/animation/use-screen-animation.tsx"],"names":[],"mappings":"AAeA,OAAO,KAAK,EACX,wBAAwB,EAExB,MAAM,6BAA6B,CAAC;AAoFrC,wBAAgB,mBAAmB;;;EA8DlC;AAED,wBAAgB,kBAAkB,6EAUjC"}
1
+ {"version":3,"file":"use-screen-animation.d.ts","sourceRoot":"","sources":["../../../../../src/shared/hooks/animation/use-screen-animation.tsx"],"names":[],"mappings":"AAeA,OAAO,KAAK,EACX,wBAAwB,EAExB,MAAM,6BAA6B,CAAC;AAoFrC,wBAAgB,mBAAmB;;;EA+DlC;AAED,wBAAgB,kBAAkB,6EAUjC"}
@@ -124,12 +124,19 @@ export interface ScreenInterpolationProps {
124
124
  * The screen state that is currently driving the transition (either current or next, whichever is focused).
125
125
  */
126
126
  active: ScreenTransitionState;
127
+ /**
128
+ * The screen state that is NOT driving the transition.
129
+ * When focused, this is the previous screen. When not focused, this is the current screen.
130
+ */
131
+ inactive: ScreenTransitionState | undefined;
127
132
  /**
128
133
  * Whether the active screen is currently transitioning (either being dragged or animating).
134
+ * @deprecated Use `active.animating` instead.
129
135
  */
130
136
  isActiveTransitioning: boolean;
131
137
  /**
132
138
  * Whether the active screen is in the process of being dismissed/closed.
139
+ * @deprecated Use `active.closing` instead.
133
140
  */
134
141
  isDismissing: boolean;
135
142
  }
@@ -1 +1 @@
1
- {"version":3,"file":"animation.types.d.ts","sourceRoot":"","sources":["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IAEF;;OAEG;IACH,MAAM,EAAE,UAAU,CAAC;IAEnB;;;OAGG;IACH,aAAa,CAAC,EAAE,KAAK,CAAC;IAEtB;;OAEG;IACH,OAAO,EAAE,OAAO,CAAC;IAEjB;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IAEjB;;;;;;;;;;OAUG;IACH,aAAa,EAAE,MAAM,CAAC;IAEtB;;OAEG;IACH,MAAM,EAAE,cAAc,CAAC;IAEvB;;OAEG;IACH,MAAM,EAAE,qBAAqB,CAAC;IAE9B;;OAEG;IACH,qBAAqB,EAAE,OAAO,CAAC;IAE/B;;OAEG;IACH,YAAY,EAAE,OAAO,CAAC;CACtB;AAED,MAAM,MAAM,uBAAuB,GAAG,CACrC,KAAK,EAAE,wBAAwB,KAC3B,2BAA2B,CAAC;AAEjC,MAAM,MAAM,2BAA2B,GAAG;IACzC;;OAEG;IACH,YAAY,CAAC,EAAE,UAAU,CAAC;IAE1B;;OAEG;IACH,YAAY,CAAC,EAAE,UAAU,CAAC;IAE1B;;OAEG;IACH,CAAC,EAAE,EAAE,MAAM,GAAG,UAAU,GAAG,SAAS,CAAC;CACrC,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,eAAe,GAAG,gBAAgB,GAAG,gBAAgB,CAAC;AAElE;;GAEG;AACH,MAAM,WAAW,cAAc;IAC9B,IAAI,CAAC,EAAE,eAAe,CAAC;IACvB,KAAK,CAAC,EAAE,eAAe,CAAC;CACxB"}
1
+ {"version":3,"file":"animation.types.d.ts","sourceRoot":"","sources":["../../../../src/shared/types/animation.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AACzE,OAAO,KAAK,EACX,UAAU,EACV,gBAAgB,EAChB,gBAAgB,EAChB,MAAM,yBAAyB,CAAC;AACjC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gCAAgC,CAAC;AACjE,OAAO,KAAK,EAAE,cAAc,EAAE,MAA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OAEG;IACH,MAAM,EAAE,qBAAqB,CAAC;IAE9B;;;OAGG;IACH,QAAQ,EAAE,qBAAqB,GAAG,SAAS,CAAC;IAE5C;;;OAGG;IACH,qBAAqB,EAAE,OAAO,CAAC;IAE/B;;;OAGG;IACH,YAAY,EAAE,OAAO,CAAC;CACtB;AAED,MAAM,MAAM,uBAAuB,GAAG,CACrC,KAAK,EAAE,wBAAwB,KAC3B,2BAA2B,CAAC;AAEjC,MAAM,MAAM,2BAA2B,GAAG;IACzC;;OAEG;IACH,YAAY,CAAC,EAAE,UAAU,CAAC;IAE1B;;OAEG;IACH,YAAY,CAAC,EAAE,UAAU,CAAC;IAE1B;;OAEG;IACH,CAAC,EAAE,EAAE,MAAM,GAAG,UAAU,GAAG,SAAS,CAAC;CACrC,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,eAAe,GAAG,gBAAgB,GAAG,gBAAgB,CAAC;AAElE;;GAEG;AACH,MAAM,WAAW,cAAc;IAC9B,IAAI,CAAC,EAAE,eAAe,CAAC;IACvB,KAAK,CAAC,EAAE,eAAe,CAAC;CACxB"}
@@ -1,15 +1,17 @@
1
1
  import type { ScreenTransitionState } from "../../types/animation.types";
2
2
  interface DerivationsParams {
3
+ previous?: ScreenTransitionState;
3
4
  current: ScreenTransitionState;
4
5
  next?: ScreenTransitionState;
5
6
  }
6
7
  /**
7
8
  * Additional values to help make defining animations easier.
8
9
  */
9
- export declare const derivations: ({ current, next }: DerivationsParams) => {
10
+ export declare const derivations: ({ previous, current, next }: DerivationsParams) => {
10
11
  progress: number;
11
12
  focused: boolean;
12
13
  active: ScreenTransitionState;
14
+ inactive: ScreenTransitionState | undefined;
13
15
  isActiveTransitioning: boolean;
14
16
  isDismissing: boolean;
15
17
  };
@@ -1 +1 @@
1
- {"version":3,"file":"derivations.d.ts","sourceRoot":"","sources":["../../../../../src/shared/utils/animation/derivations.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,6BAA6B,CAAC;AAEzE,UAAU,iBAAiB;IAC1B,OAAO,EAAE,qBAAqB,CAAC;IAC/B,IAAI,CAAC,EAAE,qBAAqB,CAAC;CAC7B;AAED;;GAEG;AACH,eAAO,MAAM,WAAW,GAAI,mBAAmB,iBAAiB;;;;;;CAuB/D,CAAC"}
1
+ {"version":3,"file":"derivations.d.ts","sourceRoot":"","sources":["../../../../../src/shared/utils/animation/derivations.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,6BAA6B,CAAC;AAEzE,UAAU,iBAAiB;IAC1B,QAAQ,CAAC,EAAE,qBAAqB,CAAC;IACjC,OAAO,EAAE,qBAAqB,CAAC;IAC/B,IAAI,CAAC,EAAE,qBAAqB,CAAC;CAC7B;AAED;;GAEG;AACH,eAAO,MAAM,WAAW,GAAI,6BAA6B,iBAAiB;;;;;;;CA6BzE,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-screen-transitions",
3
- "version": "3.0.0",
3
+ "version": "3.1.0",
4
4
  "description": "Easy screen transitions for React Native and Expo",
5
5
  "author": "Ed",
6
6
  "license": "MIT",
@@ -137,6 +137,7 @@ export function _useScreenAnimation() {
137
137
  : DEFAULT_SCREEN_TRANSITION_STATE;
138
138
 
139
139
  const { progress, ...helpers } = derivations({
140
+ previous,
140
141
  current,
141
142
  next,
142
143
  });
@@ -147,13 +147,21 @@ export interface ScreenInterpolationProps {
147
147
  */
148
148
  active: ScreenTransitionState;
149
149
 
150
+ /**
151
+ * The screen state that is NOT driving the transition.
152
+ * When focused, this is the previous screen. When not focused, this is the current screen.
153
+ */
154
+ inactive: ScreenTransitionState | undefined;
155
+
150
156
  /**
151
157
  * Whether the active screen is currently transitioning (either being dragged or animating).
158
+ * @deprecated Use `active.animating` instead.
152
159
  */
153
160
  isActiveTransitioning: boolean;
154
161
 
155
162
  /**
156
163
  * Whether the active screen is in the process of being dismissed/closed.
164
+ * @deprecated Use `active.closing` instead.
157
165
  */
158
166
  isDismissing: boolean;
159
167
  }
@@ -1,6 +1,7 @@
1
1
  import type { ScreenTransitionState } from "../../types/animation.types";
2
2
 
3
3
  interface DerivationsParams {
4
+ previous?: ScreenTransitionState;
4
5
  current: ScreenTransitionState;
5
6
  next?: ScreenTransitionState;
6
7
  }
@@ -8,7 +9,7 @@ interface DerivationsParams {
8
9
  /**
9
10
  * Additional values to help make defining animations easier.
10
11
  */
11
- export const derivations = ({ current, next }: DerivationsParams) => {
12
+ export const derivations = ({ previous, current, next }: DerivationsParams) => {
12
13
  "worklet";
13
14
 
14
15
  // The combined progress (current + next, 0-2 range)
@@ -17,7 +18,12 @@ export const derivations = ({ current, next }: DerivationsParams) => {
17
18
  // Whether the current screen is focused
18
19
  const focused = !next;
19
20
 
21
+ // The screen driving the transition
20
22
  const active = focused ? current : (next ?? current);
23
+
24
+ // The screen NOT driving the transition
25
+ const inactive = focused ? previous : current;
26
+
21
27
  const isActiveTransitioning = !!(
22
28
  active.gesture.isDragging || active.animating
23
29
  );
@@ -28,6 +34,7 @@ export const derivations = ({ current, next }: DerivationsParams) => {
28
34
  progress,
29
35
  focused,
30
36
  active,
37
+ inactive,
31
38
  isActiveTransitioning,
32
39
  isDismissing,
33
40
  };