Skip to content

Commit 83283d3

Browse files
Update SETs
1 parent fa5546c commit 83283d3

File tree

2 files changed

+118
-18
lines changed

2 files changed

+118
-18
lines changed

versioned_docs/version-7.x/shared-element-transitions.md

Lines changed: 59 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,14 @@ This guide covers how to animate elements between screens. This feature is known
1111

1212
:::warning
1313

14-
As of writing this guide, Shared Element Transitions are considered an experimental feature not recommended for production use.
14+
Shared Element Transitions are an experimental feature not recommended for production use yet.
1515

16-
Shared Element Transitions are currently only supported on **old React Native architecture** (Paper).
16+
**Architecture support:**
17+
18+
- **Reanimated 3** supports Shared Element Transitions on the **Old Architecture** (Paper).
19+
- **Reanimated 4** supports them on the **New Architecture** (Fabric) since 4.2.0, but the feature is behind a feature flag. You need to [enable the `ENABLE_SHARED_ELEMENT_TRANSITIONS` feature flag](https://docs.swmansion.com/react-native-reanimated/docs/guides/feature-flags#enable_shared_element_transitions) to use it.
20+
21+
Check [the Reanimated documentation](https://docs.swmansion.com/react-native-reanimated/docs/shared-element-transitions/overview/) for details and [send feedback to the Reanimated team](https://github.com/software-mansion/react-native-reanimated)
1722

1823
:::
1924

@@ -27,6 +32,7 @@ Before continuing this guide make sure your app meets these criteria:
2732

2833
- You are using [`@react-navigation/native-stack`](native-stack-navigator.md). The Shared Element Transitions feature isn't supported in JS-based [`@react-navigation/stack`](stack-navigator.md).
2934
- You have [`react-native-reanimated`](https://docs.swmansion.com/react-native-reanimated/docs/fundamentals/getting-started) **v3.0.0 or higher** installed and configured.
35+
- If you are using **Reanimated 4** (New Architecture), you must [enable the `ENABLE_SHARED_ELEMENT_TRANSITIONS` feature flag](https://docs.swmansion.com/react-native-reanimated/docs/guides/feature-flags#enable_shared_element_transitions).
3036

3137
## Minimal example
3238

@@ -183,18 +189,18 @@ const styles = StyleSheet.create({
183189

184190
## Customizing the transition
185191

186-
By default, the transition animates the `width`, `height`, `originX`, `originY` and `transform` properties using `withTiming` with a 500 ms duration. You can easily customize `width`, `height`, `originX`, and `originY` props. Customizing `transform` is also possible but it's far beyond the scope of this guide.
187-
188-
:::warning
192+
You can customize the transition by passing a custom `SharedTransition` configuration via the `sharedTransitionStyle` prop. Apply the same `sharedTransitionStyle` to the matching element on the target screen.
189193

190-
Custom SharedTransition API is not finalized and might change in a future release.
194+
Custom transition configuration is not fully finalized and might change in a future release.
191195

192196
:::
193197

194-
To customize the transition you need to pass all the properties besides `transform`.
198+
### Old Architecture (Reanimated 3)
199+
200+
By default, the transition animates `width`, `height`, `originX`, `originY`, and `transform` using `withTiming` with a 500 ms duration. You can customize the transition using `SharedTransition.custom()`:
195201

196202
```jsx
197-
import { SharedTransition } from 'react-native-reanimated';
203+
import { SharedTransition, withSpring } from 'react-native-reanimated';
198204

199205
const customTransition = SharedTransition.custom((values) => {
200206
'worklet';
@@ -212,7 +218,31 @@ function HomeScreen() {
212218
style={{ width: 300, height: 300 }}
213219
sharedTransitionTag="tag"
214220
// highlight-next-line
215-
sharedTransitionStyle={customTransition} // add this to both elements on both screens
221+
sharedTransitionStyle={customTransition}
222+
/>
223+
);
224+
}
225+
```
226+
227+
### New Architecture (Reanimated 4)
228+
229+
On the New Architecture, the default transition animates `width`, `height`, `originX`, `originY`, `transform`, `backgroundColor`, and `opacity` using `withTiming` with a 500 ms duration.
230+
231+
Currently customization is more limited due to ongoing development. You can't define fully custom animation functions. Instead, use the `SharedTransition` builder class to configure duration and spring-based animations:
232+
233+
```jsx
234+
import { SharedTransition } from 'react-native-reanimated';
235+
236+
// Example: customize duration and use spring animation
237+
const customTransition = SharedTransition.duration(550).springify();
238+
239+
function HomeScreen() {
240+
return (
241+
<Animated.Image
242+
style={{ width: 300, height: 300 }}
243+
sharedTransitionTag="tag"
244+
// highlight-next-line
245+
sharedTransitionStyle={customTransition}
216246
/>
217247
);
218248
}
@@ -222,6 +252,26 @@ function HomeScreen() {
222252

223253
You can find a full Shared Element Transitions reference in the [React Native Reanimated documentation](https://docs.swmansion.com/react-native-reanimated/docs/shared-element-transitions/overview/).
224254

255+
## Limitations
256+
257+
Shared Element Transitions have several current limitations to be aware of:
258+
259+
- Only the native stack navigator is supported
260+
- The Tab navigator is not supported
261+
- Transitions with native modals don't work properly on iOS
262+
263+
### New Architecture specific limitations (Reanimated 4)
264+
265+
The following limitations apply specifically when using Reanimated 4 on the New Architecture:
266+
267+
- The feature must be enabled via the `ENABLE_SHARED_ELEMENT_TRANSITIONS` feature flag
268+
- Custom animation functions are not supported; you can only customize duration and use spring-based animations
269+
- Some properties (e.g., `backgroundColor`) are not supported in progress-based transitions (iOS back gesture)
270+
- There are performance bottlenecks with transforms being recalculated too eagerly
271+
- On iOS, you may encounter issues with vertical positioning due to header height information propagation
272+
273+
The limitations will be addressed in future Reanimated releases.
274+
225275
## Alternatives
226276

227277
Alternatively, you can use [`react-native-shared-element`](https://github.com/IjzerenHein/react-native-shared-element) library with a [React Navigation binding](https://github.com/IjzerenHein/react-navigation-shared-element) which implements Shared Element Transitions in a JS-based `@react-navigation/stack` navigator. This solution, however, isn't actively maintained.

versioned_docs/version-8.x/shared-element-transitions.md

Lines changed: 59 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,14 @@ This guide covers how to animate elements between screens. This feature is known
1111

1212
:::warning
1313

14-
As of writing this guide, Shared Element Transitions are considered an experimental feature not recommended for production use.
14+
Shared Element Transitions are an experimental feature not recommended for production use yet.
1515

16-
Shared Element Transitions are currently only supported on **old React Native architecture** (Paper).
16+
**Architecture support:**
17+
18+
- **Reanimated 3** supports Shared Element Transitions on the **Old Architecture** (Paper).
19+
- **Reanimated 4** supports them on the **New Architecture** (Fabric) since 4.2.0, but the feature is behind a feature flag. You need to [enable the `ENABLE_SHARED_ELEMENT_TRANSITIONS` feature flag](https://docs.swmansion.com/react-native-reanimated/docs/guides/feature-flags#enable_shared_element_transitions) to use it.
20+
21+
Check [the Reanimated documentation](https://docs.swmansion.com/react-native-reanimated/docs/shared-element-transitions/overview/) for details and [send feedback to the Reanimated team](https://github.com/software-mansion/react-native-reanimated)
1722

1823
:::
1924

@@ -27,6 +32,7 @@ Before continuing this guide make sure your app meets these criteria:
2732

2833
- You are using [`@react-navigation/native-stack`](native-stack-navigator.md). The Shared Element Transitions feature isn't supported in JS-based [`@react-navigation/stack`](stack-navigator.md).
2934
- You have [`react-native-reanimated`](https://docs.swmansion.com/react-native-reanimated/docs/fundamentals/getting-started) **v3.0.0 or higher** installed and configured.
35+
- If you are using **Reanimated 4** (New Architecture), you must [enable the `ENABLE_SHARED_ELEMENT_TRANSITIONS` feature flag](https://docs.swmansion.com/react-native-reanimated/docs/guides/feature-flags#enable_shared_element_transitions).
3036

3137
## Minimal example
3238

@@ -183,18 +189,18 @@ const styles = StyleSheet.create({
183189

184190
## Customizing the transition
185191

186-
By default, the transition animates the `width`, `height`, `originX`, `originY` and `transform` properties using `withTiming` with a 500 ms duration. You can easily customize `width`, `height`, `originX`, and `originY` props. Customizing `transform` is also possible but it's far beyond the scope of this guide.
187-
188-
:::warning
192+
You can customize the transition by passing a custom `SharedTransition` configuration via the `sharedTransitionStyle` prop. Apply the same `sharedTransitionStyle` to the matching element on the target screen.
189193

190-
Custom SharedTransition API is not finalized and might change in a future release.
194+
Custom transition configuration is not fully finalized and might change in a future release.
191195

192196
:::
193197

194-
To customize the transition you need to pass all the properties besides `transform`.
198+
### Old Architecture (Reanimated 3)
199+
200+
By default, the transition animates `width`, `height`, `originX`, `originY`, and `transform` using `withTiming` with a 500 ms duration. You can customize the transition using `SharedTransition.custom()`:
195201

196202
```jsx
197-
import { SharedTransition } from 'react-native-reanimated';
203+
import { SharedTransition, withSpring } from 'react-native-reanimated';
198204

199205
const customTransition = SharedTransition.custom((values) => {
200206
'worklet';
@@ -212,7 +218,31 @@ function HomeScreen() {
212218
style={{ width: 300, height: 300 }}
213219
sharedTransitionTag="tag"
214220
// highlight-next-line
215-
sharedTransitionStyle={customTransition} // add this to both elements on both screens
221+
sharedTransitionStyle={customTransition}
222+
/>
223+
);
224+
}
225+
```
226+
227+
### New Architecture (Reanimated 4)
228+
229+
On the New Architecture, the default transition animates `width`, `height`, `originX`, `originY`, `transform`, `backgroundColor`, and `opacity` using `withTiming` with a 500 ms duration.
230+
231+
Currently customization is more limited due to ongoing development. You can't define fully custom animation functions. Instead, use the `SharedTransition` builder class to configure duration and spring-based animations:
232+
233+
```jsx
234+
import { SharedTransition } from 'react-native-reanimated';
235+
236+
// Example: customize duration and use spring animation
237+
const customTransition = SharedTransition.duration(550).springify();
238+
239+
function HomeScreen() {
240+
return (
241+
<Animated.Image
242+
style={{ width: 300, height: 300 }}
243+
sharedTransitionTag="tag"
244+
// highlight-next-line
245+
sharedTransitionStyle={customTransition}
216246
/>
217247
);
218248
}
@@ -222,6 +252,26 @@ function HomeScreen() {
222252

223253
You can find a full Shared Element Transitions reference in the [React Native Reanimated documentation](https://docs.swmansion.com/react-native-reanimated/docs/shared-element-transitions/overview/).
224254

255+
## Limitations
256+
257+
Shared Element Transitions have several current limitations to be aware of:
258+
259+
- Only the native stack navigator is supported
260+
- The Tab navigator is not supported
261+
- Transitions with native modals don't work properly on iOS
262+
263+
### New Architecture specific limitations (Reanimated 4)
264+
265+
The following limitations apply specifically when using Reanimated 4 on the New Architecture:
266+
267+
- The feature must be enabled via the `ENABLE_SHARED_ELEMENT_TRANSITIONS` feature flag
268+
- Custom animation functions are not supported; you can only customize duration and use spring-based animations
269+
- Some properties (e.g., `backgroundColor`) are not supported in progress-based transitions (iOS back gesture)
270+
- There are performance bottlenecks with transforms being recalculated too eagerly
271+
- On iOS, you may encounter issues with vertical positioning due to header height information propagation
272+
273+
The limitations will be addressed in future Reanimated releases.
274+
225275
## Alternatives
226276

227277
Alternatively, you can use [`react-native-shared-element`](https://github.com/IjzerenHein/react-native-shared-element) library with a [React Navigation binding](https://github.com/IjzerenHein/react-navigation-shared-element) which implements Shared Element Transitions in a JS-based `@react-navigation/stack` navigator. This solution, however, isn't actively maintained.

0 commit comments

Comments
 (0)