Fix partially shown drawers when orientation change on iOS (#3555)
This commit is contained in:
parent
96b78adf45
commit
6610a51a3d
2 changed files with 12 additions and 2 deletions
|
|
@ -86,7 +86,7 @@ export default class SafeAreaIos extends PureComponent {
|
|||
|
||||
if (DeviceTypes.IS_IPHONE_WITH_INSETS || mattermostManaged.hasSafeAreaInsets) {
|
||||
const window = dimensions?.window || Dimensions.get('window');
|
||||
const orientation = window.width > window.length ? LANDSCAPE : PORTRAIT;
|
||||
const orientation = window.width > window.height ? LANDSCAPE : PORTRAIT;
|
||||
const {safeAreaInsets} = await SafeArea.getSafeAreaInsetsForRootView();
|
||||
this.setSafeAreaInsets(safeAreaInsets, orientation);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ import {
|
|||
Easing,
|
||||
Keyboard,
|
||||
PanResponder,
|
||||
Platform,
|
||||
StyleSheet,
|
||||
TouchableWithoutFeedback,
|
||||
View,
|
||||
|
|
@ -119,6 +120,16 @@ export default class DrawerLayout extends Component {
|
|||
|
||||
componentDidMount() {
|
||||
Dimensions.addEventListener('change', this.handleDimensionsChange);
|
||||
if (Platform.OS === 'ios') {
|
||||
// on iOS force closing the drawers to prevent them for partially showing
|
||||
// when channging the device orientation, probably caused by RN61
|
||||
Animated.timing(this.openValue, {
|
||||
toValue: 0,
|
||||
duration: 10,
|
||||
easing: Easing.out(Easing.cubic),
|
||||
useNativeDriver: this.props.useNativeAnimations,
|
||||
}).start();
|
||||
}
|
||||
}
|
||||
|
||||
componentWillUnmount() {
|
||||
|
|
@ -263,7 +274,6 @@ export default class DrawerLayout extends Component {
|
|||
const {isTablet} = this.props;
|
||||
const panHandlers = isTablet ? emptyObject : this._panResponder.panHandlers;
|
||||
const containerStyles = [styles.container];
|
||||
|
||||
if (isTablet) {
|
||||
containerStyles.push(styles.tabletContainer);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue