IjzerenHein / IjzerenHein/react-navigation-shared-element
SharedElement is stuck in ScrollView
- Dominant language
- TypeScript
- Stars
- 1.3k
- Forks
- 125
- PR merge metrics
- No merged PRs in 30d
Description
When go back from a details screen the image wrapped inside SharedElement got stuck in the screen, here's a video:
https://user-images.githubusercontent.com/43631579/108575576-58069800-72e0-11eb-97f7-ffe6e9005160.mov
And this is my code of ScrollView:
```jsx
{meals.map(meal => {
return (
<>
{meal.type}
navigation.navigate('Recipe', { item: meal })}>
{meal.title}
{meal.kcal}kcal
)
})}
```
and code in the DetailsScreen
```jsx
const RecipeScreen = ({ navigation }) => {
const { width } = Dimensions.get('window')
const item = navigation.getParam('item')
return (
navigation.goBack()} />
Some description
)
}
RecipeScreen.sharedElements = navigation => {
const item = navigation.getParam('item')
return [item.id]
}
export default RecipeScreen
```
my stackNavigator:
```jsx
import { createSharedElementStackNavigator } from 'react-navigation-shared-element'
import MealPlanScreen from '../screens/mealPlanScreen'
import RecipeScreen from '../screens/recipeScreen'
export default createSharedElementStackNavigator(
{
MealPlan: MealPlanScreen,
Recipe: RecipeScreen,
},
{
headerMode: 'none',
initialRouteName: 'MealPlan',
defaultNavigationOptions: {
cardStyleInterpolator: ({ current: { progress }}) => {
return { cardStyle: { opacity: progress }}
},
cardStyle: {
backgroundColor: 'transparent',
},
},
}
)
```
versions:
```json
"react-native-shared-element": "^0.7.0",
"react-native-safe-area-context": "^3.1.9",
"react-navigation-shared-element": "^2.3.1",
"react-navigation-stack": "^2.10.2",
"react-navigation": "^4.0.0",
```
I hope anyone can help me :( im very stuck at this moment (haha)
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by reproducing the stuck image with the supplied ScrollView, RecipeScreen, and stack navigator snippets using the listed package versions. Compare the shared-element behavior during back navigation and verify that the image returns to its ScrollView position without remaining fixed on screen.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- react-native
- Domain
- mobile
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100