You've already forked joplin
mirror of
https://github.com/laurent22/joplin.git
synced 2025-06-12 22:57:38 +02:00
RN upgrade: Fixing Android app
This commit is contained in:
@ -1,11 +1,31 @@
|
||||
const React = require('react');
|
||||
import { Platform, SafeAreaView } from 'react-native';
|
||||
import { View, Platform, SafeAreaView, StyleSheet, StatusBar } from 'react-native';
|
||||
import DeviceInfo from 'react-native-device-info';
|
||||
|
||||
// Untested! This should check if the device has a notch and, if it does, apply
|
||||
// an extra padding on top of the screen.
|
||||
const styles = StyleSheet.create({
|
||||
AndroidSafeArea: {
|
||||
paddingTop: Platform.OS === 'android' && DeviceInfo.hasNotch() ? StatusBar.currentHeight : 0,
|
||||
},
|
||||
});
|
||||
|
||||
function JoplinSafeAreaView(props) {
|
||||
if (Platform.OS === 'ios') {
|
||||
return <SafeAreaView {...props}>{props.children}</SafeAreaView>;
|
||||
} else {
|
||||
throw new Error('Not done');
|
||||
const viewProps = Object.assign({}, props);
|
||||
|
||||
const style = [];
|
||||
|
||||
if (viewProps.style) {
|
||||
style.push(viewProps.style);
|
||||
delete viewProps.style;
|
||||
}
|
||||
|
||||
style.push(styles.AndroidSafeArea);
|
||||
|
||||
return <View style={style} {...viewProps}>{props.children}</View>;
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user