Skip to content
This repository has been archived by the owner on Jan 30, 2021. It is now read-only.

setStatusBarHeight should trigger re-render #38

Closed
wants to merge 1 commit into from

Conversation

slorber
Copy link
Member

@slorber slorber commented Aug 14, 2018

Hi,

On iOS the statusbar height might change (when calling someone, or when sharing network connection)

The following package permit to listen for such changes: https://github.com/expo/status-bar-height
See also https://blog.expo.io/the-status-bar-manager-in-react-native-6226058ecba

If the height change during the lifetime of the app, we should rather make the safeArea views re-render so that the view does not appear under the statusbar extra height.

The idea is that I could write the following integration code to track correctly the statusbar:

export const trackStatusBarHeightChanges = async () => {
  const initialHeight = await StatusBarHeight.getAsync();
  SafeAreaView.setStatusBarHeight(initialHeight);
  const listener = height => SafeAreaView.setStatusBarHeight(height);
  StatusBarHeight.addEventListener(listener);
  return () => StatusBarHeight.removeEventListener(listener);
};

@slorber
Copy link
Member Author

slorber commented Aug 14, 2018

Ideally, I think adding expo/status-bar-height to this lib and doing the tracking by default could be helpful. Didn't want to add a new dependency to this lib, so please tell me if this makes sense. cc @EvanBacon

@brentvatne
Copy link
Member

I'm waiting for facebook/react-native#20999 to solve this properly

@brentvatne
Copy link
Member

this isn't needed anymore on 1.0 of this library 👼 see readme for more info :) thanks though!

@brentvatne brentvatne closed this Sep 26, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants