@aws-amplify/ui-react-native 1.1.3 → 1.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/dist/Authenticator/common/DefaultContent/DefaultContent.js +1 -1
- package/dist/Authenticator/common/DefaultContent/styles.js +2 -1
- package/dist/Authenticator/common/DefaultContent/types.d.ts +2 -1
- package/dist/Authenticator/common/FederatedProviderButton/FederatedProviderButton.js +8 -7
- package/dist/hooks/index.d.ts +1 -0
- package/dist/hooks/index.js +1 -0
- package/dist/hooks/usePressableContainerStyles/index.d.ts +1 -0
- package/dist/hooks/usePressableContainerStyles/index.js +1 -0
- package/dist/hooks/usePressableContainerStyles/usePressableContainerStyles.d.ts +19 -0
- package/dist/hooks/usePressableContainerStyles/usePressableContainerStyles.js +14 -0
- package/dist/primitives/Button/Button.js +13 -12
- package/dist/primitives/ErrorMessage/ErrorMessage.d.ts +1 -1
- package/dist/primitives/ErrorMessage/ErrorMessage.js +2 -2
- package/dist/primitives/ErrorMessage/styles.js +4 -2
- package/dist/primitives/ErrorMessage/types.d.ts +2 -0
- package/dist/primitives/IconButton/IconButton.js +12 -11
- package/dist/primitives/Radio/Radio.js +12 -10
- package/dist/primitives/Radio/styles.js +4 -0
- package/dist/primitives/Radio/types.d.ts +1 -0
- package/dist/primitives/Tabs/Tab.js +13 -13
- package/dist/primitives/Tabs/styles.js +4 -0
- package/dist/primitives/Tabs/types.d.ts +1 -0
- package/package.json +3 -3
- package/src/Authenticator/Defaults/ConfirmResetPassword/__tests__/__snapshots__/ConfirmResetPassword.spec.tsx.snap +24 -37
- package/src/Authenticator/Defaults/ConfirmSignIn/__tests__/__snapshots__/ConfirmSignIn.spec.tsx.snap +16 -23
- package/src/Authenticator/Defaults/ConfirmSignUp/__tests__/__snapshots__/ConfirmSignUp.spec.tsx.snap +25 -41
- package/src/Authenticator/Defaults/ConfirmVerifyUser/__tests__/__snapshots__/ConfirmVerifyUser.spec.tsx.snap +19 -32
- package/src/Authenticator/Defaults/ForceNewPassword/__tests__/__snapshots__/ForceNewPassword.spec.tsx.snap +22 -38
- package/src/Authenticator/Defaults/ResetPassword/__tests__/__snapshots__/ResetPassword.spec.tsx.snap +16 -23
- package/src/Authenticator/Defaults/SetupTOTP/__tests__/__snapshots__/SetupTOTP.spec.tsx.snap +16 -23
- package/src/Authenticator/Defaults/SignIn/__tests__/__snapshots__/SignIn.spec.tsx.snap +24 -44
- package/src/Authenticator/Defaults/SignUp/__tests__/__snapshots__/SignUp.spec.tsx.snap +34 -67
- package/src/Authenticator/Defaults/VerifyUser/__tests__/__snapshots__/VerifyUser.spec.tsx.snap +20 -23
- package/src/Authenticator/common/DefaultContainer/__tests__/__snapshots__/DefaultContainer.spec.tsx.snap +3 -6
- package/src/Authenticator/common/DefaultContent/DefaultContent.tsx +2 -1
- package/src/Authenticator/common/DefaultContent/styles.ts +2 -1
- package/src/Authenticator/common/DefaultContent/types.ts +2 -1
- package/src/Authenticator/common/DefaultFooter/__tests__/__snapshots__/DefaultFooter.spec.tsx.snap +3 -6
- package/src/Authenticator/common/FederatedProviderButton/FederatedProviderButton.tsx +8 -12
- package/src/Authenticator/common/FederatedProviderButton/__tests__/FederatedProviderButton.spec.tsx +34 -3
- package/src/Authenticator/common/FederatedProviderButton/__tests__/__snapshots__/FederatedProviderButton.spec.tsx.snap +94 -3
- package/src/Authenticator/common/FederatedProviderButtons/__tests__/__snapshots__/FederatedProviderButtons.spec.tsx.snap +4 -6
- package/src/InAppMessaging/components/BannerMessage/__tests__/__snapshots__/BannerMessage.spec.tsx.snap +2 -4
- package/src/InAppMessaging/components/ModalMessage/__tests__/ModalMessage.spec.tsx +1 -1
- package/src/InAppMessaging/components/ModalMessage/__tests__/__snapshots__/ModalMessage.spec.tsx.snap +3 -6
- package/src/hooks/index.ts +1 -0
- package/src/hooks/usePressableContainerStyles/__tests__/usePressableContainerStyles.spec.ts +68 -0
- package/src/hooks/usePressableContainerStyles/index.ts +1 -0
- package/src/hooks/usePressableContainerStyles/usePressableContainerStyles.ts +51 -0
- package/src/primitives/Button/Button.tsx +16 -23
- package/src/primitives/Button/__tests__/__snapshots__/Button.spec.tsx.snap +9 -18
- package/src/primitives/ErrorMessage/ErrorMessage.tsx +6 -1
- package/src/primitives/ErrorMessage/__tests__/__snapshots__/ErrorMessage.spec.tsx.snap +18 -8
- package/src/primitives/ErrorMessage/styles.ts +4 -2
- package/src/primitives/ErrorMessage/types.ts +3 -0
- package/src/primitives/IconButton/IconButton.tsx +16 -19
- package/src/primitives/IconButton/__tests__/IconButton.spec.tsx +6 -6
- package/src/primitives/IconButton/__tests__/__snapshots__/IconButton.spec.tsx.snap +4 -8
- package/src/primitives/PasswordField/__tests__/__snapshots__/PasswordField.spec.tsx.snap +4 -8
- package/src/primitives/Radio/Radio.tsx +15 -16
- package/src/primitives/Radio/__tests__/Radio.spec.tsx +1 -0
- package/src/primitives/Radio/__tests__/__snapshots__/Radio.spec.tsx.snap +9 -0
- package/src/primitives/Radio/styles.ts +4 -0
- package/src/primitives/Radio/types.ts +1 -0
- package/src/primitives/RadioGroup/__tests__/__snapshots__/RadioGroup.spec.tsx.snap +24 -0
- package/src/primitives/Tabs/Tab.tsx +17 -18
- package/src/primitives/Tabs/__tests__/Tab.spec.tsx +20 -13
- package/src/primitives/Tabs/__tests__/__snapshots__/Tab.spec.tsx.snap +23 -43
- package/src/primitives/Tabs/__tests__/__snapshots__/Tabs.spec.tsx.snap +14 -26
- package/src/primitives/Tabs/styles.ts +4 -0
- package/src/primitives/Tabs/types.ts +1 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @aws-amplify/ui-react-native
|
|
2
2
|
|
|
3
|
+
## 1.1.4
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#3164](https://github.com/aws-amplify/amplify-ui/pull/3164) [`7f99d8b1a`](https://github.com/aws-amplify/amplify-ui/commit/7f99d8b1a16b23c180c42a11a9bc992b5c4f2861) Thanks [@calebpollman](https://github.com/calebpollman)! - fix(ui-react-native): update ErrorMessage style
|
|
8
|
+
|
|
9
|
+
- [#2921](https://github.com/aws-amplify/amplify-ui/pull/2921) [`2d0799002`](https://github.com/aws-amplify/amplify-ui/commit/2d0799002dbfa843a1720c2384eadba942333f76) Thanks [@ioanabrooks](https://github.com/ioanabrooks)! - chore(ui-react-native): Add utility hook for pressable styles
|
|
10
|
+
|
|
11
|
+
- Updated dependencies [[`c31a9bf69`](https://github.com/aws-amplify/amplify-ui/commit/c31a9bf693b3507e8a2b9d0790423a9f64e533cf), [`1847840c0`](https://github.com/aws-amplify/amplify-ui/commit/1847840c00c0f9f7be31e9735c31bd596f4056e9)]:
|
|
12
|
+
- @aws-amplify/ui@5.3.1
|
|
13
|
+
- @aws-amplify/ui-react-core@2.1.4
|
|
14
|
+
|
|
3
15
|
## 1.1.3
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
|
@@ -18,7 +18,7 @@ export default function DefaultContent({ body, buttons: { primary, links, second
|
|
|
18
18
|
<Header style={themedStyles.header}>{headerText}</Header>
|
|
19
19
|
{body ? (typeof body === 'string' ? (<Label style={themedStyles.body}>{body}</Label>) : (body)) : null}
|
|
20
20
|
<FormFields fieldContainerStyle={themedStyles.fieldContainer} fieldErrorsContainer={themedStyles.fieldErrorsContainer} fieldErrorStyle={themedStyles.fieldError} fieldLabelStyle={themedStyles.fieldLabel} fieldStyle={themedStyles.fieldStyle} fields={fields} isPending={isPending} validationErrors={validationErrors} style={themedStyles.formFields}/>
|
|
21
|
-
{error ? (<ErrorMessage
|
|
21
|
+
{error ? (<ErrorMessage iconStyle={themedStyles.errorMessageIcon} labelStyle={themedStyles.errorMessageLabel} style={themedStyles.errorMessage}>
|
|
22
22
|
{error}
|
|
23
23
|
</ErrorMessage>) : null}
|
|
24
24
|
<Button {...primary} variant="primary" textStyle={themedStyles.buttonPrimaryLabel} style={themedStyles.buttonPrimary}/>
|
|
@@ -14,8 +14,9 @@ export const getDefaultStyle = ({ tokens: { colors, fontSizes, space }, }) => St
|
|
|
14
14
|
},
|
|
15
15
|
buttonSecondaryLabel: {},
|
|
16
16
|
errorMessage: {
|
|
17
|
-
|
|
17
|
+
marginHorizontal: space.small,
|
|
18
18
|
},
|
|
19
|
+
errorMessageIcon: {},
|
|
19
20
|
errorMessageLabel: {},
|
|
20
21
|
fieldContainer: {
|
|
21
22
|
paddingHorizontal: space.small,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { StyleProp, TextStyle, ViewStyle } from 'react-native';
|
|
2
|
+
import { ImageStyle, StyleProp, TextStyle, ViewStyle } from 'react-native';
|
|
3
3
|
import { AuthenticatorComponentDefaultProps, AuthenticatorHeaderComponent, AuthenticatorFooterComponent, AuthenticatorMachineContext, AuthenticatorRouteComponentName } from '@aws-amplify/ui-react-core';
|
|
4
4
|
import { ButtonProps } from '../../../primitives';
|
|
5
5
|
import { DefaultFormFieldsComponent, DefaultFormFieldsStyle } from '../../common';
|
|
@@ -11,6 +11,7 @@ export interface DefaultContentStyle {
|
|
|
11
11
|
buttonSecondary?: ViewStyle;
|
|
12
12
|
buttonSecondaryLabel?: TextStyle;
|
|
13
13
|
errorMessage?: ViewStyle;
|
|
14
|
+
errorMessageIcon?: ImageStyle;
|
|
14
15
|
errorMessageLabel?: TextStyle;
|
|
15
16
|
fieldErrorsContainer?: ViewStyle;
|
|
16
17
|
fieldContainer?: ViewStyle;
|
|
@@ -1,13 +1,14 @@
|
|
|
1
|
-
import React
|
|
1
|
+
import React from 'react';
|
|
2
2
|
import { Button, Icon, Label } from '../../../primitives';
|
|
3
|
+
import { usePressableContainerStyles } from '../../../hooks';
|
|
3
4
|
import { styles } from './styles';
|
|
4
5
|
export default function FederatedProviderButton({ children, source, style, textStyle, ...rest }) {
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
}
|
|
9
|
-
return (<Button {...rest} style={
|
|
10
|
-
|
|
6
|
+
const pressableStyle = usePressableContainerStyles({
|
|
7
|
+
containerStyle: styles.container,
|
|
8
|
+
overrideStyle: style,
|
|
9
|
+
});
|
|
10
|
+
return (<Button {...rest} style={pressableStyle}>
|
|
11
|
+
<Icon source={source} style={styles.icon} size={20}/>
|
|
11
12
|
<Label style={[styles.label, textStyle]}>{children}</Label>
|
|
12
13
|
</Button>);
|
|
13
14
|
}
|
package/dist/hooks/index.d.ts
CHANGED
package/dist/hooks/index.js
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { usePressableContainerStyles } from './usePressableContainerStyles';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { usePressableContainerStyles } from './usePressableContainerStyles';
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { PressableProps, PressableStateCallbackType, StyleProp, ViewStyle } from 'react-native';
|
|
2
|
+
export interface UsePressableContainerStyleProps {
|
|
3
|
+
/**
|
|
4
|
+
* @description
|
|
5
|
+
* Either view styles or a function representing override styles for the pressed state
|
|
6
|
+
*/
|
|
7
|
+
overrideStyle: PressableProps['style'];
|
|
8
|
+
/**
|
|
9
|
+
* @description
|
|
10
|
+
* Pass-through view styles, typically includes theme, disabled, variant styles
|
|
11
|
+
*/
|
|
12
|
+
containerStyle?: StyleProp<ViewStyle>;
|
|
13
|
+
/**
|
|
14
|
+
* @description
|
|
15
|
+
* Pass-through view styles for the pressed state applied before the override styles
|
|
16
|
+
*/
|
|
17
|
+
pressedStyle?: StyleProp<ViewStyle>;
|
|
18
|
+
}
|
|
19
|
+
export declare const usePressableContainerStyles: ({ overrideStyle, containerStyle, pressedStyle, }: UsePressableContainerStyleProps) => ({ pressed, }: PressableStateCallbackType) => StyleProp<ViewStyle>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { useCallback } from 'react';
|
|
2
|
+
export const usePressableContainerStyles = ({ overrideStyle, containerStyle, pressedStyle, }) => {
|
|
3
|
+
return useCallback(({ pressed }) => {
|
|
4
|
+
const pressedOverrideStyle = typeof overrideStyle === 'function'
|
|
5
|
+
? overrideStyle({ pressed })
|
|
6
|
+
: overrideStyle;
|
|
7
|
+
return [
|
|
8
|
+
containerStyle,
|
|
9
|
+
pressed ? pressedStyle : undefined,
|
|
10
|
+
// include last to override other styles
|
|
11
|
+
pressedOverrideStyle,
|
|
12
|
+
];
|
|
13
|
+
}, [containerStyle, overrideStyle, pressedStyle]);
|
|
14
|
+
};
|
|
@@ -1,21 +1,22 @@
|
|
|
1
|
-
import React, {
|
|
2
|
-
import { Pressable, Text
|
|
1
|
+
import React, { useMemo } from 'react';
|
|
2
|
+
import { Pressable, Text } from 'react-native';
|
|
3
|
+
import { usePressableContainerStyles } from '../../hooks';
|
|
3
4
|
import { useTheme } from '../../theme';
|
|
4
5
|
import { capitalize } from '../../utils';
|
|
5
6
|
import { getThemedStyles } from './styles';
|
|
6
7
|
export default function Button({ accessibilityRole = 'button', children, disabled, style, textStyle, variant = 'default', ...rest }) {
|
|
7
8
|
const theme = useTheme();
|
|
8
9
|
const themedStyle = getThemedStyles(theme);
|
|
9
|
-
const
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
}
|
|
10
|
+
const containerStyle = useMemo(() => ({
|
|
11
|
+
...themedStyle.container,
|
|
12
|
+
...themedStyle[`container${capitalize(variant)}`],
|
|
13
|
+
...(disabled && themedStyle.disabled),
|
|
14
|
+
}), [disabled, themedStyle, variant]);
|
|
15
|
+
const pressableStyle = usePressableContainerStyles({
|
|
16
|
+
overrideStyle: style,
|
|
17
|
+
containerStyle,
|
|
18
|
+
pressedStyle: themedStyle.pressed,
|
|
19
|
+
});
|
|
19
20
|
const buttonTextStyle = useMemo(() => ({
|
|
20
21
|
...themedStyle.text,
|
|
21
22
|
...themedStyle[`text${capitalize(variant)}`],
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { ErrorMessageProps } from './types';
|
|
3
3
|
export declare const CLOSE_BUTTON_TEST_ID = "authenticator--error-message--close-button";
|
|
4
|
-
export default function ErrorMessage({ children, labelStyle, onDismiss, style, ...rest }: ErrorMessageProps): JSX.Element;
|
|
4
|
+
export default function ErrorMessage({ children, iconStyle, labelStyle, onDismiss, style, ...rest }: ErrorMessageProps): JSX.Element;
|
|
@@ -6,11 +6,11 @@ import { IconButton } from '../IconButton';
|
|
|
6
6
|
import { useTheme } from '../../theme';
|
|
7
7
|
import { getThemedStyles } from './styles';
|
|
8
8
|
export const CLOSE_BUTTON_TEST_ID = 'authenticator--error-message--close-button';
|
|
9
|
-
export default function ErrorMessage({ children, labelStyle, onDismiss, style, ...rest }) {
|
|
9
|
+
export default function ErrorMessage({ children, iconStyle, labelStyle, onDismiss, style, ...rest }) {
|
|
10
10
|
const theme = useTheme();
|
|
11
11
|
const themedStyle = getThemedStyles(theme);
|
|
12
12
|
return (<View {...rest} accessibilityRole="alert" style={[themedStyle.container, style]}>
|
|
13
|
-
<Icon size={20} source={icons.error} style={themedStyle.icon}/>
|
|
13
|
+
<Icon size={20} source={icons.error} style={[themedStyle.icon, iconStyle]}/>
|
|
14
14
|
<Text style={[themedStyle.label, labelStyle]}>{children}</Text>
|
|
15
15
|
{onDismiss ? (<IconButton onPress={onDismiss} size={20} source={icons.close} style={themedStyle.icon} testID={CLOSE_BUTTON_TEST_ID}/>) : null}
|
|
16
16
|
</View>);
|
|
@@ -1,22 +1,24 @@
|
|
|
1
1
|
import { StyleSheet } from 'react-native';
|
|
2
2
|
export const getThemedStyles = (theme) => {
|
|
3
|
-
const { tokens: { colors, space }, components, } = theme;
|
|
3
|
+
const { tokens: { colors, fontSizes, space }, components, } = theme;
|
|
4
4
|
return StyleSheet.create({
|
|
5
5
|
container: {
|
|
6
6
|
alignItems: 'center',
|
|
7
7
|
backgroundColor: colors.background.error,
|
|
8
8
|
flexDirection: 'row',
|
|
9
9
|
paddingHorizontal: space.xs,
|
|
10
|
-
paddingVertical: space.
|
|
10
|
+
paddingVertical: space.small,
|
|
11
11
|
...components?.errorMessage?.container,
|
|
12
12
|
},
|
|
13
13
|
icon: {
|
|
14
14
|
margin: space.xs,
|
|
15
|
+
tintColor: colors.font.error,
|
|
15
16
|
...components?.errorMessage?.icon,
|
|
16
17
|
},
|
|
17
18
|
label: {
|
|
18
19
|
color: colors.font.error,
|
|
19
20
|
flex: 1,
|
|
21
|
+
fontSize: fontSizes.medium,
|
|
20
22
|
paddingHorizontal: space.xs,
|
|
21
23
|
...components?.errorMessage?.label,
|
|
22
24
|
},
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { ImageStyle, StyleProp, TextStyle, ViewProps, ViewStyle } from 'react-native';
|
|
2
|
+
import { IconProps } from '../Icon';
|
|
2
3
|
export interface ErrorMessageProps extends ViewProps {
|
|
4
|
+
iconStyle?: IconProps['style'];
|
|
3
5
|
labelStyle?: StyleProp<TextStyle>;
|
|
4
6
|
onDismiss?: () => void;
|
|
5
7
|
}
|
|
@@ -1,20 +1,21 @@
|
|
|
1
|
-
import React, {
|
|
2
|
-
import { Pressable
|
|
1
|
+
import React, { useMemo } from 'react';
|
|
2
|
+
import { Pressable } from 'react-native';
|
|
3
3
|
import { useTheme } from '../../theme';
|
|
4
|
+
import { usePressableContainerStyles } from '../../hooks';
|
|
4
5
|
import { getThemedStyles } from './styles';
|
|
5
6
|
import { Icon, iconSizes } from '../Icon';
|
|
6
7
|
export default function IconButton({ accessibilityRole = 'button', color, disabled, iconStyle, size = iconSizes.medium, source, style, ...rest }) {
|
|
7
8
|
const theme = useTheme();
|
|
8
9
|
const themedStyle = getThemedStyles(theme);
|
|
9
|
-
const
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
}
|
|
10
|
+
const containerStyle = useMemo(() => ({
|
|
11
|
+
...themedStyle.container,
|
|
12
|
+
...(disabled && themedStyle.disabled),
|
|
13
|
+
}), [disabled, themedStyle]);
|
|
14
|
+
const pressableStyle = usePressableContainerStyles({
|
|
15
|
+
overrideStyle: style,
|
|
16
|
+
containerStyle,
|
|
17
|
+
pressedStyle: themedStyle.pressed,
|
|
18
|
+
});
|
|
18
19
|
return (<Pressable {...rest} accessibilityRole={accessibilityRole} disabled={disabled} style={pressableStyle}>
|
|
19
20
|
<Icon color={color} size={size} source={source} style={iconStyle}/>
|
|
20
21
|
</Pressable>);
|
|
@@ -3,6 +3,7 @@ import { Pressable, View, } from 'react-native';
|
|
|
3
3
|
import { useTheme } from '../../theme';
|
|
4
4
|
import { Label } from '../Label';
|
|
5
5
|
import { getFlexDirectionFromLabelPosition } from '../Label/utils';
|
|
6
|
+
import { usePressableContainerStyles } from '../../hooks';
|
|
6
7
|
import { getThemedStyles } from './styles';
|
|
7
8
|
import { getRadioDimensions } from './getRadioDimensions';
|
|
8
9
|
export const CONTAINER_TEST_ID = 'amplify__radio-button__container';
|
|
@@ -16,17 +17,18 @@ export default function Radio({ accessibilityRole = 'radio', disabled, label, la
|
|
|
16
17
|
onPress?.(event);
|
|
17
18
|
}
|
|
18
19
|
}, [disabled, onChange, onPress, value]);
|
|
19
|
-
const containerStyle =
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
20
|
+
const containerStyle = useMemo(() => ({
|
|
21
|
+
...themedStyle.container,
|
|
22
|
+
flexDirection: getFlexDirectionFromLabelPosition(labelPosition),
|
|
23
|
+
...(disabled && themedStyle.disabled),
|
|
24
|
+
}), [disabled, labelPosition, themedStyle]);
|
|
25
|
+
const pressableStyle = usePressableContainerStyles({
|
|
26
|
+
overrideStyle: style,
|
|
27
|
+
containerStyle,
|
|
28
|
+
pressedStyle: themedStyle.pressed,
|
|
29
|
+
});
|
|
28
30
|
const { radioContainerDimensions, radioDotDimensions } = useMemo(() => getRadioDimensions(size, themedStyle), [size, themedStyle]);
|
|
29
|
-
return (<Pressable {...rest} accessibilityRole={accessibilityRole} onPress={handleOnChange} style={
|
|
31
|
+
return (<Pressable {...rest} accessibilityRole={accessibilityRole} onPress={handleOnChange} style={pressableStyle}>
|
|
30
32
|
<View style={[
|
|
31
33
|
themedStyle.radioContainer,
|
|
32
34
|
radioContainerDimensions,
|
|
@@ -12,6 +12,10 @@ export const getThemedStyles = (theme) => {
|
|
|
12
12
|
opacity: opacities[60],
|
|
13
13
|
...components?.radio?.disabled,
|
|
14
14
|
},
|
|
15
|
+
pressed: {
|
|
16
|
+
opacity: opacities[60],
|
|
17
|
+
...components?.radio?.pressed,
|
|
18
|
+
},
|
|
15
19
|
radioContainer: {
|
|
16
20
|
alignItems: 'center',
|
|
17
21
|
borderColor: colors.border.primary,
|
|
@@ -17,6 +17,7 @@ export declare type RadioDimensions = Pick<ViewStyle, 'height' | 'width'>;
|
|
|
17
17
|
export interface RadioStyles {
|
|
18
18
|
container?: ViewStyle;
|
|
19
19
|
disabled?: ViewStyle;
|
|
20
|
+
pressed?: ViewStyle;
|
|
20
21
|
radioContainer?: ViewStyle;
|
|
21
22
|
radioContainerLarge?: RadioDimensions;
|
|
22
23
|
radioContainerMedium?: RadioDimensions;
|
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
import React, {
|
|
1
|
+
import React, { useMemo } from 'react';
|
|
2
2
|
import { useTheme } from '../../theme';
|
|
3
|
+
import { usePressableContainerStyles } from '../../hooks';
|
|
3
4
|
import { Button } from '../Button';
|
|
4
5
|
import { getThemedStyles } from './styles';
|
|
5
6
|
export default function Tab({ children, selected, style, textStyle, indicatorPosition, ...rest }) {
|
|
6
7
|
const theme = useTheme();
|
|
7
8
|
const themedStyle = getThemedStyles(theme, indicatorPosition);
|
|
8
9
|
const selectedStyles = selected ? themedStyle.selected : null;
|
|
9
|
-
const containerStyle =
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
}
|
|
20
|
-
return (<Button {...rest} accessibilityRole="tab" style={containerStyle} textStyle={[themedStyle.tabText, textStyle, selectedStyles]}>
|
|
10
|
+
const containerStyle = useMemo(() => ({
|
|
11
|
+
...themedStyle.tab,
|
|
12
|
+
...(selected && themedStyle.readonly),
|
|
13
|
+
...selectedStyles,
|
|
14
|
+
}), [selected, selectedStyles, themedStyle]);
|
|
15
|
+
const pressableStyle = usePressableContainerStyles({
|
|
16
|
+
overrideStyle: style,
|
|
17
|
+
containerStyle,
|
|
18
|
+
pressedStyle: themedStyle.pressed,
|
|
19
|
+
});
|
|
20
|
+
return (<Button {...rest} accessibilityRole="tab" style={pressableStyle} textStyle={[themedStyle.tabText, textStyle, selectedStyles]}>
|
|
21
21
|
{children}
|
|
22
22
|
</Button>);
|
|
23
23
|
}
|
|
@@ -18,6 +18,10 @@ export const getThemedStyles = (theme, indicatorPosition) => {
|
|
|
18
18
|
opacity: opacities[100],
|
|
19
19
|
...components?.tabs?.readonly,
|
|
20
20
|
},
|
|
21
|
+
pressed: {
|
|
22
|
+
opacity: opacities[60],
|
|
23
|
+
...components?.tabs?.pressed,
|
|
24
|
+
},
|
|
21
25
|
tabList: {
|
|
22
26
|
flexDirection: 'row',
|
|
23
27
|
width: '100%',
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aws-amplify/ui-react-native",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.4",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"module": "dist/esm/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -43,8 +43,8 @@
|
|
|
43
43
|
"type-fest": "^2.3.4"
|
|
44
44
|
},
|
|
45
45
|
"dependencies": {
|
|
46
|
-
"@aws-amplify/ui": "5.3.
|
|
47
|
-
"@aws-amplify/ui-react-core": "2.1.
|
|
46
|
+
"@aws-amplify/ui": "5.3.1",
|
|
47
|
+
"@aws-amplify/ui-react-core": "2.1.4"
|
|
48
48
|
},
|
|
49
49
|
"peerDependencies": {
|
|
50
50
|
"aws-amplify": ">= 5.0.1",
|
|
@@ -217,8 +217,7 @@ Array [
|
|
|
217
217
|
style={
|
|
218
218
|
Array [
|
|
219
219
|
Object {},
|
|
220
|
-
|
|
221
|
-
null,
|
|
220
|
+
undefined,
|
|
222
221
|
undefined,
|
|
223
222
|
]
|
|
224
223
|
}
|
|
@@ -356,8 +355,7 @@ Array [
|
|
|
356
355
|
style={
|
|
357
356
|
Array [
|
|
358
357
|
Object {},
|
|
359
|
-
|
|
360
|
-
null,
|
|
358
|
+
undefined,
|
|
361
359
|
undefined,
|
|
362
360
|
]
|
|
363
361
|
}
|
|
@@ -399,10 +397,10 @@ Array [
|
|
|
399
397
|
"backgroundColor": "hsl(0, 75%, 85%)",
|
|
400
398
|
"flexDirection": "row",
|
|
401
399
|
"paddingHorizontal": 8,
|
|
402
|
-
"paddingVertical":
|
|
400
|
+
"paddingVertical": 12,
|
|
403
401
|
},
|
|
404
402
|
Object {
|
|
405
|
-
"
|
|
403
|
+
"marginHorizontal": 12,
|
|
406
404
|
},
|
|
407
405
|
]
|
|
408
406
|
}
|
|
@@ -422,9 +420,13 @@ Array [
|
|
|
422
420
|
"tintColor": undefined,
|
|
423
421
|
"width": 20,
|
|
424
422
|
},
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
423
|
+
Array [
|
|
424
|
+
Object {
|
|
425
|
+
"margin": 8,
|
|
426
|
+
"tintColor": "hsl(0, 100%, 20%)",
|
|
427
|
+
},
|
|
428
|
+
Object {},
|
|
429
|
+
],
|
|
428
430
|
]
|
|
429
431
|
}
|
|
430
432
|
/>
|
|
@@ -434,6 +436,7 @@ Array [
|
|
|
434
436
|
Object {
|
|
435
437
|
"color": "hsl(0, 100%, 20%)",
|
|
436
438
|
"flex": 1,
|
|
439
|
+
"fontSize": 16,
|
|
437
440
|
"paddingHorizontal": 8,
|
|
438
441
|
},
|
|
439
442
|
Object {},
|
|
@@ -461,17 +464,13 @@ Array [
|
|
|
461
464
|
Array [
|
|
462
465
|
Object {
|
|
463
466
|
"alignItems": "center",
|
|
464
|
-
"backgroundColor": "
|
|
467
|
+
"backgroundColor": "hsl(190, 95%, 30%)",
|
|
465
468
|
"borderRadius": 4,
|
|
466
469
|
"justifyContent": "center",
|
|
467
470
|
"paddingHorizontal": 16,
|
|
468
471
|
"paddingVertical": 12,
|
|
469
472
|
},
|
|
470
|
-
|
|
471
|
-
"backgroundColor": "hsl(190, 95%, 30%)",
|
|
472
|
-
},
|
|
473
|
-
null,
|
|
474
|
-
null,
|
|
473
|
+
undefined,
|
|
475
474
|
Object {
|
|
476
475
|
"marginHorizontal": 16,
|
|
477
476
|
"marginVertical": 12,
|
|
@@ -514,17 +513,14 @@ Array [
|
|
|
514
513
|
Object {
|
|
515
514
|
"alignItems": "center",
|
|
516
515
|
"backgroundColor": "transparent",
|
|
516
|
+
"borderColor": "hsl(210, 10%, 58%)",
|
|
517
517
|
"borderRadius": 4,
|
|
518
|
+
"borderWidth": 1,
|
|
518
519
|
"justifyContent": "center",
|
|
519
520
|
"paddingHorizontal": 16,
|
|
520
521
|
"paddingVertical": 12,
|
|
521
522
|
},
|
|
522
|
-
|
|
523
|
-
"borderColor": "hsl(210, 10%, 58%)",
|
|
524
|
-
"borderWidth": 1,
|
|
525
|
-
},
|
|
526
|
-
null,
|
|
527
|
-
null,
|
|
523
|
+
undefined,
|
|
528
524
|
Object {
|
|
529
525
|
"marginHorizontal": 16,
|
|
530
526
|
},
|
|
@@ -767,8 +763,7 @@ Array [
|
|
|
767
763
|
style={
|
|
768
764
|
Array [
|
|
769
765
|
Object {},
|
|
770
|
-
|
|
771
|
-
null,
|
|
766
|
+
undefined,
|
|
772
767
|
undefined,
|
|
773
768
|
]
|
|
774
769
|
}
|
|
@@ -906,8 +901,7 @@ Array [
|
|
|
906
901
|
style={
|
|
907
902
|
Array [
|
|
908
903
|
Object {},
|
|
909
|
-
|
|
910
|
-
null,
|
|
904
|
+
undefined,
|
|
911
905
|
undefined,
|
|
912
906
|
]
|
|
913
907
|
}
|
|
@@ -958,17 +952,13 @@ Array [
|
|
|
958
952
|
Array [
|
|
959
953
|
Object {
|
|
960
954
|
"alignItems": "center",
|
|
961
|
-
"backgroundColor": "
|
|
955
|
+
"backgroundColor": "hsl(190, 95%, 30%)",
|
|
962
956
|
"borderRadius": 4,
|
|
963
957
|
"justifyContent": "center",
|
|
964
958
|
"paddingHorizontal": 16,
|
|
965
959
|
"paddingVertical": 12,
|
|
966
960
|
},
|
|
967
|
-
|
|
968
|
-
"backgroundColor": "hsl(190, 95%, 30%)",
|
|
969
|
-
},
|
|
970
|
-
null,
|
|
971
|
-
null,
|
|
961
|
+
undefined,
|
|
972
962
|
Object {
|
|
973
963
|
"marginHorizontal": 16,
|
|
974
964
|
"marginVertical": 12,
|
|
@@ -1011,17 +1001,14 @@ Array [
|
|
|
1011
1001
|
Object {
|
|
1012
1002
|
"alignItems": "center",
|
|
1013
1003
|
"backgroundColor": "transparent",
|
|
1004
|
+
"borderColor": "hsl(210, 10%, 58%)",
|
|
1014
1005
|
"borderRadius": 4,
|
|
1006
|
+
"borderWidth": 1,
|
|
1015
1007
|
"justifyContent": "center",
|
|
1016
1008
|
"paddingHorizontal": 16,
|
|
1017
1009
|
"paddingVertical": 12,
|
|
1018
1010
|
},
|
|
1019
|
-
|
|
1020
|
-
"borderColor": "hsl(210, 10%, 58%)",
|
|
1021
|
-
"borderWidth": 1,
|
|
1022
|
-
},
|
|
1023
|
-
null,
|
|
1024
|
-
null,
|
|
1011
|
+
undefined,
|
|
1025
1012
|
Object {
|
|
1026
1013
|
"marginHorizontal": 16,
|
|
1027
1014
|
},
|
package/src/Authenticator/Defaults/ConfirmSignIn/__tests__/__snapshots__/ConfirmSignIn.spec.tsx.snap
CHANGED
|
@@ -121,10 +121,10 @@ Array [
|
|
|
121
121
|
"backgroundColor": "hsl(0, 75%, 85%)",
|
|
122
122
|
"flexDirection": "row",
|
|
123
123
|
"paddingHorizontal": 8,
|
|
124
|
-
"paddingVertical":
|
|
124
|
+
"paddingVertical": 12,
|
|
125
125
|
},
|
|
126
126
|
Object {
|
|
127
|
-
"
|
|
127
|
+
"marginHorizontal": 12,
|
|
128
128
|
},
|
|
129
129
|
]
|
|
130
130
|
}
|
|
@@ -144,9 +144,13 @@ Array [
|
|
|
144
144
|
"tintColor": undefined,
|
|
145
145
|
"width": 20,
|
|
146
146
|
},
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
147
|
+
Array [
|
|
148
|
+
Object {
|
|
149
|
+
"margin": 8,
|
|
150
|
+
"tintColor": "hsl(0, 100%, 20%)",
|
|
151
|
+
},
|
|
152
|
+
Object {},
|
|
153
|
+
],
|
|
150
154
|
]
|
|
151
155
|
}
|
|
152
156
|
/>
|
|
@@ -156,6 +160,7 @@ Array [
|
|
|
156
160
|
Object {
|
|
157
161
|
"color": "hsl(0, 100%, 20%)",
|
|
158
162
|
"flex": 1,
|
|
163
|
+
"fontSize": 16,
|
|
159
164
|
"paddingHorizontal": 8,
|
|
160
165
|
},
|
|
161
166
|
Object {},
|
|
@@ -183,17 +188,13 @@ Array [
|
|
|
183
188
|
Array [
|
|
184
189
|
Object {
|
|
185
190
|
"alignItems": "center",
|
|
186
|
-
"backgroundColor": "
|
|
191
|
+
"backgroundColor": "hsl(190, 95%, 30%)",
|
|
187
192
|
"borderRadius": 4,
|
|
188
193
|
"justifyContent": "center",
|
|
189
194
|
"paddingHorizontal": 16,
|
|
190
195
|
"paddingVertical": 12,
|
|
191
196
|
},
|
|
192
|
-
|
|
193
|
-
"backgroundColor": "hsl(190, 95%, 30%)",
|
|
194
|
-
},
|
|
195
|
-
null,
|
|
196
|
-
null,
|
|
197
|
+
undefined,
|
|
197
198
|
Object {
|
|
198
199
|
"marginHorizontal": 16,
|
|
199
200
|
"marginVertical": 12,
|
|
@@ -250,9 +251,7 @@ Array [
|
|
|
250
251
|
"paddingHorizontal": 16,
|
|
251
252
|
"paddingVertical": 12,
|
|
252
253
|
},
|
|
253
|
-
|
|
254
|
-
null,
|
|
255
|
-
null,
|
|
254
|
+
undefined,
|
|
256
255
|
Object {
|
|
257
256
|
"marginVertical": 8,
|
|
258
257
|
"minWidth": "50%",
|
|
@@ -410,17 +409,13 @@ Array [
|
|
|
410
409
|
Array [
|
|
411
410
|
Object {
|
|
412
411
|
"alignItems": "center",
|
|
413
|
-
"backgroundColor": "
|
|
412
|
+
"backgroundColor": "hsl(190, 95%, 30%)",
|
|
414
413
|
"borderRadius": 4,
|
|
415
414
|
"justifyContent": "center",
|
|
416
415
|
"paddingHorizontal": 16,
|
|
417
416
|
"paddingVertical": 12,
|
|
418
417
|
},
|
|
419
|
-
|
|
420
|
-
"backgroundColor": "hsl(190, 95%, 30%)",
|
|
421
|
-
},
|
|
422
|
-
null,
|
|
423
|
-
null,
|
|
418
|
+
undefined,
|
|
424
419
|
Object {
|
|
425
420
|
"marginHorizontal": 16,
|
|
426
421
|
"marginVertical": 12,
|
|
@@ -477,9 +472,7 @@ Array [
|
|
|
477
472
|
"paddingHorizontal": 16,
|
|
478
473
|
"paddingVertical": 12,
|
|
479
474
|
},
|
|
480
|
-
|
|
481
|
-
null,
|
|
482
|
-
null,
|
|
475
|
+
undefined,
|
|
483
476
|
Object {
|
|
484
477
|
"marginVertical": 8,
|
|
485
478
|
"minWidth": "50%",
|