IjzerenHein / IjzerenHein/react-native-shared-element

Support ModalPresentationIOS transition preset

Open
#23 7 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement react-navigation
Dominant language
TypeScript
Stars
2.3k
Forks
113
PR merge metrics
No merged PRs in 30d

Description

The animation begins smoothly, but when the animation finishes, the items (`SharedElement`s) are off by some pixels which causes this stuttering glitch. This issue only appears when using the `ModalPresentationIOS` transition preset. All other presets work fine.

Demo here:
![Screen-Recording-2020-03-28-at-19 09 06](https://user-images.githubusercontent.com/15199031/77830415-8a3b6400-7128-11ea-83b5-30ac869d8e35.gif)

My Navigator:

```js
const SharedElementStack = createSharedElementStackNavigator();
function HomeSharedElementStackNavigator() {
return (


{
const {item} = route.params;
return [
{
id: `item.${item.id}.image`,
animation: 'fade',
},
{
id: `item.${item.id}.title`,
animation: 'fade',
},
{
id: `item.${item.id}.description`,
animation: 'fade',
},
];
}}
/>

);
}
```

I've tried playing around with the `animation` property, but I can't seem to get it working with this animation I found in the example project (`springyFadeIn.js`):

```js
import {Animated} from 'react-native';
export function springyFadeIn() {
const transitionSpec = {
timing: Animated.spring,
tension: 10,
useNativeDriver: true,
};
return {
transitionSpec,
screenInterpolator: ({position, scene}) => {
const {index} = scene;

const opacity = position.interpolate({
inputRange: [index - 1, index],
outputRange: [0, 1],
});

return {opacity};
},
};
}
```

Packages used:
```json
// ...
"react": "16.9.0",
"react-native": "0.61.5",
"react-navigation-shared-element": "^5.0.0-alpha1",
// ...
```

I don't know if that's a bug in the library or if I am making a mistake, would appreciate some help here!

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the transition using the provided SharedElementStack navigator and the ModalPresentationIOS preset with the listed React Native and react-navigation-shared-element versions. Compare it with the other presets and the springyFadeIn example; the issue is done when SharedElements no longer shift or stutter at the end of the transition.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, react-native
Domain
mobile
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.