-
Notifications
You must be signed in to change notification settings - Fork 20
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
Android targetSdk 35 update - remove SafeAreaView and use padding #95
base: main
Are you sure you want to change the base?
Android targetSdk 35 update - remove SafeAreaView and use padding #95
Conversation
Remove use of SafeAreaView and ScrollView.contentInsetAdjustmentBehavior prop.
return ( | ||
<SafeAreaView style={backgroundStyle}> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SafeAreaView is removed
@@ -62,19 +61,25 @@ function App(): React.JSX.Element { | |||
backgroundColor: isDarkMode ? Colors.darker : Colors.lighter, | |||
}; | |||
|
|||
// Note: adding hacky padding to avoid importing rn-safe-area-context library but should not be done in production | |||
const hackyPadding = '5%'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
magic padding is used for both iOS and Android
<StatusBar | ||
barStyle={isDarkMode ? 'light-content' : 'dark-content'} | ||
backgroundColor={backgroundStyle.backgroundColor} | ||
/> | ||
<ScrollView | ||
contentInsetAdjustmentBehavior="automatic" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removed iOS only prop: contentInsetAdjustmentBehavior
style={backgroundStyle}> | ||
<Header /> | ||
<View style={{paddingRight: hackyPadding}}> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
right padding for RN version indicator
<View | ||
style={{ | ||
backgroundColor: isDarkMode ? Colors.black : Colors.white, | ||
paddingHorizontal: hackyPadding, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
left, right padding for content within ScrollView
<View | ||
style={{ | ||
backgroundColor: isDarkMode ? Colors.black : Colors.white, | ||
paddingHorizontal: hackyPadding, | ||
paddingBottom: hackyPadding, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
bottom padding to prevent content overlap with button nav bar
Summary:
This is an alternative implementation for PR #94 which removes SafeAreaView entirely and uses magic padding for both iOS and Android.
Updating to targetSdk 35 on Android enforces edge-to-edge on Android 15+.
We decided not to use react-native-safe-area-context in the template (PR #84 ) to reduce external dependency although it is the react-native-community/discussions-and-proposals#827.
To account for UI overlap, we are using a magic padding value for both iOS and Android in the template.
Also SafeAreaView (iOS only) was removed so same code is used on both platforms.
Changelog:
[ANDROID][CHANGED] - update targetSdk to 35 which will enforce edge-to-edge on Android 15+
[GENERAL][REMOVED] - Removed use of SafeAreaView
Test Plan:
ios_hacky_padding_only.mp4
ios_hacky_padding_only_land.mp4
android_hacky_padding.mp4
android_hacky_padding_land.mp4