question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

wrong size on iOS when using scale

See original GitHub issue

in the RNSharedElementTransition.m line 638, we use the

CGRect ancestorLayout = [self.superview convertRect:endAncestor.style.layout fromView:nil];

code to get the end layout.

But in my case, one page’s width is 375, and I scaled it to fit other screens whose width is not 375 (eg iphone 11 Pro Max 414); And then the ancestorLayout’s width will be 375, but not 414. This is not what I want.

I’m not good at iOS. So what should I do to fix this?

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
wiseqingyangcommented, Aug 26, 2021

@IjzerenHein Hey, it’s me again. I solved my problem by doing the next change: https://github.com/IjzerenHein/react-native-shared-element/blob/edd7c5b32eac8197e736ae91b360d98de1edabaa/ios/RNSharedElementTransition.m#L269

to code

(layout.origin.x - ancestorLayout.origin.x) * scaleX, 

I know it’s not the right way to solve the problem, and maybe it will cause other errors. But it really runs in my case.

Although, I found my issue only occurs when I’m setting the navigation’s cardStyleInterpolator with SlideFromRightIOS or any other SlideFromXXX. And my change only and only if runs with SlideFromRight. It still has problem with SlideFromBottom.

So there are two ways to solve my problem, my change above and using something like TransitionPresets.ScaleFromCenterAndroid but not SlideFromXXX.

That’s all of what I do to solve this. I hope it will help if anyone has the same issue.

Sorry for bother you again.

1reaction
wiseqingyangcommented, Aug 24, 2021

It is a bad news for me. But anyway,thanks for your answer and this library.

Read more comments on GitHub >

github_iconTop Results From Across the Web

iPhone 12 Wrong screen scale - Apple Community
I think that the screen scaling went wrong here. In my opinion the screen content of a 5.8" screen of an iPhone 11...
Read more >
Screen scale/size is right in iOS 8 but wrong in iOS 9 on same ...
I've recently updated Xcode to 7 so I could start developing against iOS 9. Upon first launching my application, I noticed that the...
Read more >
Resizing images to fit the screen using GeometryReader
To fix this we need to ask the image to resize itself proportionally, which can be done using the scaledToFit() and scaledToFill() modifiers....
Read more >
FFImageLoading picking wrong image scale for app resources
FFImageLoading.Forms: Invalid height and width for images with no fixed size in iOS. Problem is occurring in the latest release: 2.1.0. In ...
Read more >
How to scale a view based on device size using Auto Layout ...
Build the rest of the profile screen with the Intro to Auto Layout workshop: https://www.youtube.com/watch?v=_oMBJuzanws.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found