From f282dbb5dc48b07fafe0d38515664cf148ea1a32 Mon Sep 17 00:00:00 2001 From: Calinteodor Date: Fri, 4 Feb 2022 16:58:33 +0200 Subject: [PATCH] feat(dialog) updated LoginDialog --- .../components/native/LoginDialog.js | 84 ++++++++++--------- .../dialog/components/native/InputDialog.js | 13 +-- .../base/dialog/components/native/styles.js | 6 -- 3 files changed, 50 insertions(+), 53 deletions(-) diff --git a/react/features/authentication/components/native/LoginDialog.js b/react/features/authentication/components/native/LoginDialog.js index 4ab7612aa..a11d4639e 100644 --- a/react/features/authentication/components/native/LoginDialog.js +++ b/react/features/authentication/components/native/LoginDialog.js @@ -1,20 +1,15 @@ /* @flow */ import React, { Component } from 'react'; -import { Text, TextInput, View } from 'react-native'; +import { Platform, Text, View } from 'react-native'; +import Dialog from 'react-native-dialog'; import { connect as reduxConnect } from 'react-redux'; import type { Dispatch } from 'redux'; import { ColorSchemeRegistry } from '../../../base/color-scheme'; import { toJid } from '../../../base/connection'; import { connect } from '../../../base/connection/actions.native'; -import { - CustomSubmitDialog, - FIELD_UNDERLINE, - PLACEHOLDER_COLOR, - _abstractMapStateToProps, - inputDialog as inputDialogStyle -} from '../../../base/dialog'; +import { _abstractMapStateToProps } from '../../../base/dialog'; import { translate } from '../../../base/i18n'; import { JitsiConnectionErrors } from '../../../base/lib-jitsi-meet'; import type { StyleType } from '../../../base/styles'; @@ -44,11 +39,6 @@ type Props = { */ _connecting: boolean, - /** - * The color-schemed stylesheet of the base/dialog feature. - */ - _dialogStyles: StyleType, - /** * The error which occurred during login/authentication. */ @@ -150,42 +140,62 @@ class LoginDialog extends Component { render() { const { _connecting: connecting, - _dialogStyles, - _styles: styles, t } = this.props; + let rightKey; + let leftKey; + let rightOnPress; + let leftOnPress; + let rightDisabled; + let leftDisabled; + + if (Platform.OS === 'android') { + rightKey = 'dialog.Ok'; + rightOnPress = () => this._onLogin(); + rightDisabled = connecting; + leftKey = 'dialog.Cancel'; + leftOnPress = () => this._onCancel(); + } else { + rightKey = 'dialog.Cancel'; + rightOnPress = () => this._onCancel(); + leftKey = 'dialog.Ok'; + leftOnPress = () => this._onLogin(); + leftDisabled = connecting; + } return ( - - - + + + { t('dialog.login') } + + - - { this._renderMessage() } - - + + { this._renderMessage() } + + + + + ); } @@ -239,10 +249,8 @@ class LoginDialog extends Component { if (messageKey) { const message = t(messageKey, messageOptions); - const messageStyles = [ - styles.dialogText, - messageIsError ? styles.errorMessage : styles.progressMessage - ]; + const messageStyles + = messageIsError ? styles.errorMessage : styles.progressMessage; return ( diff --git a/react/features/base/dialog/components/native/InputDialog.js b/react/features/base/dialog/components/native/InputDialog.js index 1697f1cdf..0052c0394 100644 --- a/react/features/base/dialog/components/native/InputDialog.js +++ b/react/features/base/dialog/components/native/InputDialog.js @@ -12,7 +12,7 @@ import AbstractDialog, { type State as AbstractState } from '../AbstractDialog'; -import { FIELD_UNDERLINE, inputDialog as styles } from './styles'; +import { inputDialog as styles } from './styles'; type Props = AbstractProps & { @@ -99,13 +99,9 @@ class InputDialog extends AbstractDialog { - { - titleKey && ( - - { t(titleKey) } - - ) - } + + { t(titleKey) } + { descriptionKey && ( @@ -116,7 +112,6 @@ class InputDialog extends AbstractDialog { { diff --git a/react/features/base/dialog/components/native/styles.js b/react/features/base/dialog/components/native/styles.js index 88a196569..331281d0f 100644 --- a/react/features/base/dialog/components/native/styles.js +++ b/react/features/base/dialog/components/native/styles.js @@ -20,8 +20,6 @@ export const MD_FONT_SIZE = 16; export const MD_ITEM_HEIGHT = 48; export const MD_ITEM_MARGIN_PADDING = 16; -export const PLACEHOLDER_COLOR = ColorPalette.lightGrey; - /** * The React {@code Component} styles of {@code BottomSheet}. These have * been implemented as per the Material Design guidelines: @@ -158,10 +156,6 @@ const brandedDialogIconStyle = { }; export const inputDialog = { - bottomField: { - marginBottom: 0 - }, - formMessage: { alignSelf: 'flex-start', fontStyle: 'italic',