Chore: Evaluate KeyboardView - TypeScript (#4014)

Co-authored-by: Diego Mello <diegolmello@gmail.com>
This commit is contained in:
Alex Junior 2022-04-13 17:43:56 -03:00 committed by GitHub
parent 99ea5d8e2a
commit ef81796cd3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 32 additions and 36 deletions

View File

@ -4,7 +4,7 @@ import { ScrollView, ScrollViewProps, StyleSheet, View } from 'react-native';
import { themes } from '../lib/constants';
import sharedStyles from '../views/Styles';
import scrollPersistTaps from '../utils/scrollPersistTaps';
import KeyboardView from '../presentation/KeyboardView';
import KeyboardView from './KeyboardView';
import { useTheme } from '../theme';
import StatusBar from './StatusBar';
import AppVersion from './AppVersion';

View File

@ -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;

View File

@ -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>
);
}
}

View File

@ -8,7 +8,7 @@ import TextInput from '../presentation/TextInput';
import Loading from '../containers/Loading';
import { createChannelRequest } from '../actions/createChannel';
import { removeUser } from '../actions/selectedUsers';
import KeyboardView from '../presentation/KeyboardView';
import KeyboardView from '../containers/KeyboardView';
import scrollPersistTaps from '../utils/scrollPersistTaps';
import I18n from '../i18n';
import UserItem from '../containers/UserItem';

View File

@ -4,7 +4,7 @@ import { ScrollView, Switch, Text } from 'react-native';
import { StackNavigationOptions } from '@react-navigation/stack';
import Loading from '../../containers/Loading';
import KeyboardView from '../../presentation/KeyboardView';
import KeyboardView from '../../containers/KeyboardView';
import scrollPersistTaps from '../../utils/scrollPersistTaps';
import I18n from '../../i18n';
import * as HeaderButton from '../../containers/HeaderButton';

View File

@ -12,7 +12,7 @@ import StatusBar from '../containers/StatusBar';
import TextInput from '../containers/TextInput';
import { IBaseScreen } from '../definitions';
import I18n from '../i18n';
import KeyboardView from '../presentation/KeyboardView';
import KeyboardView from '../containers/KeyboardView';
import { E2EEnterYourPasswordStackParamList } from '../stacks/types';
import { withTheme } from '../theme';
import { events, logEvent } from '../utils/log';

View File

@ -8,7 +8,7 @@ import { BLOCK_CONTEXT } from '@rocket.chat/ui-kit';
import { TSupportedThemes, withTheme } from '../theme';
import { themes } from '../lib/constants';
import TextInput from '../containers/TextInput';
import KeyboardView from '../presentation/KeyboardView';
import KeyboardView from '../containers/KeyboardView';
import RocketChat from '../lib/rocketchat';
import I18n from '../i18n';
import { LISTENER } from '../containers/Toast';

View File

@ -10,7 +10,7 @@ import omit from 'lodash/omit';
import { StackNavigationOptions } from '@react-navigation/stack';
import Touch from '../../utils/touch';
import KeyboardView from '../../presentation/KeyboardView';
import KeyboardView from '../../containers/KeyboardView';
import sharedStyles from '../Styles';
import scrollPersistTaps from '../../utils/scrollPersistTaps';
import { showConfirmationAlert, showErrorAlert } from '../../utils/info';

View File

@ -22,7 +22,7 @@ import I18n from '../../i18n';
import database from '../../lib/database';
import { CustomIcon } from '../../lib/Icons';
import RocketChat from '../../lib/rocketchat';
import KeyboardView from '../../presentation/KeyboardView';
import KeyboardView from '../../containers/KeyboardView';
import { TSupportedPermissions } from '../../reducers/permissions';
import { ModalStackParamList } from '../../stacks/MasterDetailStack/types';
import { ChatsStackParamList } from '../../stacks/types';

View File

@ -15,7 +15,7 @@ import TextInput from '../containers/TextInput';
import { IApplicationState } from '../definitions';
import I18n from '../i18n';
import RocketChat from '../lib/rocketchat';
import KeyboardView from '../presentation/KeyboardView';
import KeyboardView from '../containers/KeyboardView';
import { getUserSelector } from '../selectors/login';
import { TSupportedThemes, withTheme } from '../theme';
import { isTablet } from '../utils/deviceInfo';