From 4a84e47cfa069037d9a7e2a44b4a0f99379052bd Mon Sep 17 00:00:00 2001 From: Alex Junior Date: Wed, 18 May 2022 16:17:42 -0300 Subject: [PATCH] Chore: Evaluate TextInput component (#4181) * changing from `containers/TextInput` to `containers/TexInput/FormTextInput` * changing from `presentation/TextInput` to `containers/TexInput/index` * update storybook * update status view after merge with develop * removing `app/containers/__snapshots__/TextInput.stories.storyshot` in favor from `app/containers/TextInput/__snapshots` --- app/containers/MessageBox/index.tsx | 2 +- app/containers/SearchBox.tsx | 2 +- app/containers/SearchHeader.tsx | 2 +- .../FormTextInput.tsx} | 14 +++++++------- .../{ => TextInput}/TextInput.stories.js | 6 +++--- .../__snapshots__/TextInput.stories.storyshot | 0 .../TextInput/index.tsx} | 6 +++--- app/containers/TwoFactor/index.tsx | 4 ++-- app/containers/UIKit/MultiSelect/index.tsx | 4 ++-- app/containers/UIKit/index.tsx | 4 ++-- app/views/CreateChannelView.tsx | 2 +- app/views/CreateDiscussionView/index.tsx | 4 ++-- app/views/E2EEncryptionSecurityView.tsx | 4 ++-- app/views/E2EEnterYourPasswordView.tsx | 4 ++-- app/views/ForgotPasswordView.tsx | 4 ++-- app/views/InviteUsersView/index.tsx | 4 ++-- app/views/LivechatEditView.tsx | 14 +++++++------- app/views/LoginView.tsx | 6 +++--- app/views/NewServerView/ServerInput/index.tsx | 4 ++-- app/views/ProfileView/index.tsx | 16 ++++++++-------- app/views/RegisterView.tsx | 14 +++++++------- app/views/RoomInfoEditView/index.tsx | 12 ++++++------ app/views/RoomView/JoinCode.tsx | 4 ++-- app/views/RoomsListView/Header/Header.tsx | 2 +- app/views/SearchMessagesView/index.tsx | 4 ++-- app/views/SendEmailConfirmationView.tsx | 4 ++-- app/views/SetUsernameView.tsx | 4 ++-- app/views/ShareListView/Header/Header.tsx | 2 +- app/views/ShareView/index.tsx | 4 ++-- app/views/StatusView/index.tsx | 4 ++-- storybook/stories/index.js | 2 +- 31 files changed, 81 insertions(+), 81 deletions(-) rename app/containers/{TextInput.tsx => TextInput/FormTextInput.tsx} (91%) rename app/containers/{ => TextInput}/TextInput.stories.js (72%) rename app/containers/{ => TextInput}/__snapshots__/TextInput.stories.storyshot (100%) rename app/{presentation/TextInput.tsx => containers/TextInput/index.tsx} (83%) diff --git a/app/containers/MessageBox/index.tsx b/app/containers/MessageBox/index.tsx index d8d6a8133..b8afdacb6 100644 --- a/app/containers/MessageBox/index.tsx +++ b/app/containers/MessageBox/index.tsx @@ -9,7 +9,7 @@ import { Q } from '@nozbe/watermelondb'; import { TouchableWithoutFeedback } from 'react-native-gesture-handler'; import { generateTriggerId } from '../../lib/methods/actions'; -import TextInput, { IThemedTextInput } from '../../presentation/TextInput'; +import TextInput, { IThemedTextInput } from '../TextInput'; import { userTyping as userTypingAction } from '../../actions/room'; import styles from './styles'; import database from '../../lib/database'; diff --git a/app/containers/SearchBox.tsx b/app/containers/SearchBox.tsx index 75174e474..34432f5d7 100644 --- a/app/containers/SearchBox.tsx +++ b/app/containers/SearchBox.tsx @@ -5,7 +5,7 @@ import Touchable from 'react-native-platform-touchable'; import { themes } from '../lib/constants'; import I18n from '../i18n'; import { CustomIcon } from './CustomIcon'; -import TextInput from '../presentation/TextInput'; +import TextInput from './TextInput'; import { useTheme } from '../theme'; import { isIOS } from '../utils/deviceInfo'; import sharedStyles from '../views/Styles'; diff --git a/app/containers/SearchHeader.tsx b/app/containers/SearchHeader.tsx index 589ef1d2b..6b5e31fc1 100644 --- a/app/containers/SearchHeader.tsx +++ b/app/containers/SearchHeader.tsx @@ -5,7 +5,7 @@ import I18n from '../i18n'; import { useTheme } from '../theme'; import sharedStyles from '../views/Styles'; import { themes } from '../lib/constants'; -import TextInput from '../presentation/TextInput'; +import TextInput from './TextInput'; import { isIOS, isTablet } from '../utils/deviceInfo'; import { useOrientation } from '../dimensions'; diff --git a/app/containers/TextInput.tsx b/app/containers/TextInput/FormTextInput.tsx similarity index 91% rename from app/containers/TextInput.tsx rename to app/containers/TextInput/FormTextInput.tsx index 5f6471e2e..f013b9f09 100644 --- a/app/containers/TextInput.tsx +++ b/app/containers/TextInput/FormTextInput.tsx @@ -2,12 +2,12 @@ import React from 'react'; import { StyleProp, StyleSheet, Text, TextInputProps, TextInput as RNTextInput, TextStyle, View, ViewStyle } from 'react-native'; import Touchable from 'react-native-platform-touchable'; -import sharedStyles from '../views/Styles'; -import TextInput from '../presentation/TextInput'; -import { themes } from '../lib/constants'; -import { CustomIcon, TIconsName } from './CustomIcon'; -import ActivityIndicator from './ActivityIndicator'; -import { TSupportedThemes } from '../theme'; +import sharedStyles from '../../views/Styles'; +import TextInput from './index'; +import { themes } from '../../lib/constants'; +import { CustomIcon, TIconsName } from '../CustomIcon'; +import ActivityIndicator from '../ActivityIndicator'; +import { TSupportedThemes } from '../../theme'; const styles = StyleSheet.create({ error: { @@ -70,7 +70,7 @@ interface IRCTextInputState { showPassword: boolean; } -export default class RCTextInput extends React.PureComponent { +export default class FormTextInput extends React.PureComponent { static defaultProps = { error: {}, theme: 'light' diff --git a/app/containers/TextInput.stories.js b/app/containers/TextInput/TextInput.stories.js similarity index 72% rename from app/containers/TextInput.stories.js rename to app/containers/TextInput/TextInput.stories.js index d0e6c6044..c4a985136 100644 --- a/app/containers/TextInput.stories.js +++ b/app/containers/TextInput/TextInput.stories.js @@ -3,7 +3,7 @@ import React from 'react'; import { storiesOf } from '@storybook/react-native'; import { View, StyleSheet } from 'react-native'; -import TextInput from './TextInput'; +import FormTextInput from './FormTextInput'; const styles = StyleSheet.create({ paddingHorizontal: { @@ -23,9 +23,9 @@ const theme = 'light'; stories.add('Short and Long Text', () => ( <> - + - + )); diff --git a/app/containers/__snapshots__/TextInput.stories.storyshot b/app/containers/TextInput/__snapshots__/TextInput.stories.storyshot similarity index 100% rename from app/containers/__snapshots__/TextInput.stories.storyshot rename to app/containers/TextInput/__snapshots__/TextInput.stories.storyshot diff --git a/app/presentation/TextInput.tsx b/app/containers/TextInput/index.tsx similarity index 83% rename from app/presentation/TextInput.tsx rename to app/containers/TextInput/index.tsx index 8c2a16cdd..449ea2d5e 100644 --- a/app/presentation/TextInput.tsx +++ b/app/containers/TextInput/index.tsx @@ -1,9 +1,9 @@ import React from 'react'; import { I18nManager, StyleProp, StyleSheet, TextInput, TextStyle } from 'react-native'; -import { IRCTextInputProps } from '../containers/TextInput'; -import { themes } from '../lib/constants'; -import { TSupportedThemes } from '../theme'; +import { IRCTextInputProps } from './FormTextInput'; +import { themes } from '../../lib/constants'; +import { TSupportedThemes } from '../../theme'; const styles = StyleSheet.create({ input: { diff --git a/app/containers/TwoFactor/index.tsx b/app/containers/TwoFactor/index.tsx index a83af6c26..31f68c2e5 100644 --- a/app/containers/TwoFactor/index.tsx +++ b/app/containers/TwoFactor/index.tsx @@ -6,7 +6,7 @@ import Modal from 'react-native-modal'; import useDeepCompareEffect from 'use-deep-compare-effect'; import { connect } from 'react-redux'; -import TextInput from '../TextInput'; +import FormTextInput from '../TextInput/FormTextInput'; import I18n from '../../i18n'; import EventEmitter from '../../utils/events'; import { useTheme } from '../../theme'; @@ -114,7 +114,7 @@ const TwoFactor = React.memo(({ isMasterDetail }: { isMasterDetail: boolean }) = ]}> {I18n.t(method?.title || 'Two_Factor_Authentication')} {method?.text ? {I18n.t(method.text)} : null} - InteractionManager.runAfterInteractions(() => e?.getNativeRef()?.focus())} diff --git a/app/containers/UIKit/MultiSelect/index.tsx b/app/containers/UIKit/MultiSelect/index.tsx index ef4b1fb87..61f917349 100644 --- a/app/containers/UIKit/MultiSelect/index.tsx +++ b/app/containers/UIKit/MultiSelect/index.tsx @@ -13,7 +13,7 @@ import { import { BLOCK_CONTEXT } from '@rocket.chat/ui-kit'; import Button from '../../Button'; -import TextInput from '../../TextInput'; +import FormTextInput from '../../TextInput/FormTextInput'; import { textParser } from '../utils'; import { themes } from '../../../lib/constants'; import I18n from '../../../i18n'; @@ -139,7 +139,7 @@ export const MultiSelect = React.memo( return ( - - {I18n.t('E2E_encryption_change_password_description')} - - { this.passwordInput = e; }} diff --git a/app/views/ForgotPasswordView.tsx b/app/views/ForgotPasswordView.tsx index 5ab4775e4..6c99cd724 100644 --- a/app/views/ForgotPasswordView.tsx +++ b/app/views/ForgotPasswordView.tsx @@ -3,7 +3,7 @@ import { Text } from 'react-native'; import Button from '../containers/Button'; import FormContainer, { FormContainerInner } from '../containers/FormContainer'; -import TextInput from '../containers/TextInput'; +import FormTextInput from '../containers/TextInput/FormTextInput'; import I18n from '../i18n'; import { themes } from '../lib/constants'; import { Services } from '../lib/services'; @@ -92,7 +92,7 @@ class ForgotPasswordView extends React.Component {I18n.t('Forgot_password')} - - + {renderExpiration()}