-
-
Notifications
You must be signed in to change notification settings - Fork 200
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
Flicker in the middle of navigation animation #219
Comments
I managed to fix it by using
|
Seems to be a bug on native implementation only: Importing web implementation works like expected on native |
I took the same approach, it works perfectly, just as Safe Area View should by default |
For the lazy here's a fully fleshed out alternative component: SafeAreaViewFixed.tsx import React, { ReactNode } from 'react';
import { StyleProp, StyleSheet, View, ViewProps, ViewStyle } from 'react-native';
import { Edge, useSafeAreaInsets } from 'react-native-safe-area-context';
type Props = {
children: ReactNode;
style?: StyleProp<ViewStyle>;
edges?: readonly Edge[] | undefined;
} & ViewProps;
/**
* USE THIS - Alternative to the default [SafeAreaView](https://github.com/th3rdwave/react-native-safe-area-context#safeareaview)
* from react-native-safe-area-context which currently has an issue that will cause a flicker / jump on first render on iOS / Android.
*
* [SafeAreaProvider](https://github.com/th3rdwave/react-native-safe-area-context#safeareaprovider) should still be higher in the tree.
*
* GitHub issues:
* [219](https://github.com/th3rdwave/react-native-safe-area-context/issues/219),
* [226](https://github.com/th3rdwave/react-native-safe-area-context/issues/226)
*/
export default function SafeAreaViewFixed({ children, style, edges, ...rest }: Props) {
const insets = useSafeAreaInsets();
const defaultEdges = edges === undefined;
return (
<View
style={StyleSheet.compose(
{
paddingTop: defaultEdges || edges?.includes('top') ? insets.top : undefined,
paddingBottom: defaultEdges || edges?.includes('bottom') ? insets.bottom : undefined,
paddingLeft: defaultEdges || edges?.includes('left') ? insets.left : undefined,
paddingRight: defaultEdges || edges?.includes('right') ? insets.right : undefined,
},
style,
)}
{...rest}
>
{children}
</View>
);
} |
@m-sterspace Thanks -- your code fixed a long-standing issue in the new GasBuddy RN app. It'll impact millions. :-) (And thanks to @tommycarpi for finding the original solution of course.) |
@tommycarpi Had this issue for months now and nothing I tried seemed to fix it, except this - thanks a ton! |
This is documented in the readme |
Can't we adopt the component by @m-sterspace into the actual package? Why ship a |
The safe area view component does work. The hooks have a documented delay we can’t work around yet |
@jacobp100 I am still facing the flickerin issues in end 2023. The solution of @m-sterspace works for me, thank you so much. There is currently no other solution working for me (tested on Android 10) |
Hi! I catch similar issue on adding autofocus to TextInput on ios (didn't check on android yet). So I prepare two screens and on second screen add |
Still have this issue, using the hook and apply styles manually stops it |
I've been struggling with this issue for some months now. What I don't understand is that using SafeAreaView from this lib used to work built in and without this flicker problem. I've first encountered the problem when migrating to RN 0.72 I think but I can not really assert who is faulty, this lib? react-native? my nav lib (RNN wix)? When reading this issue it seems the problem comes from this lib, however I tried downgrading it, although staying on RN 0.72, but it did not solve the problem for me. So what has changed? |
Also still have this issue. I had to use @m-sterspace 's fixed component. Not ideal but will do the trick for now. |
Can you reopen this @jacobp100? |
When navigating to a new screen, a short flicker/jump appears.
I am using SafeAreaProvider wrapped around the rest of my app and then using SafeAreaView at the root of my screens.
Screen.Recording.2021-10-20.at.21.10.08.mov
The text was updated successfully, but these errors were encountered: