react-native-navigation icon indicating copy to clipboard operation
react-native-navigation copied to clipboard

[V2] [iOS] Permit showOverlay to not impact statusBarStyle

Open pribeh opened this issue 5 years ago • 10 comments

showOverlay is really useful for creating card and notification type UI elements that don't necessarily cover the statusbar. Currently, showOverlay always impacts the statusBarStyle of the underlying screen regardless of whether it is defined. This can be demonstrated by calling showOverlay overtop screens with different statusbarStyles. The statusBarStyle should probably not be set by default or a 'null' value should be optional.

pribeh avatar Mar 14 '19 23:03 pribeh

Anyone have any pointers where I could start looking to disable statusbar selection on overlays?

pribeh avatar Apr 02 '19 01:04 pribeh

I think passing null is preferred to disabling StatusBar color all together for Overlays. That might require small changes to OptionsProcessor.processColor, not sure how it currently handles null.

guyca avatar Apr 02 '19 05:04 guyca

@guyca thanks for responding. is there a way to simply pass null for all statusbar attributes for overlays? If, on android for instance, a statusbar is set to drawunder and then not across different routes/screens, overlays will override again, causing the screen layout to shift.

pribeh avatar Apr 03 '19 23:04 pribeh

If you access RNN's publish api (push, pop etc) through a dedicated service (or swizzle Navigation.showOverlay), you can enforce any style properties you want.

guyca avatar Apr 04 '19 07:04 guyca

The issue is when you display the same overlay(s) over different screens with different requirements. In our case, we define an overlay along with our root navigation which we hide and display when we need to (we use it as a custom dashboard style tabbar). It will always overrides the statusbar settings for each screen no matter what we set when pushing another screen.

export const goToHome = () => {
    Navigation.showOverlay({
        component: {
            id: 'DashboardOverlay',
            name: 'app.DashboardOverlay',
            options: {
                overlay: {
                    interceptTouchOutside: false
                },
            }
        }
    });
    Navigation.setRoot({
        root: {
.......
}

pribeh avatar Apr 18 '19 21:04 pribeh

I was going to post same issue, when I found yours , the showOverlay doesn't respect the current pushed screen props, did you find a way to stop it from overriding the status bar?

AbanoubNassem avatar Sep 04 '19 15:09 AbanoubNassem

@AbanoubNassem declaring the following on every screen is the only way we've found so far:

   componentDidAppear() {
		if (Platform.OS === 'ios') {
			Navigation.mergeOptions("DashboardOverlay", {
				statusBar: {
					style: 'light'
				}
			})
			Navigation.mergeOptions("InAppNotificationComponent", {
				statusBar: {
					style: 'light'
				}
			})
			Navigation.mergeOptions("NotificationComponent", {
				statusBar: {
					style: 'light'
				}
			})
		}
	}

pribeh avatar Sep 04 '19 16:09 pribeh

@AbanoubNassem declaring the following on every screen is the only way we've found so far:

   componentDidAppear() {
		if (Platform.OS === 'ios') {
			Navigation.mergeOptions("DashboardOverlay", {
				statusBar: {
					style: 'light'
				}
			})
			Navigation.mergeOptions("InAppNotificationComponent", {
				statusBar: {
					style: 'light'
				}
			})
			Navigation.mergeOptions("NotificationComponent", {
				statusBar: {
					style: 'light'
				}
			})
		}
	}

well that's super bad , since in my case it's more complex some screens has the status bar hidden etc , that will add more complexity and ugly code!

AbanoubNassem avatar Sep 05 '19 06:09 AbanoubNassem

This is extremely obvious overlay behavior. If screens represents as stack of cards, there's should be a way to inherit properties from previous one.

Hope there will be some way to fix that in future releases.

Natteke avatar Sep 25 '19 09:09 Natteke

Is there any update on this?

ghiculescualexandru avatar Feb 18 '22 11:02 ghiculescualexandru