Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Shared Element Transition does not transform Image correctly #6505

Closed
1 of 2 tasks
mrousavy opened this issue Aug 24, 2020 · 8 comments
Closed
1 of 2 tasks

Shared Element Transition does not transform Image correctly #6505

mrousavy opened this issue Aug 24, 2020 · 8 comments

Comments

@mrousavy
Copy link
Collaborator

mrousavy commented Aug 24, 2020

Progress

Issue Description

When using Shared Element Transitions to animate Images between Screens, the animation does not work in the following scenarios:

  1. The source image and destination image have different layout sizes (aspect ratios), e.g.: source image layout is 400 x 300, destination image is 440 x 300.
  2. The source image and destination image have different resizeModes.

I've created a repro for this bug in a branch on my fork. This shows the first scenarios, change the resizeMode to 'contain' to reproduce the second scenario.

Steps to Reproduce / Code Snippets / Screenshots

  1. Create Shared Element Transitions as explained in the docs
  2. Give source image a different aspect ratios than the destination image, e.g.:
    sourceImage: { 
      width: 400,
      height: 300
    }
    and destination:
    destImage: {
      width: 440,
      height: 300
    }
  3. Animate between them.

Demo GIF

iOS Android
Animating between Images with different Aspect Ratios aspect ratio bug iOS demo aspect ratio bug android demo
Animating between Images with different resizeModes resizeMode bug iOS demo resizeMode bug android demo

Environment

  • React Native Navigation version: 6.12.0
  • React Native version: 0.63.2
  • Platform: iOS only
  • Device info: Simulator & Device, Debug & Release
guyca added a commit that referenced this issue Aug 24, 2020
When animating images in shared element transition, we change their ScaleType to an InterpolatingScaleType.
At the end of the animation we need to restore the ScaleType back to its original value but for some reason this doesn't seem to work.

The current solution recursively find the original scale type used for the destination image.

Related to #6505
yogevbd pushed a commit that referenced this issue Aug 25, 2020
When animating images in shared element transition, we change their ScaleType to an InterpolatingScaleType.
At the end of the animation we need to restore the ScaleType back to its original value but for some reason this doesn't seem to work.

The current solution recursively find the original scale type used for the destination image.

Related to #6505
@mrousavy
Copy link
Collaborator Author

Can confirm that the issue also occurs with <TextInput> components of different dimensions and/or font sizes. SETs are becoming more and more brainf*ck...

@tastyqbit
Copy link

This is still not working properly. Any updates?

@yogevbd
Copy link
Collaborator

yogevbd commented Dec 20, 2020

@tastyqbit Are you talking about image transition with different resizeMode? it's still not supported on iOS but we will add it soon.

@yogevbd yogevbd reopened this Dec 20, 2020
@tastyqbit
Copy link

@yogevbd Yes that is what I was asking about, thanks for the update :) Do you have any idea on the timeline? I am just in the process of upgrading a lot of libraries including react-native from 0.59 to 0.63 and RNN from v2 to v7 and maybe I wait instead of redo my workaround I made for v2 if its not too long

@FawadMahmood
Copy link

FawadMahmood commented Feb 10, 2021

In my case shared element only working for IOS,on android element just disappear.

@guyca
Copy link
Collaborator

guyca commented Apr 18, 2021

Closing this issue as the last messages don't provide substantial info to work with. If there are any more issues related to image transformations, we would greatly appreciate if you could open new issues with reproductions and we will look into them ASAP.

@guyca guyca closed this as completed Apr 18, 2021
@tastyqbit
Copy link

@guyca Does that mean the "Animating between Images with different resizeModes" issue shown in the demo gifs above is solved?

@mrousavy
Copy link
Collaborator Author

Yes. See e184102, 0c97477 and c49567f

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants