IjzerenHein / IjzerenHein/react-navigation-shared-element
Smooth transition only happens once
- Dominant language
- TypeScript
- Stars
- 1.3k
- Forks
- 125
- PR merge metrics
- No merged PRs in 30d
Description
https://user-images.githubusercontent.com/469519/172361966-a0fb0899-47b1-428f-ab54-3ac71a090a2d.mp4
This is where I create the Navigation Container
```typescript
const Root: React.FC = ({}) => {
const theme = useTheme()
return (
({
cardStyle: {
opacity: current.progress,
},
}),
}}
sharedElements={(route, otherRoute, showing) => {
return [
`birth_chart`,
`${route.name}.${route.key}.background`,
`${route.name}.${route.key}.compact`,
{
id: `${route.name}.${route.key}.expanded`,
resize: 'clip',
animation: 'fade',
},
{
id: `${route.name}.${route.key}.back_button`,
resize: 'clip',
animation: 'fade',
},
]
}}
/>
)
}
```
This is the `CardDetail` component:
```typescript
const CardDetail: NavigationStackScreenComponentWithSharedComponent<
CardDetailProps,
RootStackParamList,
'CardDetail'
> = ({ navigation, route }) => {
const theme = useTheme()
const birthChartProviderState = route.params?.birthChartProviderState
return (
{
navigation.pop()
}}
/>
)
}
```
All the shared elements are defined in the `SunInSignCard` component, for example:
```react
```
What could be causing this?
I'm using:
- "expo": "~45.0.0"
- "react-native": "0.68.2"
- "react-native-shared-element": "0.8.4"
- "react-navigation-shared-element": "^3.1.3"
- "@react-navigation/native": "^6.0.10"
- "@react-navigation/native-stack": "^6.6.2"
- "@react-navigation/stack": "^6.2.1"
Contributor guide
No contributing guide indexed for this repository
Research direction
Reproduce the transition shown in the video using the listed Expo, React Native, and navigation versions, then inspect the Root NavigationContainer, CardDetail, and SunInSignCard shared-element definitions. Trace the sharedElements configuration and navigation.pop flow to determine why the smooth transition occurs only once; done means the transition works repeatedly.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- react-native, typescript
- Domain
- mobile
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100