mattermost-mobile/app/components/layout/keyboard_layout.js
Harrison Healey 96da38ed14 RN-345 Optimizing channel switching and general improvements (#914)
* Reduced re-renders of Channel screen

* Switched some components to be PureComponents

* Stopped waiting for drawer to close to switch channels

* Fixed post list being stuck loading

* Fixed incorrectly removed ref

* Removed loader from channel post list

* Removed unused prop

* Re-added ChannelDrawer.swiperIndex

* Changed ChannelPostTextbox to only require a single draft

* Re-enable InteractionManager on ChannelDrawer

* Fixed ChannelDrawer.joinChannel and removed duplicated code

* Moved getting device dimensions into render method

* Switched ChannelsList to be a PureComponent
2017-09-18 17:39:21 -03:00

36 lines
1 KiB
JavaScript

// Copyright (c) 2017-present Mattermost, Inc. All Rights Reserved.
// See License.txt for license information.
import React from 'react';
import PropTypes from 'prop-types';
import {KeyboardAvoidingView, Platform, View} from 'react-native';
export default class KeyboardLayout extends React.PureComponent {
static propTypes = {
behaviour: PropTypes.string,
children: PropTypes.node,
keyboardVerticalOffset: PropTypes.number
};
render() {
const {behaviour, children, keyboardVerticalOffset, ...otherProps} = this.props;
if (Platform.OS === 'android') {
return (
<View {...otherProps}>
{children}
</View>
);
}
return (
<KeyboardAvoidingView
behaviour={behaviour}
keyboardVerticalOffset={keyboardVerticalOffset}
{...otherProps}
>
{children}
</KeyboardAvoidingView>
);
}
}