Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix screen jump from Welcome screen to Demo screen (#2744)
* Prevent screen jump Android and iOS were both jumping when navigating from the Welcome screen to the Demo Showroom screen (although in different directions, and Android was less severe). I found this issue was prevented when we use the `<StatusBar>` component on the WelcomeScreen as well as DemoShowroom, so converted WelcomeScreen to use the built-in `Screen` component, which includes `<StatusBar>`. However, that raised another issue: when navigating from the Login screen to the Welcome screen, the "fixed" `Screen` component on Welcome screen would render the wrong height; it would be slightly too tall. This didn't occur when changing presets and reloading the app via fast refresh, which indicated to me that it was likely due to a state change that was using the "old" screen dimensions from Login screen, but then was incorrect after another state change took place on the Welcome screen. I found that was correct: the `useHeader` hook was using useEffect, which means that header height wouldn't be set until the second render, so when the KeyboardAvoidingView on on Welcome screen tried to render, it had the wrong height information and rendered the wrong size. By using `useLayoutEffect`, we make sure the header height is set before any of the screen components try to render, fixing the issue. * Spacing is unused when generating with no demo causes a lint error in a generated project, so fixed
- Loading branch information