RN upgrade: Fix SafeAreaView on iOS

pull/2482/head
Laurent Cozic 2020-02-09 15:48:09 +00:00
parent 4235288c55
commit 813137efc9
5 changed files with 33 additions and 11 deletions

View File

@ -0,0 +1,12 @@
const React = require('react');
import { Platform, SafeAreaView } from 'react-native';
function JoplinSafeAreaView(props) {
if (Platform.OS === 'ios') {
return <SafeAreaView {...props}>{props.children}</SafeAreaView>;
} else {
throw new Error('Not done');
}
}
module.exports = JoplinSafeAreaView;

View File

@ -3,7 +3,7 @@
const React = require('react');
const { connect } = require('react-redux');
const { Platform, View, Text, StyleSheet, TouchableOpacity, Image, ScrollView, Dimensions } = require('react-native');
const { View, Text, StyleSheet, TouchableOpacity, Image, ScrollView, Dimensions } = require('react-native');
const Icon = require('react-native-vector-icons/Ionicons').default;
const { BackButtonService } = require('lib/services/back-button.js');
const NavService = require('lib/services/NavService.js');
@ -45,7 +45,6 @@ class ScreenHeaderComponent extends React.PureComponent {
alignItems: 'center',
shadowColor: '#000000',
elevation: 5,
paddingTop: Platform.OS === 'ios' ? 15 : 0, // Extra padding for iOS because the top icons are there
},
divider: {
borderBottomWidth: 1,

View File

@ -6929,6 +6929,14 @@
"resolved": "https://registry.npmjs.org/react-native-image-resizer/-/react-native-image-resizer-1.0.0.tgz",
"integrity": "sha1-1H4UlDw3k44of71jnk23zrf9iRc="
},
"react-native-log-ios": {
"version": "1.5.0",
"resolved": "https://registry.npmjs.org/react-native-log-ios/-/react-native-log-ios-1.5.0.tgz",
"integrity": "sha512-3dp+exwbCXwVSJsdjPUYhaBSzeLjq26EFPLgL9xRdAnX3p7FVWHoXzByfzCTT8Q+hYrcGS7Lw72i3hTmTWwXOA==",
"requires": {
"commander": "^2.19.0"
}
},
"react-native-material-buttons": {
"version": "0.5.0",
"resolved": "https://registry.npmjs.org/react-native-material-buttons/-/react-native-material-buttons-0.5.0.tgz",

View File

@ -7,7 +7,9 @@
"scripts": {
"start": "node node_modules/react-native/local-cli/cli.js start",
"postinstall": "node ../Tools/buildReactNativeInjectedJs.js && npx jetify && npm run encodeAssets",
"encodeAssets": "node encodeAssets.js"
"encodeAssets": "node encodeAssets.js",
"log-ios": "react-native-log-ios \"Joplin\"",
"log-android": "adb logcat *:S ReactNative:V ReactNativeJS:V"
},
"dependencies": {
"@react-native-community/slider": "^2.0.8",
@ -55,6 +57,7 @@
"react-native-fs": "^2.11.17",
"react-native-image-picker": "^0.26.7",
"react-native-image-resizer": "^1.0.0",
"react-native-log-ios": "^1.5.0",
"react-native-material-dropdown": "^0.5.2",
"react-native-popup-dialog": "^0.9.35",
"react-native-popup-menu": "^0.10.0",
@ -65,7 +68,6 @@
"react-native-vector-icons": "^6.6.0",
"react-native-version-info": "^0.5.1",
"react-native-webview": "^5.12.0",
"react-navigation": "^1.0.0-beta.21",
"react-redux": "5.0.7",
"redux": "4.0.0",
"reselect": "^4.0.0",

View File

@ -1,8 +1,8 @@
/* eslint-disable enforce-react-hooks/enforce-react-hooks */
const React = require('react');
const { AppState, Keyboard, NativeModules, BackHandler, Platform, Animated } = require('react-native');
const { SafeAreaView } = require('react-navigation');
const { AppState, Keyboard, NativeModules, BackHandler, Platform, Animated, View } = require('react-native');
const SafeAreaView = require('lib/components/SafeAreaView');
const { connect, Provider } = require('react-redux');
const { BackButtonService } = require('lib/services/back-button.js');
const NavService = require('lib/services/NavService.js');
@ -751,12 +751,13 @@ class AppComponent extends React.Component {
}}
>
<MenuContext style={{ flex: 1 }}>
<SafeAreaView style={{ flex: 0, backgroundColor: theme.raisedBackgroundColor }} />
<SafeAreaView style={{ flex: 1, backgroundColor: theme.backgroundColor }}>
<AppNav screens={appNavInit} />
<SafeAreaView style={{ flex: 1 }}>
<View style={{ flex: 1, backgroundColor: theme.backgroundColor }}>
<AppNav screens={appNavInit} />
</View>
<DropdownAlert ref={ref => this.dropdownAlert_ = ref} tapToCloseEnabled={true} />
<Animated.View pointerEvents='none' style={{ position: 'absolute', backgroundColor: 'black', opacity: this.state.sideMenuContentOpacity, width: '100%', height: '100%' }}/>
</SafeAreaView>
<DropdownAlert ref={ref => this.dropdownAlert_ = ref} tapToCloseEnabled={true} />
<Animated.View pointerEvents='none' style={{ position: 'absolute', backgroundColor: 'black', opacity: this.state.sideMenuContentOpacity, width: '100%', height: '100%' }}/>
</MenuContext>
</SideMenu>
);