Skip to content

Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.

feat(base/ui): Native buttons UI fixes (#13788)

Calinteodora95eaa6c2efe
diff --git a/react/features/base/ui/components/native/Button.tsx b/react/features/base/ui/components/native/Button.tsx
index 327669eda6..1291b21d39 100644
--- a/react/features/base/ui/components/native/Button.tsx
+++ b/react/features/base/ui/components/native/Button.tsx
@@ -1,10 +1,7 @@
import React from 'react';
import { useTranslation } from 'react-i18next';
-import {
- Button as NativePaperButton,
- Text,
- TouchableRipple
-} from 'react-native-paper';
+import { TouchableHighlight } from 'react-native';
+import { Button as NativePaperButton, Text } from 'react-native-paper';
import { BUTTON_MODES, BUTTON_TYPES } from '../../constants.native';
import BaseTheme from '../BaseTheme.native';
@@ -12,13 +9,13 @@ import { IButtonProps } from '../types';
import styles from './buttonStyles';
+
export interface IProps extends IButtonProps {
color?: string | undefined;
contentStyle?: Object | undefined;
labelStyle?: Object | undefined;
mode?: any;
style?: Object | undefined;
- useRippleColor?: boolean;
}
const Button: React.FC<IProps> = ({
@@ -32,16 +29,12 @@ const Button: React.FC<IProps> = ({
mode = BUTTON_MODES.CONTAINED,
onClick: onPress,
style,
- type,
- useRippleColor = true
+ type
}: IProps) => {
const { t } = useTranslation();
const { DESTRUCTIVE, PRIMARY, SECONDARY, TERTIARY } = BUTTON_TYPES;
const { CONTAINED, TEXT } = BUTTON_MODES;
- const rippleColor
- = useRippleColor ? BaseTheme.palette.action03Active : 'transparent';
-
let buttonLabelStyles;
let buttonStyles;
let color;
@@ -72,17 +65,16 @@ const Button: React.FC<IProps> = ({
}
if (type === TERTIARY) {
- if (useRippleColor && disabled) {
+ if (disabled) {
buttonLabelStyles = styles.buttonLabelTertiaryDisabled;
}
buttonLabelStyles = styles.buttonLabelTertiary;
return (
- <TouchableRipple
+ <TouchableHighlight
accessibilityLabel = { accessibilityLabel }
disabled = { disabled }
onPress = { onPress }
- rippleColor = { rippleColor }
style = { [
buttonStyles,
style
@@ -92,7 +84,7 @@ const Button: React.FC<IProps> = ({
buttonLabelStyles,
labelStyle
] }>{ t(labelKey ?? '') }</Text>
- </TouchableRipple>
+ </TouchableHighlight>
);
}
diff --git a/react/features/base/ui/components/native/IconButton.tsx b/react/features/base/ui/components/native/IconButton.tsx
index 9cb2982a7f..c374a26895 100644
--- a/react/features/base/ui/components/native/IconButton.tsx
+++ b/react/features/base/ui/components/native/IconButton.tsx
@@ -1,5 +1,5 @@
import React from 'react';
-import { TouchableRipple } from 'react-native-paper';
+import { TouchableHighlight } from 'react-native';
import Icon from '../../../icons/components/Icon';
import styles from '../../../react/components/native/styles';
@@ -22,47 +22,47 @@ const IconButton: React.FC<IIconButtonProps> = ({
const { PRIMARY, SECONDARY, TERTIARY } = BUTTON_TYPES;
let color;
- let rippleColor;
+ let underlayColor;
let iconButtonContainerStyles;
if (type === PRIMARY) {
color = BaseTheme.palette.icon01;
iconButtonContainerStyles = styles.iconButtonContainerPrimary;
- rippleColor = BaseTheme.palette.action01;
+ underlayColor = BaseTheme.palette.action01;
} else if (type === SECONDARY) {
color = BaseTheme.palette.icon04;
iconButtonContainerStyles = styles.iconButtonContainerSecondary;
- rippleColor = BaseTheme.palette.action02;
+ underlayColor = BaseTheme.palette.action02;
} else if (type === TERTIARY) {
color = iconColor;
iconButtonContainerStyles = styles.iconButtonContainer;
- rippleColor = BaseTheme.palette.action03;
+ underlayColor = BaseTheme.palette.action03;
} else {
color = iconColor;
- rippleColor = tapColor;
+ underlayColor = tapColor;
}
if (disabled) {
color = BaseTheme.palette.icon03;
iconButtonContainerStyles = styles.iconButtonContainerDisabled;
- rippleColor = 'transparent';
+ underlayColor = 'transparent';
}
return (
- <TouchableRipple
+ <TouchableHighlight
accessibilityLabel = { accessibilityLabel }
disabled = { disabled }
onPress = { onPress }
- rippleColor = { rippleColor }
style = { [
iconButtonContainerStyles,
style
- ] }>
+ ] }
+ underlayColor = { underlayColor }>
<Icon
color = { color }
size = { 20 || size }
src = { src } />
- </TouchableRipple>
+ </TouchableHighlight>
);
};
diff --git a/react/features/invite/components/add-people-dialog/native/styles.ts b/react/features/invite/components/add-people-dialog/native/styles.ts
index f1dfc66cfe..c512bddc0b 100644
--- a/react/features/invite/components/add-people-dialog/native/styles.ts
+++ b/react/features/invite/components/add-people-dialog/native/styles.ts
@@ -116,6 +116,6 @@ export default {
},
sendBtn: {
- marginRight: BaseTheme.spacing[2]
+ marginRight: BaseTheme.spacing[3]
}
};
diff --git a/react/features/mobile/navigation/components/HeaderNavigationButton.tsx b/react/features/mobile/navigation/components/HeaderNavigationButton.tsx
index ad4dab2683..c474fbedf6 100644
--- a/react/features/mobile/navigation/components/HeaderNavigationButton.tsx
+++ b/react/features/mobile/navigation/components/HeaderNavigationButton.tsx
@@ -74,7 +74,7 @@ const HeaderNavigationButton = ({ color, disabled, label, onPress, src, style, t
size = { 24 }
src = { src }
style = { [
- navigationStyles.headerNavigationButton,
+ navigationStyles.headerNavigationButtonIcon,
style
] } />
) : (
@@ -87,8 +87,7 @@ const HeaderNavigationButton = ({ color, disabled, label, onPress, src, style, t
btnStyle,
style
] }
- type = { BUTTON_TYPES.TERTIARY }
- useRippleColor = { false } />
+ type = { BUTTON_TYPES.TERTIARY } />
)}
</>
);
diff --git a/react/features/mobile/navigation/components/styles.ts b/react/features/mobile/navigation/components/styles.ts
index f8d83f7cd4..da3f879a17 100644
--- a/react/features/mobile/navigation/components/styles.ts
+++ b/react/features/mobile/navigation/components/styles.ts
@@ -17,6 +17,12 @@ const headerNavigationButtonLabel = {
lineHeight: BaseTheme.spacing[3]
};
+const headerNavigationButton = {
+ borderRadius: BaseTheme.shape.borderRadius,
+ height: BaseTheme.spacing[6],
+ marginLeft: BaseTheme.spacing[3]
+};
+
/**
* Styles of the navigation feature.
*/
@@ -43,7 +49,12 @@ export const navigationStyles = {
},
headerNavigationButton: {
- marginLeft: BaseTheme.spacing[2]
+ ...headerNavigationButton
+ },
+
+ headerNavigationButtonIcon: {
+ ...headerNavigationButton,
+ padding: BaseTheme.spacing[2]
},
headerNavigationButtonDisabled: {
diff --git a/react/features/prejoin/components/native/Prejoin.tsx b/react/features/prejoin/components/native/Prejoin.tsx
index a688d2cb5e..0119717815 100644
--- a/react/features/prejoin/components/native/Prejoin.tsx
+++ b/react/features/prejoin/components/native/Prejoin.tsx
@@ -3,7 +3,6 @@ import React, { useCallback, useEffect, useLayoutEffect, useState } from 'react'
import { useTranslation } from 'react-i18next';
import {
BackHandler,
- Platform,
StyleProp,
Text,
TextStyle,
@@ -19,7 +18,6 @@ import { getConferenceName } from '../../../base/conference/functions';
import { connect } from '../../../base/connection/actions.native';
import { PREJOIN_PAGE_HIDE_DISPLAY_NAME } from '../../../base/flags/constants';
import { getFeatureFlag } from '../../../base/flags/functions';
-import { IconCloseLarge } from '../../../base/icons/svg';
import JitsiScreen from '../../../base/modal/components/JitsiScreen';
import { getLocalParticipant } from '../../../base/participants/functions';
import { getFieldValue } from '../../../base/react/functions';
@@ -30,7 +28,7 @@ import Input from '../../../base/ui/components/native/Input';
import { BUTTON_TYPES } from '../../../base/ui/constants.native';
import BrandingImageBackground from '../../../dynamic-branding/components/native/BrandingImageBackground';
import LargeVideo from '../../../large-video/components/LargeVideo.native';
-import HeaderNavigationButton from '../../../mobile/navigation/components/HeaderNavigationButton';
+import { screenHeaderCloseButton } from '../../../mobile/navigation/functions';
import { navigateRoot } from '../../../mobile/navigation/rootNavigationContainerRef';
import { screen } from '../../../mobile/navigation/routes';
import AudioMuteButton from '../../../toolbox/components/native/AudioMuteButton';
@@ -40,6 +38,7 @@ import { IPrejoinProps } from '../../types';
import { preJoinStyles as styles } from './styles';
+
const Prejoin: React.FC<IPrejoinProps> = ({ navigation }: IPrejoinProps) => {
const dispatch = useDispatch();
const isFocused = useIsFocused();
@@ -83,22 +82,6 @@ const Prejoin: React.FC<IPrejoinProps> = ({ navigation }: IPrejoinProps) => {
return true;
}, [ dispatch ]);
- const headerLeft = () => {
- if (Platform.OS === 'ios') {
- return (
- <HeaderNavigationButton
- label = { t('dialog.close') }
- onPress = { goBack } />
- );
- }
-
- return (
- <HeaderNavigationButton
- onPress = { goBack }
- src = { IconCloseLarge } />
- );
- };
-
const { PRIMARY, TERTIARY } = BUTTON_TYPES;
const joinButtonDisabled = !displayName && isDisplayNameMandatory;
@@ -111,7 +94,7 @@ const Prejoin: React.FC<IPrejoinProps> = ({ navigation }: IPrejoinProps) => {
useLayoutEffect(() => {
navigation.setOptions({
- headerLeft,
+ headerLeft: () => screenHeaderCloseButton(goBack),
headerTitle: t('prejoin.joinMeeting')
});
}, [ navigation ]);
diff --git a/react/features/prejoin/components/native/UnsafeRoomWarning.tsx b/react/features/prejoin/components/native/UnsafeRoomWarning.tsx
index 55d52971c1..dbe7d6d3f1 100644
--- a/react/features/prejoin/components/native/UnsafeRoomWarning.tsx
+++ b/react/features/prejoin/components/native/UnsafeRoomWarning.tsx
@@ -1,25 +1,26 @@
import React, { useCallback, useLayoutEffect } from 'react';
import { useTranslation } from 'react-i18next';
-import { Platform, StyleProp, Text, TextStyle, View, ViewStyle } from 'react-native';
+import { StyleProp, Text, TextStyle, View, ViewStyle } from 'react-native';
import { useDispatch, useSelector } from 'react-redux';
import { appNavigate } from '../../../app/actions.native';
import { IReduxState } from '../../../app/types';
import { getConferenceName } from '../../../base/conference/functions';
import Icon from '../../../base/icons/components/Icon';
-import { IconCloseLarge, IconWarning } from '../../../base/icons/svg';
+import { IconWarning } from '../../../base/icons/svg';
import JitsiScreen from '../../../base/modal/components/JitsiScreen';
import { ASPECT_RATIO_NARROW } from '../../../base/responsive-ui/constants';
import Button from '../../../base/ui/components/native/Button';
import { BUTTON_TYPES } from '../../../base/ui/constants.native';
import getUnsafeRoomText from '../../../base/util/getUnsafeRoomText.native';
-import HeaderNavigationButton from '../../../mobile/navigation/components/HeaderNavigationButton';
+import { screenHeaderCloseButton } from '../../../mobile/navigation/functions';
import { navigateRoot } from '../../../mobile/navigation/rootNavigationContainerRef';
import { screen } from '../../../mobile/navigation/routes';
import { IPrejoinProps } from '../../types';
import { preJoinStyles as styles } from './styles';
+
const UnsafeRoomWarning: React.FC<IPrejoinProps> = ({ navigation }: IPrejoinProps) => {
const dispatch = useDispatch();
const { t } = useTranslation();
@@ -41,25 +42,9 @@ const UnsafeRoomWarning: React.FC<IPrejoinProps> = ({ navigation }: IPrejoinProp
return true;
}, [ dispatch ]);
- const headerLeft = () => {
- if (Platform.OS === 'ios') {
- return (
- <HeaderNavigationButton
- label = { t('dialog.close') }
- onPress = { goBack } />
- );
- }
-
- return (
- <HeaderNavigationButton
- onPress = { goBack }
- src = { IconCloseLarge } />
- );
- };
-
useLayoutEffect(() => {
navigation.setOptions({
- headerLeft,
+ headerLeft: () => screenHeaderCloseButton(goBack),
headerTitle: t('prejoin.joinMeeting')
});
}, [ navigation ]);
diff --git a/react/features/settings/components/native/GeneralSection.tsx b/react/features/settings/components/native/GeneralSection.tsx
index d30380616d..19c0efb6e9 100644
--- a/react/features/settings/components/native/GeneralSection.tsx
+++ b/react/features/settings/components/native/GeneralSection.tsx
@@ -64,17 +64,17 @@ const GeneralSection = () => {
</FormRow>}
<FormRow label = 'settings.language'>
- <TouchableHighlight onPress = { navigateToLanguageSelect }>
- <View style = { styles.languageButton as ViewStyle }>
- <Text
- style = { styles.languageText }>{t(`languages:${language}`)}</Text>
- <View>
+ <View style = { styles.languageButtonContainer as ViewStyle }>
+ <TouchableHighlight onPress = { navigateToLanguageSelect }>
+ <View style = { styles.languageButton as ViewStyle }>
+ <Text
+ style = { styles.languageText }>{t(`languages:${language}`)}</Text>
<Icon
size = { 24 }
src = { IconArrowRight } />
</View>
- </View>
- </TouchableHighlight>
+ </TouchableHighlight>
+ </View>
</FormRow>
</FormSection>
);
diff --git a/react/features/settings/components/native/styles.ts b/react/features/settings/components/native/styles.ts
index a24f83a403..f9b22d3fe1 100644
--- a/react/features/settings/components/native/styles.ts
+++ b/react/features/settings/components/native/styles.ts
@@ -158,9 +158,17 @@ export default {
marginTop: BaseTheme.spacing[2]
},
+ languageButtonContainer: {
+ borderRadius: BaseTheme.shape.borderRadius,
+ overflow: 'hidden'
+ },
+
languageButton: {
+ alignItems: 'center',
display: 'flex',
- flexDirection: 'row'
+ flexDirection: 'row',
+ height: BaseTheme.spacing[7],
+ justifyContent: 'center'
},
languageOption: {
@@ -180,7 +188,7 @@ export default {
languageText: {
...BaseTheme.typography.bodyShortRegularLarge,
color: BaseTheme.palette.text01,
- marginRight: BaseTheme.spacing[3]
+ marginHorizontal: BaseTheme.spacing[2]
},
/**
@@ -227,10 +235,10 @@ export default {
},
logBtn: {
- marginRight: BaseTheme.spacing[2]
+ marginRight: BaseTheme.spacing[3]
},
backBtn: {
- marginLeft: BaseTheme.spacing[2]
+ marginLeft: BaseTheme.spacing[3]
}
};