Skip to content
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 - Add Android only padding to account for lack of SafeAreaView #94

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion template/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import React from 'react';
import type {PropsWithChildren} from 'react';
import {
Platform,
SafeAreaView,
ScrollView,
StatusBar,
Expand Down Expand Up @@ -62,6 +63,9 @@ 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 = Platform.OS === 'android' ? '5%' : 0;

return (
<SafeAreaView style={backgroundStyle}>
<StatusBar
Expand All @@ -71,10 +75,14 @@ function App(): React.JSX.Element {
<ScrollView
contentInsetAdjustmentBehavior="automatic"
style={backgroundStyle}>
<Header />
<View style={{paddingRight: hackyPadding}}>
Copy link
Collaborator Author

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

<Header/>
</View>
<View
style={{
backgroundColor: isDarkMode ? Colors.black : Colors.white,
paddingHorizontal: hackyPadding,
Copy link
Collaborator Author

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

paddingBottom: hackyPadding,
Copy link
Collaborator Author

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

}}>
<Section title="Step One">
Edit <Text style={styles.highlight}>App.tsx</Text> to change this
Expand Down
2 changes: 1 addition & 1 deletion template/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ buildscript {
buildToolsVersion = "35.0.0"
minSdkVersion = 24
compileSdkVersion = 35
targetSdkVersion = 34
targetSdkVersion = 35
ndkVersion = "27.1.12297006"
kotlinVersion = "2.0.21"
}
Expand Down
Loading