App icon indicating copy to clipboard operation
App copied to clipboard

iOS- 1.0.2-51- Left menu shown in the center and need to reload App to fix it

Open mallenexpensify opened this issue 5 years ago • 69 comments

If you haven’t already, check out our contributing guidelines for onboarding and email [email protected] to request to join our Slack channel! Job on Upwork https://www.upwork.com/jobs/~01acd19801f956e8ed


Expected Result:

App should be open and show chat as usually.

Actual Result:

App is opened but left menu is shown in the middle. Need to toggle device orientation again to fix it.

Action Performed:

  1. Launch App
  2. Open any chat
  3. Switch orientation of iPad from landscape to portrait
  4. Switch orientation back to landscape
  5. Tap on home button on iPAD to put app into the background
  6. Open App from background

Platform:

iOS - iPad

Version Number: 1.0.2-51

Notes/Photos/Videos:
image

Expensify/Expensify Issue URL: https://github.com/Expensify/Expensify/issues/157516

mallenexpensify avatar Mar 31 '21 21:03 mallenexpensify

Hi @Amazing1974 everything you should need to propose a solution should be in https://github.com/Expensify/Expensify.cash/blob/master/CONTRIBUTING.md and/or https://github.com/Expensify/Expensify.cash/blob/master/README.md and/or https://github.com/Expensify/Expensify.cash

mallenexpensify avatar Mar 31 '21 23:03 mallenexpensify

@marcaaron assigned to you for incoming proposal reviews since you added the External label to the E/E issue

mallenexpensify avatar Apr 05 '21 21:04 mallenexpensify

Gonna unassign myself from this one as the process changed on that. Adding the Exported label should auto-assign someone now.

marcaaron avatar Apr 05 '21 21:04 marcaaron

Triggered auto assignment to @deetergp (Exported), see https://stackoverflow.com/c/expensify/questions/7972 for more details.

MelvinBot avatar Apr 05 '21 21:04 MelvinBot

on hold to see if https://github.com/Expensify/Expensify.cash/issues/2051 magically fixes this too.

mallenexpensify avatar Apr 14 '21 23:04 mallenexpensify

🤞

deetergp avatar Apr 14 '21 23:04 deetergp

I debugged this issue and found that react native's Dimensions module is behaving weirdly on older iPad devices. When the app is sent to background, onDimensionChange callback function is called with wrong window dimensions before it's called with the right dimensions.

While using iPad in portrait mode (width: 768, height: 1024), when I send the app to the background this function is first called with (width: 1024, height: 768) and then with (width: 768, height: 1024). Components are rendered based on the first call and it's causing elements to be positioned badly on the screen.

I'm still trying to find out why it behaves like this on older iPad versions while it's working as expected on iPhone and iPad Pro.

tugbadogan avatar Apr 15 '21 01:04 tugbadogan

Could be related to this ? https://github.com/facebook/react-native/issues/29290

marcaaron avatar Apr 15 '21 01:04 marcaaron

@marcaaron

Could be related to this ? facebook/react-native#29290

Yes, it looks similar. I couldn't find any workaround or temporary solution yet.

tugbadogan avatar Apr 15 '21 14:04 tugbadogan

Any word on your findings, @tugbadogan?

deetergp avatar Apr 21 '21 21:04 deetergp

Yes, I have a proposal for this issue now.

Since this problem is caused by Dimensions native class is calling 'change' callback too many times with wrong dimensions, we can use debounce to slow down listening these changes, so we can avoid breaking call sites by triggering too many window dimension updates.

Screenshot 2021-04-22 at 02 25 51

Making these changes resolve this issue.

tugbadogan avatar Apr 22 '21 01:04 tugbadogan

Thanks, but maybe there's more to it? I applied this and was able to break it quickly by just changing the orientation a few times.

marcaaron avatar Apr 22 '21 02:04 marcaaron

Which device/emulator are you using to test this? I couldn't reproduce the issue after this fix even though I changed the orientation many times.

https://user-images.githubusercontent.com/3853003/115761826-ad236080-a39a-11eb-907f-ff9692ee7ba0.mov

tugbadogan avatar Apr 22 '21 17:04 tugbadogan

I was testing on on simulator iPad Pro (9.7-inch). Sorry, I think maybe I had an old bundle cached when adding in the suggested change? Tested again and it does seem to fix it. Probably, it's fine to make this change since debouncing this event is a fine idea anyway. But we are not quite addressing the root problem.

marcaaron avatar Apr 22 '21 18:04 marcaaron

Hmm, I was able to reproduce broken view on orientation change on an iPhone (I couldn't find a reliable way to reproduce though). This looks like a separate issue then iPad having broken view when the app is sent to background. It looks like a bug on Drawer.Navigator.

tugbadogan avatar Apr 23 '21 18:04 tugbadogan

Hmm, I was able to reproduce broken view on orientation change on an iPhone

I'm confused as the current discussion is not about iPhone.

This looks like a separate issue then iPad having broken view when the app is sent to background. It looks like a bug on Drawer.Navigator.

Not too sure what you are referring to exactly, but if you have discovered another issue please create a new issue or add context to an existing one.

marcaaron avatar Apr 23 '21 19:04 marcaaron

I doubled price to $500 in Upwork https://www.upwork.com/jobs/~01e2db72cd3240af67

mallenexpensify avatar Apr 26 '21 15:04 mallenexpensify

The link above wasn't getting any 👀 so I closed it and created another with the $500 price. https://www.upwork.com/jobs/~01acd19801f956e8ed

mallenexpensify avatar May 04 '21 15:05 mallenexpensify

Im having some difficulties to reproduce the error on Ipad Pro 9-7 emulator; But a good option would be to transform the hook to functional component and use this react native hook import { useWindowDimensions } from 'react-native'; https://reactnative.dev/docs/usewindowdimensions Its more reliable;

From React Native Docs:

useWindowDimensions is the preferred API for React components. Unlike Dimensions, it updates as the window's dimensions update. This works nicely with the React paradigm.

ViniSchonardie avatar May 04 '21 20:05 ViniSchonardie

Also, i am watching the React Native changelog, and aparently they made some changes about this on 0.63.4, and the Expensify.cash its on 0.63.3...

https://github.com/react-native-community/releases/blob/master/CHANGELOG.md Dimension update events are now properly sent following orientation change (0e9296b95d by @ajpaulingalls) https://github.com/facebook/react-native/commit/0e9296b95da06789121f052e6cd6d7cac808464c

It says android versions, but its enough to give it a try

ViniSchonardie avatar May 04 '21 20:05 ViniSchonardie