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

setStatusBarHeight should trigger re-render #38

Open
wants to merge 1 commit into
base: master
from

Conversation

Projects
None yet
2 participants
@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

This comment has been minimized.

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

This comment has been minimized.

Collaborator

brentvatne commented Sep 19, 2018

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment