react-native-safe-area-context icon indicating copy to clipboard operation
react-native-safe-area-context copied to clipboard

Expo SDK39 flashing jumping SaveArea

Open lc3t35 opened this issue 4 years ago • 5 comments

After migrating my sdk38 expo app to sdk39, I have this strange behavior (on Android and ios) - flash is slowed down 30x to be able to see it as stays during just one frame in the video.

ScreenFlow

As I have a LinearGradient background, to keep the white screen at bottom, I'm using SafeAreaView this way ;

import React, { Fragment } from 'react';
import {
  SafeAreaView,
  useSafeAreaInsets,
} from 'react-native-safe-area-context';

const WrapSafeAreaView = ({ children }) => {
  const insets = useSafeAreaInsets();
  return (
    <Fragment>
      <SafeAreaView
        style={{
          flex: 0,
          backgroundColor: '#6C5AEE',
          paddingBottom: -30,
        }}
      />
      <SafeAreaView
        style={{
          paddingTop: -insets.top,
          flex: 1,
          backgroundColor: '#ffffff',
        }}
      >
        {children}
      </SafeAreaView>
    </Fragment>
  );
};

export default WrapSafeAreaView;

Any idea ?

lc3t35 avatar Oct 11 '20 18:10 lc3t35

After migrating my sdk38 expo app to sdk39, I have this strange behavior (on Android and ios) - flash is slowed down 30x to be able to see it as stays during just one frame in the video.

ScreenFlow

As I have a LinearGradient background, to keep the white screen at bottom, I'm using SafeAreaView this way ;

import React, { Fragment } from 'react';
import {
  SafeAreaView,
  useSafeAreaInsets,
} from 'react-native-safe-area-context';

const WrapSafeAreaView = ({ children }) => {
  const insets = useSafeAreaInsets();
  return (
    <Fragment>
      <SafeAreaView
        style={{
          flex: 0,
          backgroundColor: '#6C5AEE',
          paddingBottom: -30,
        }}
      />
      <SafeAreaView
        style={{
          paddingTop: -insets.top,
          flex: 1,
          backgroundColor: '#ffffff',
        }}
      >
        {children}
      </SafeAreaView>
    </Fragment>
  );
};

export default WrapSafeAreaView;

Any idea ?

Not a perfect solution, but for me helped use useSafeAreaInsets() with View and paddings instead SafeAreaView. But it did not resolve problem completely.

AND-GORNIY avatar Nov 12 '20 12:11 AND-GORNIY

Thank you @AND-GORNIY but I need a perfect solution ;) Anyone else ? @janicduplessis any idea ?

lc3t35 avatar Dec 16 '20 21:12 lc3t35

Same issue here. @AND-GORNIY's suggestion is the best workaround at the moment

GrabbenD avatar Sep 23 '21 08:09 GrabbenD

I agree, @AND-GORNIY has a good workaround. Thank you.

alexandreguedj avatar Oct 08 '21 22:10 alexandreguedj

Same here, using following versions:

"react-native": "0.66.0"
"react-native-safe-area-context": "^3.3.2"
"@react-navigation/native": "^6.0.4"
"@react-navigation/native-stack": "^6.2.5"

Workaround from @AND-GORNIY resolved the issue.

emin93 avatar Nov 11 '21 12:11 emin93

It's a documented - and currently un-resolvable - issue with the hooks. Use the components directly to avoid it

jacobp100 avatar Jan 19 '23 16:01 jacobp100