Skip to content

Commit 4a5e766

Browse files
committed
Remove old architecture specific docs for 8.x
1 parent d1c4c46 commit 4a5e766

File tree

3 files changed

+46
-239
lines changed

3 files changed

+46
-239
lines changed

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

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ Shared Element Transitions are an experimental feature not recommended for produ
99
**Architecture support:**
1010

1111
- **Reanimated 3** supports Shared Element Transitions on the **Old Architecture** (Paper).
12-
- **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.
12+
- **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.
1313

1414
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)
1515

@@ -23,7 +23,7 @@ Check [the Reanimated documentation](https://docs.swmansion.com/react-native-rea
2323

2424
Before continuing this guide make sure your app meets these criteria:
2525

26-
- 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).
26+
- You are using [`@react-navigation/native-stack`](native-stack-navigator.md). JS-based [`@react-navigation/stack`](stack-navigator.md) or other navigators are not supported.
2727
- You have [`react-native-reanimated`](https://docs.swmansion.com/react-native-reanimated/docs/fundamentals/getting-started) **v3.0.0 or higher** installed and configured.
2828
- 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).
2929

@@ -104,24 +104,25 @@ You can customize the transition by passing a custom `SharedTransition` configur
104104

105105
Custom transition configuration is not fully finalized and might change in a future release.
106106

107-
:::
108-
109107
### Old Architecture (Reanimated 3)
110108

111109
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()`:
112110

113111
```jsx
114112
import { SharedTransition, withSpring } from 'react-native-reanimated';
115113

114+
// highlight-start
116115
const customTransition = SharedTransition.custom((values) => {
117116
'worklet';
117+
118118
return {
119119
height: withSpring(values.targetHeight),
120120
width: withSpring(values.targetWidth),
121121
originX: withSpring(values.targetOriginX),
122122
originY: withSpring(values.targetOriginY),
123123
};
124124
});
125+
// highlight-end
125126

126127
function HomeScreen() {
127128
return (
@@ -144,7 +145,8 @@ Currently customization is more limited due to ongoing development. You can't de
144145
```jsx
145146
import { SharedTransition } from 'react-native-reanimated';
146147

147-
// Example: customize duration and use spring animation
148+
// Customize duration and use spring animation
149+
// highlight-next-line
148150
const customTransition = SharedTransition.duration(550).springify();
149151

150152
function HomeScreen() {
@@ -165,10 +167,10 @@ You can find a full Shared Element Transitions reference in the [React Native Re
165167

166168
## Limitations
167169

168-
Shared Element Transitions have several current limitations to be aware of:
170+
Shared Element Transitions currently have several limitations to be aware of:
169171

170-
- Only the native stack navigator is supported
171-
- The Tab navigator is not supported
172+
- Only the [native stack navigator](native-stack-navigator.md) is supported
173+
- Other navigators such as JS stack, drawer, and bottom tabs are not supported
172174
- Transitions with native modals don't work properly on iOS
173175

174176
### New Architecture specific limitations (Reanimated 4)

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

Lines changed: 11 additions & 91 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ Shared Element Transitions are an experimental feature not recommended for produ
1616
**Architecture support:**
1717

1818
- **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.
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.
2020

2121
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)
2222

@@ -30,7 +30,7 @@ Check [the Reanimated documentation](https://docs.swmansion.com/react-native-rea
3030

3131
Before continuing this guide make sure your app meets these criteria:
3232

33-
- 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).
33+
- You are using [`@react-navigation/native-stack`](native-stack-navigator.md). JS-based [`@react-navigation/stack`](stack-navigator.md) or other navigators are not supported.
3434
- You have [`react-native-reanimated`](https://docs.swmansion.com/react-native-reanimated/docs/fundamentals/getting-started) **v3.0.0 or higher** installed and configured.
3535
- 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).
3636

@@ -42,10 +42,7 @@ To create a shared transition:
4242
2. Assign the same `sharedTransitionTag` to elements on different screens.
4343
3. Navigate between screens. The transition will start automatically.
4444

45-
<Tabs groupId="config" queryString="config">
46-
<TabItem value="static" label="Static" default>
47-
48-
```js name="Shared transition"
45+
```js static2dynamic name="Shared transition"
4946
import * as React from 'react';
5047
import { View, StyleSheet } from 'react-native';
5148
import {
@@ -91,14 +88,12 @@ function DetailsScreen() {
9188
);
9289
}
9390

94-
// highlight-start
9591
const RootStack = createNativeStackNavigator({
9692
screens: {
9793
Home: HomeScreen,
9894
Details: DetailsScreen,
9995
},
10096
});
101-
// highlight-end
10297

10398
const Navigation = createStaticNavigation(RootStack);
10499

@@ -114,77 +109,6 @@ const styles = StyleSheet.create({
114109
});
115110
```
116111

117-
</TabItem>
118-
<TabItem value="dynamic" label="Dynamic">
119-
120-
```js name="Shared transition"
121-
import * as React from 'react';
122-
import { View, StyleSheet } from 'react-native';
123-
import { NavigationContainer, useNavigation } from '@react-navigation/native';
124-
import { createNativeStackNavigator } from '@react-navigation/native-stack';
125-
import { Button } from '@react-navigation/elements';
126-
127-
import Animated from 'react-native-reanimated';
128-
129-
// highlight-next-line
130-
const Stack = createNativeStackNavigator();
131-
132-
function HomeScreen() {
133-
const navigation = useNavigation();
134-
135-
return (
136-
<View style={styles.container}>
137-
<Button onPress={() => navigation.navigate('Details')}>
138-
Go to Details
139-
</Button>
140-
<Animated.Image
141-
source={{ uri: 'https://picsum.photos/id/39/200' }}
142-
style={{ width: 300, height: 300 }}
143-
// highlight-next-line
144-
sharedTransitionTag="tag"
145-
/>
146-
</View>
147-
);
148-
}
149-
150-
function DetailsScreen() {
151-
const navigation = useNavigation();
152-
153-
return (
154-
<View style={styles.container}>
155-
<Button onPress={() => navigation.goBack()}>Go back</Button>
156-
<Animated.Image
157-
source={{ uri: 'https://picsum.photos/id/39/200' }}
158-
style={{ width: 100, height: 100 }}
159-
// highlight-next-line
160-
sharedTransitionTag="tag"
161-
/>
162-
</View>
163-
);
164-
}
165-
166-
export default function App() {
167-
return (
168-
<NavigationContainer>
169-
<Stack.Navigator>
170-
<Stack.Screen name="Home" component={HomeScreen} />
171-
<Stack.Screen name="Details" component={DetailsScreen} />
172-
</Stack.Navigator>
173-
</NavigationContainer>
174-
);
175-
}
176-
177-
const styles = StyleSheet.create({
178-
container: {
179-
flex: 1,
180-
alignItems: 'center',
181-
},
182-
});
183-
```
184-
185-
</TabItem>
186-
</Tabs>
187-
188112
`sharedTransitionTag` is a string that has to be unique in the context of a single screen, but has to match elements between screens. This prop allows Reanimated to identify and animate the elements, similarly to the [`key`](https://react.dev/learn/rendering-lists#keeping-list-items-in-order-with-key) property, which tells React which element in the list is which.
189113

190114
## Customizing the transition
@@ -193,24 +117,25 @@ You can customize the transition by passing a custom `SharedTransition` configur
193117

194118
Custom transition configuration is not fully finalized and might change in a future release.
195119

196-
:::
197-
198120
### Old Architecture (Reanimated 3)
199121

200122
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()`:
201123

202124
```jsx
203125
import { SharedTransition, withSpring } from 'react-native-reanimated';
204126

127+
// highlight-start
205128
const customTransition = SharedTransition.custom((values) => {
206129
'worklet';
130+
207131
return {
208132
height: withSpring(values.targetHeight),
209133
width: withSpring(values.targetWidth),
210134
originX: withSpring(values.targetOriginX),
211135
originY: withSpring(values.targetOriginY),
212136
};
213137
});
138+
// highlight-end
214139

215140
function HomeScreen() {
216141
return (
@@ -233,7 +158,8 @@ Currently customization is more limited due to ongoing development. You can't de
233158
```jsx
234159
import { SharedTransition } from 'react-native-reanimated';
235160

236-
// Example: customize duration and use spring animation
161+
// Customize duration and use spring animation
162+
// highlight-next-line
237163
const customTransition = SharedTransition.duration(550).springify();
238164

239165
function HomeScreen() {
@@ -254,10 +180,10 @@ You can find a full Shared Element Transitions reference in the [React Native Re
254180

255181
## Limitations
256182

257-
Shared Element Transitions have several current limitations to be aware of:
183+
Shared Element Transitions currently have several limitations to be aware of:
258184

259-
- Only the native stack navigator is supported
260-
- The Tab navigator is not supported
185+
- Only the [native stack navigator](native-stack-navigator.md) is supported
186+
- Other navigators such as JS stack, drawer, and bottom tabs are not supported
261187
- Transitions with native modals don't work properly on iOS
262188

263189
### New Architecture specific limitations (Reanimated 4)
@@ -271,9 +197,3 @@ The following limitations apply specifically when using Reanimated 4 on the New
271197
- On iOS, you may encounter issues with vertical positioning due to header height information propagation
272198

273199
The limitations will be addressed in future Reanimated releases.
274-
275-
## Alternatives
276-
277-
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.
278-
279-
The [`react-native-navigation`](https://github.com/wix/react-native-navigation) also comes with support for Shared Element Transitions. You can read more about it [here](https://wix.github.io/react-native-navigation/docs/style-animations#shared-element-transitions).

0 commit comments

Comments
 (0)