Chore: Evaluate KeyboardView - TypeScript (#4014)
Co-authored-by: Diego Mello <diegolmello@gmail.com>
This commit is contained in:
parent
99ea5d8e2a
commit
ef81796cd3
|
@ -4,7 +4,7 @@ import { ScrollView, ScrollViewProps, StyleSheet, View } from 'react-native';
|
||||||
import { themes } from '../lib/constants';
|
import { themes } from '../lib/constants';
|
||||||
import sharedStyles from '../views/Styles';
|
import sharedStyles from '../views/Styles';
|
||||||
import scrollPersistTaps from '../utils/scrollPersistTaps';
|
import scrollPersistTaps from '../utils/scrollPersistTaps';
|
||||||
import KeyboardView from '../presentation/KeyboardView';
|
import KeyboardView from './KeyboardView';
|
||||||
import { useTheme } from '../theme';
|
import { useTheme } from '../theme';
|
||||||
import StatusBar from './StatusBar';
|
import StatusBar from './StatusBar';
|
||||||
import AppVersion from './AppVersion';
|
import AppVersion from './AppVersion';
|
||||||
|
|
|
@ -0,0 +1,24 @@
|
||||||
|
import React from 'react';
|
||||||
|
import { KeyboardAwareScrollView, KeyboardAwareScrollViewProps } from '@codler/react-native-keyboard-aware-scroll-view';
|
||||||
|
|
||||||
|
import scrollPersistTaps from '../utils/scrollPersistTaps';
|
||||||
|
|
||||||
|
interface IKeyboardViewProps extends KeyboardAwareScrollViewProps {
|
||||||
|
keyboardVerticalOffset?: number;
|
||||||
|
scrollEnabled?: boolean;
|
||||||
|
children: React.ReactElement[] | React.ReactElement;
|
||||||
|
}
|
||||||
|
|
||||||
|
const KeyboardView = ({ style, contentContainerStyle, scrollEnabled, keyboardVerticalOffset, children }: IKeyboardViewProps) => (
|
||||||
|
<KeyboardAwareScrollView
|
||||||
|
{...scrollPersistTaps}
|
||||||
|
style={style}
|
||||||
|
contentContainerStyle={contentContainerStyle}
|
||||||
|
scrollEnabled={scrollEnabled}
|
||||||
|
alwaysBounceVertical={false}
|
||||||
|
extraHeight={keyboardVerticalOffset}>
|
||||||
|
{children}
|
||||||
|
</KeyboardAwareScrollView>
|
||||||
|
);
|
||||||
|
|
||||||
|
export default KeyboardView;
|
|
@ -1,28 +0,0 @@
|
||||||
import React from 'react';
|
|
||||||
import { KeyboardAwareScrollView, KeyboardAwareScrollViewProps } from '@codler/react-native-keyboard-aware-scroll-view';
|
|
||||||
|
|
||||||
import scrollPersistTaps from '../utils/scrollPersistTaps';
|
|
||||||
|
|
||||||
interface IKeyboardViewProps extends KeyboardAwareScrollViewProps {
|
|
||||||
keyboardVerticalOffset?: number;
|
|
||||||
scrollEnabled?: boolean;
|
|
||||||
children: React.ReactNode;
|
|
||||||
}
|
|
||||||
|
|
||||||
export default class KeyboardView extends React.PureComponent<IKeyboardViewProps, any> {
|
|
||||||
render() {
|
|
||||||
const { style, contentContainerStyle, scrollEnabled, keyboardVerticalOffset, children } = this.props;
|
|
||||||
|
|
||||||
return (
|
|
||||||
<KeyboardAwareScrollView
|
|
||||||
{...scrollPersistTaps}
|
|
||||||
style={style}
|
|
||||||
contentContainerStyle={contentContainerStyle}
|
|
||||||
scrollEnabled={scrollEnabled}
|
|
||||||
alwaysBounceVertical={false}
|
|
||||||
extraHeight={keyboardVerticalOffset}>
|
|
||||||
{children}
|
|
||||||
</KeyboardAwareScrollView>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -8,7 +8,7 @@ import TextInput from '../presentation/TextInput';
|
||||||
import Loading from '../containers/Loading';
|
import Loading from '../containers/Loading';
|
||||||
import { createChannelRequest } from '../actions/createChannel';
|
import { createChannelRequest } from '../actions/createChannel';
|
||||||
import { removeUser } from '../actions/selectedUsers';
|
import { removeUser } from '../actions/selectedUsers';
|
||||||
import KeyboardView from '../presentation/KeyboardView';
|
import KeyboardView from '../containers/KeyboardView';
|
||||||
import scrollPersistTaps from '../utils/scrollPersistTaps';
|
import scrollPersistTaps from '../utils/scrollPersistTaps';
|
||||||
import I18n from '../i18n';
|
import I18n from '../i18n';
|
||||||
import UserItem from '../containers/UserItem';
|
import UserItem from '../containers/UserItem';
|
||||||
|
|
|
@ -4,7 +4,7 @@ import { ScrollView, Switch, Text } from 'react-native';
|
||||||
import { StackNavigationOptions } from '@react-navigation/stack';
|
import { StackNavigationOptions } from '@react-navigation/stack';
|
||||||
|
|
||||||
import Loading from '../../containers/Loading';
|
import Loading from '../../containers/Loading';
|
||||||
import KeyboardView from '../../presentation/KeyboardView';
|
import KeyboardView from '../../containers/KeyboardView';
|
||||||
import scrollPersistTaps from '../../utils/scrollPersistTaps';
|
import scrollPersistTaps from '../../utils/scrollPersistTaps';
|
||||||
import I18n from '../../i18n';
|
import I18n from '../../i18n';
|
||||||
import * as HeaderButton from '../../containers/HeaderButton';
|
import * as HeaderButton from '../../containers/HeaderButton';
|
||||||
|
|
|
@ -12,7 +12,7 @@ import StatusBar from '../containers/StatusBar';
|
||||||
import TextInput from '../containers/TextInput';
|
import TextInput from '../containers/TextInput';
|
||||||
import { IBaseScreen } from '../definitions';
|
import { IBaseScreen } from '../definitions';
|
||||||
import I18n from '../i18n';
|
import I18n from '../i18n';
|
||||||
import KeyboardView from '../presentation/KeyboardView';
|
import KeyboardView from '../containers/KeyboardView';
|
||||||
import { E2EEnterYourPasswordStackParamList } from '../stacks/types';
|
import { E2EEnterYourPasswordStackParamList } from '../stacks/types';
|
||||||
import { withTheme } from '../theme';
|
import { withTheme } from '../theme';
|
||||||
import { events, logEvent } from '../utils/log';
|
import { events, logEvent } from '../utils/log';
|
||||||
|
|
|
@ -8,7 +8,7 @@ import { BLOCK_CONTEXT } from '@rocket.chat/ui-kit';
|
||||||
import { TSupportedThemes, withTheme } from '../theme';
|
import { TSupportedThemes, withTheme } from '../theme';
|
||||||
import { themes } from '../lib/constants';
|
import { themes } from '../lib/constants';
|
||||||
import TextInput from '../containers/TextInput';
|
import TextInput from '../containers/TextInput';
|
||||||
import KeyboardView from '../presentation/KeyboardView';
|
import KeyboardView from '../containers/KeyboardView';
|
||||||
import RocketChat from '../lib/rocketchat';
|
import RocketChat from '../lib/rocketchat';
|
||||||
import I18n from '../i18n';
|
import I18n from '../i18n';
|
||||||
import { LISTENER } from '../containers/Toast';
|
import { LISTENER } from '../containers/Toast';
|
||||||
|
|
|
@ -10,7 +10,7 @@ import omit from 'lodash/omit';
|
||||||
import { StackNavigationOptions } from '@react-navigation/stack';
|
import { StackNavigationOptions } from '@react-navigation/stack';
|
||||||
|
|
||||||
import Touch from '../../utils/touch';
|
import Touch from '../../utils/touch';
|
||||||
import KeyboardView from '../../presentation/KeyboardView';
|
import KeyboardView from '../../containers/KeyboardView';
|
||||||
import sharedStyles from '../Styles';
|
import sharedStyles from '../Styles';
|
||||||
import scrollPersistTaps from '../../utils/scrollPersistTaps';
|
import scrollPersistTaps from '../../utils/scrollPersistTaps';
|
||||||
import { showConfirmationAlert, showErrorAlert } from '../../utils/info';
|
import { showConfirmationAlert, showErrorAlert } from '../../utils/info';
|
||||||
|
|
|
@ -22,7 +22,7 @@ import I18n from '../../i18n';
|
||||||
import database from '../../lib/database';
|
import database from '../../lib/database';
|
||||||
import { CustomIcon } from '../../lib/Icons';
|
import { CustomIcon } from '../../lib/Icons';
|
||||||
import RocketChat from '../../lib/rocketchat';
|
import RocketChat from '../../lib/rocketchat';
|
||||||
import KeyboardView from '../../presentation/KeyboardView';
|
import KeyboardView from '../../containers/KeyboardView';
|
||||||
import { TSupportedPermissions } from '../../reducers/permissions';
|
import { TSupportedPermissions } from '../../reducers/permissions';
|
||||||
import { ModalStackParamList } from '../../stacks/MasterDetailStack/types';
|
import { ModalStackParamList } from '../../stacks/MasterDetailStack/types';
|
||||||
import { ChatsStackParamList } from '../../stacks/types';
|
import { ChatsStackParamList } from '../../stacks/types';
|
||||||
|
|
|
@ -15,7 +15,7 @@ import TextInput from '../containers/TextInput';
|
||||||
import { IApplicationState } from '../definitions';
|
import { IApplicationState } from '../definitions';
|
||||||
import I18n from '../i18n';
|
import I18n from '../i18n';
|
||||||
import RocketChat from '../lib/rocketchat';
|
import RocketChat from '../lib/rocketchat';
|
||||||
import KeyboardView from '../presentation/KeyboardView';
|
import KeyboardView from '../containers/KeyboardView';
|
||||||
import { getUserSelector } from '../selectors/login';
|
import { getUserSelector } from '../selectors/login';
|
||||||
import { TSupportedThemes, withTheme } from '../theme';
|
import { TSupportedThemes, withTheme } from '../theme';
|
||||||
import { isTablet } from '../utils/deviceInfo';
|
import { isTablet } from '../utils/deviceInfo';
|
||||||
|
|
Loading…
Reference in New Issue