React-native: SafeArea Memory Leak

Created on 24 Mar 2020  路  9Comments  路  Source: facebook/react-native

I used SafeAreaView inside a view on ios simulator memory usage grow up fast
recently simulator show warning is shaking and on this case also this safeArea is shaking I bleave each time safe are calculate offset keep it a memory that means more calculate more memory watch the gif

without safe area (1mb take time)

Screen-Recording-2020-03-24-at-11 27 36

with safe area (3mb take time)

Screen-Recording-2020-03-24-at-11 24 47
it's going over 2gb and crashing

 <View style={styles.footer}>
          <Button
            square
            disabled={disabled}
            onPress={this.submit}
            style={StyleSheet.flatten([
              styles.registerOrder,
              orderType === 'buy' ? styles.submitBuy : styles.submitSell,
            ])}
            size="large"
          >
            <SafeAreaView>
              <Typography
                text={`${t(isEdit ? 'Edit Order' : 'Register Order')} ${
                  this.state.orderCount > 0 ? this.state.orderCount : ''
                }`}
                variant="button"
              />
            </SafeAreaView>
          </Button>
        </View>

React Native version:

System:
    OS: macOS 10.15.3
    CPU: (16) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
    Memory: 998.20 MB / 16.00 GB
    Shell: 5.7.1 - /bin/zsh
  Binaries:
    Node: 12.16.1 - /usr/local/bin/node
    Yarn: 1.19.2 - /usr/local/bin/yarn
    npm: 6.13.7 - /usr/local/bin/npm
    Watchman: 4.9.0 - /usr/local/bin/watchman
  SDKs:
    iOS SDK:
      Platforms: iOS 13.2, DriverKit 19.0, macOS 10.15, tvOS 13.2, watchOS 6.1
    Android SDK:
      API Levels: 28, 29
      Build Tools: 28.0.3, 29.0.2
      System Images: android-29 | Google Play Intel x86 Atom
  IDEs:
    Android Studio: 3.5 AI-191.8026.42.35.5977832
    Xcode: 11.3/11C29 - /usr/bin/xcodebuild
  npmPackages:
    react: 16.9.0 => 16.9.0 
    react-native: 0.61.5 => 0.61.5 
  npmGlobalPackages:
    create-react-native-web-app: 0.1.14
Bug SafeAreaView

Most helpful comment

same here...
unreal CPU usage when the safeareaview starts to twitch...

All 9 comments

hi @shergin give me a favor and take a look at this,

same here...
unreal CPU usage when the safeareaview starts to twitch...

Got the same issue with SafeAreaView.

I replaced it by useSafeArea hook from react-native-safe-area-context as a workaround in my project.

Yep, I replaced it by SafeAreaView from react-native-safe-area-view too. Thats work.

@akshlu I replaced Too but in case of handle recalculate height of the window in the parent of 'react-native-safe-area-context' it can not correctly calculate the safe area

@hramos maybe its time to give up this to the community!

Hey there, it looks like there has been no activity on this issue recently. Has the issue been fixed, or does it still require the community's attention? This issue may be closed if no further activity occurs. You may also label this issue as a "Discussion" or add it to the "Backlog" and I will leave it open. Thank you for your contributions.

Closing this issue after a prolonged period of inactivity. If this issue is still present in the latest release, please feel free to create a new issue with up-to-date information.

Was this page helpful?
0 / 5 - 0 ratings