Skip to content

Commit

Permalink
Android targetSdk 35 update - remove SafeAreaView and use padding (#95)
Browse files Browse the repository at this point in the history
* Use safe padding for both iOS and Android and Remove use of SafeAreaView and ScrollView.contentInsetAdjustmentBehavior prop.

* update Android targetSdkVersion to 35

---------

Co-authored-by: Nicola Corti <[email protected]>
  • Loading branch information
alanleedev and cortinico authored Jan 14, 2025
1 parent 90f2bf3 commit 3398194
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 6 deletions.
23 changes: 18 additions & 5 deletions template/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import React from 'react';
import type {PropsWithChildren} from 'react';
import {
SafeAreaView,
ScrollView,
StatusBar,
StyleSheet,
Expand Down Expand Up @@ -62,19 +61,33 @@ function App(): React.JSX.Element {
backgroundColor: isDarkMode ? Colors.darker : Colors.lighter,
};

/*
* To keep the template simple and small we're adding padding to prevent view
* from rendering under the System UI.
* For bigger apps the reccomendation is to use `react-native-safe-area-context`:
* https://github.com/AppAndFlow/react-native-safe-area-context
*
* You can read more about it here:
* https://github.com/react-native-community/discussions-and-proposals/discussions/827
*/
const safePadding = '5%';

return (
<SafeAreaView style={backgroundStyle}>
<View style={backgroundStyle}>
<StatusBar
barStyle={isDarkMode ? 'light-content' : 'dark-content'}
backgroundColor={backgroundStyle.backgroundColor}
/>
<ScrollView
contentInsetAdjustmentBehavior="automatic"
style={backgroundStyle}>
<Header />
<View style={{paddingRight: safePadding}}>
<Header/>
</View>
<View
style={{
backgroundColor: isDarkMode ? Colors.black : Colors.white,
paddingHorizontal: safePadding,
paddingBottom: safePadding,
}}>
<Section title="Step One">
Edit <Text style={styles.highlight}>App.tsx</Text> to change this
Expand All @@ -92,7 +105,7 @@ function App(): React.JSX.Element {
<LearnMoreLinks />
</View>
</ScrollView>
</SafeAreaView>
</View>
);
}

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

0 comments on commit 3398194

Please sign in to comment.