From 0251201e93492ef852d8f0ba3a4f71a0ed643835 Mon Sep 17 00:00:00 2001 From: Calin-Teodor Date: Mon, 23 Jan 2023 17:58:11 +0200 Subject: [PATCH] feat(settings/native): changed FormSectionAccordion.js to FormSection.tsx --- .../components/native/FormSection.tsx | 46 ++++++++++ .../components/native/FormSectionAccordion.js | 84 ------------------- .../components/native/SettingsView.tsx | 28 ++++--- .../settings/components/native/styles.js | 13 +-- 4 files changed, 67 insertions(+), 104 deletions(-) create mode 100644 react/features/settings/components/native/FormSection.tsx delete mode 100644 react/features/settings/components/native/FormSectionAccordion.js diff --git a/react/features/settings/components/native/FormSection.tsx b/react/features/settings/components/native/FormSection.tsx new file mode 100644 index 000000000..66e361d8e --- /dev/null +++ b/react/features/settings/components/native/FormSection.tsx @@ -0,0 +1,46 @@ +import React, { ReactChildren } from 'react'; +import { WithTranslation } from 'react-i18next'; +import { Text, View } from 'react-native'; + +import { translate } from '../../../base/i18n/functions'; + +// @ts-ignore +import styles from './styles'; + + +/** + * The type of the React {@code Component} props of {@link FormSection}. + */ +interface IProps extends WithTranslation { + + /** + * The children to be displayed within this Link. + */ + children: ReactChildren; + + /** + * The i18n key of the text label of the section. + */ + label: string; +} + +/** + * Section accordion on settings form. + * + * @returns {React$Element} + */ +function FormSection({ children, label, t }: IProps) { + return ( + + + + { t(label) } + + + { children } + + ); +} + +export default translate(FormSection); diff --git a/react/features/settings/components/native/FormSectionAccordion.js b/react/features/settings/components/native/FormSectionAccordion.js deleted file mode 100644 index cdb628a41..000000000 --- a/react/features/settings/components/native/FormSectionAccordion.js +++ /dev/null @@ -1,84 +0,0 @@ -// @flow - -import React, { useCallback, useState } from 'react'; -import { List } from 'react-native-paper'; - -import { translate } from '../../../base/i18n'; -import { Icon, IconArrowDown, IconArrowUp } from '../../../base/icons'; - -import styles from './styles'; - -/** - * The type of the React {@code Component} props of {@link FormSectionAccordion}. - */ -type Props = { - - /** - * Is the section an accordion or not. - */ - accordion: boolean, - - /** - * The children to be displayed within this Link. - */ - children: React$Node, - - /** - * Whether the accordion is expandable. - */ - expandable: boolean, - - /** - * The i18n key of the text label of the section. - */ - label: string, - - /** - * An external style object passed to the component. - */ - style: Object, - - /** - * Invoked to obtain translated strings. - */ - t: Function -} - -/** - * Section accordion on settings form. - * - * @returns {React$Element} - */ -function FormSectionAccordion({ accordion, children, expandable, label, style, t }: Props) { - const [ expandSection, setExpandSection ] = useState(false); - const onPress = useCallback(() => { - setExpandSection(!expandSection); - }); - - return ( - - accordion && } - style = { [ - styles.formSectionTitle, - style - ] } - theme = {{ - colors: { - background: 'transparent' - } - }} - title = { t(label) } - titleStyle = { styles.formSectionTitleText }> - { children } - - ); -} - -export default translate(FormSectionAccordion); diff --git a/react/features/settings/components/native/SettingsView.tsx b/react/features/settings/components/native/SettingsView.tsx index b56531dcf..b11c3a399 100644 --- a/react/features/settings/components/native/SettingsView.tsx +++ b/react/features/settings/components/native/SettingsView.tsx @@ -37,7 +37,7 @@ import { isServerURLChangeEnabled, normalizeUserInputURL } from '../../functions // @ts-ignore import FormRow from './FormRow'; // @ts-ignore -import FormSectionAccordion from './FormSectionAccordion'; +import FormSection from './FormSection'; // @ts-ignore import styles from './styles'; @@ -305,7 +305,8 @@ class SettingsView extends Component { participantId = { this.props._localParticipantId } size = { AVATAR_SIZE } /> - { placeholder = { t('settingsView.emailPlaceholderText') } textContentType = { 'emailAddress' } // iOS only value = { email } /> - - + {/* @ts-ignore */} + { // @ts-ignore onChange = { this._onDisableSelfView } /> - - + {/* @ts-ignore */} +