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

Wrong bottom inset on Android when app goes background

Open zabojad opened this issue 4 months ago • 5 comments

When the app goes in background mode, <SafeAreaInsetsContext.Consumer> triggers a re-render with a wrong bottom inset value.

const MyScreen = () => {

	const renderNavTabBarWithInsets = (insets: EdgeInsets|null) => {
		if (__DEV__) {
			// I get {"bottom": 0, "left": 0, "right": 0, "top": 33} on my Samsung S21
			// except when going in background mode, it re-renders with 
			// {"bottom": 48, "left": 0, "right": 0, "top": 33}
			console.debug('renderNavTabBarWithInsets ',insets);
		}
		return (<></>);
		);
	}

	return (
		<SafeAreaInsetsContext.Consumer>
			{renderNavTabBarWithInsets}
		</SafeAreaInsetsContext.Consumer>
	);
}

My setup:

    "react": "18.3.1",
    "react-native": "0.75.5",
    "react-native-safe-area-context": "5.3.0",

zabojad avatar Jun 11 '25 14:06 zabojad