@aws-amplify/ui-react-native 2.1.0 → 2.1.2
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/dist/Authenticator/common/FederatedProviderButtons/FederatedProviderButtons.d.ts +1 -1
- package/dist/Authenticator/common/FederatedProviderButtons/FederatedProviderButtons.js +3 -10
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/lib/Authenticator/common/FederatedProviderButtons/FederatedProviderButtons.js +3 -10
- package/lib/version.js +1 -1
- package/package.json +4 -4
- package/src/Authenticator/common/DefaultContent/DefaultContent.tsx +1 -1
- package/src/Authenticator/common/FederatedProviderButtons/FederatedProviderButtons.tsx +3 -12
- package/src/version.ts +1 -1
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { FederatedProviderButtonsProps } from './types';
|
|
3
|
-
export default function FederatedProviderButtons({ buttonStyle, dividerLabelStyle, route, socialProviders, style, }: FederatedProviderButtonsProps): JSX.Element | null;
|
|
3
|
+
export default function FederatedProviderButtons({ buttonStyle, dividerLabelStyle, route, socialProviders, style, toFederatedSignIn, }: FederatedProviderButtonsProps): JSX.Element | null;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import React, { useMemo } from 'react';
|
|
2
2
|
import { View } from 'react-native';
|
|
3
|
-
import { signInWithRedirect } from 'aws-amplify/auth';
|
|
4
3
|
import { authenticatorTextUtil, capitalize, } from '@aws-amplify/ui';
|
|
5
4
|
import { Divider } from '../../../primitives';
|
|
6
5
|
import { useTheme } from '../../../theme';
|
|
@@ -8,24 +7,18 @@ import { FederatedProviderButton } from '../FederatedProviderButton';
|
|
|
8
7
|
import { icons } from '../../../assets';
|
|
9
8
|
import { getThemedStyles } from './styles';
|
|
10
9
|
const { getSignInWithFederationText, getOrText } = authenticatorTextUtil;
|
|
11
|
-
|
|
12
|
-
// exposed on `useAuthenticator` for RN. `@aws-amplify/rtn-web-browser`
|
|
13
|
-
// does not emit an event on federated sign in flow cancellation,
|
|
14
|
-
// preventing the `Authenticator` from updating state and leaving the
|
|
15
|
-
// UI in a "pending" state
|
|
16
|
-
const handleSignInWithRedirect = (provider) => signInWithRedirect({ provider: capitalize(provider) });
|
|
17
|
-
export default function FederatedProviderButtons({ buttonStyle, dividerLabelStyle, route, socialProviders, style, }) {
|
|
10
|
+
export default function FederatedProviderButtons({ buttonStyle, dividerLabelStyle, route, socialProviders, style, toFederatedSignIn, }) {
|
|
18
11
|
const theme = useTheme();
|
|
19
12
|
const themedStyle = getThemedStyles(theme);
|
|
20
13
|
const providerButtons = useMemo(() => socialProviders?.map((provider) => {
|
|
21
14
|
const providerIconSource = icons[`${provider}Logo`];
|
|
22
15
|
const handlePress = () => {
|
|
23
|
-
|
|
16
|
+
toFederatedSignIn({ provider: capitalize(provider) });
|
|
24
17
|
};
|
|
25
18
|
return (<FederatedProviderButton key={provider} onPress={handlePress} source={providerIconSource} style={[themedStyle.button, buttonStyle]}>
|
|
26
19
|
{getSignInWithFederationText(route, provider)}
|
|
27
20
|
</FederatedProviderButton>);
|
|
28
|
-
}), [route, socialProviders, themedStyle, buttonStyle]);
|
|
21
|
+
}), [route, socialProviders, themedStyle, buttonStyle, toFederatedSignIn]);
|
|
29
22
|
return providerButtons?.length ? (<View style={[themedStyle.container, style]} testID="amplify__federated-provider-buttons">
|
|
30
23
|
{providerButtons}
|
|
31
24
|
<Divider labelStyle={[themedStyle.dividerLabel, dividerLabelStyle]}>
|
package/dist/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const VERSION = "2.1.
|
|
1
|
+
export declare const VERSION = "2.1.2";
|
package/dist/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const VERSION = '2.1.
|
|
1
|
+
export const VERSION = '2.1.2';
|
|
@@ -3,7 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
const tslib_1 = require("tslib");
|
|
4
4
|
const react_1 = tslib_1.__importStar(require("react"));
|
|
5
5
|
const react_native_1 = require("react-native");
|
|
6
|
-
const auth_1 = require("aws-amplify/auth");
|
|
7
6
|
const ui_1 = require("@aws-amplify/ui");
|
|
8
7
|
const primitives_1 = require("../../../primitives");
|
|
9
8
|
const theme_1 = require("../../../theme");
|
|
@@ -11,24 +10,18 @@ const FederatedProviderButton_1 = require("../FederatedProviderButton");
|
|
|
11
10
|
const assets_1 = require("../../../assets");
|
|
12
11
|
const styles_1 = require("./styles");
|
|
13
12
|
const { getSignInWithFederationText, getOrText } = ui_1.authenticatorTextUtil;
|
|
14
|
-
|
|
15
|
-
// exposed on `useAuthenticator` for RN. `@aws-amplify/rtn-web-browser`
|
|
16
|
-
// does not emit an event on federated sign in flow cancellation,
|
|
17
|
-
// preventing the `Authenticator` from updating state and leaving the
|
|
18
|
-
// UI in a "pending" state
|
|
19
|
-
const handleSignInWithRedirect = (provider) => (0, auth_1.signInWithRedirect)({ provider: (0, ui_1.capitalize)(provider) });
|
|
20
|
-
function FederatedProviderButtons({ buttonStyle, dividerLabelStyle, route, socialProviders, style, }) {
|
|
13
|
+
function FederatedProviderButtons({ buttonStyle, dividerLabelStyle, route, socialProviders, style, toFederatedSignIn, }) {
|
|
21
14
|
const theme = (0, theme_1.useTheme)();
|
|
22
15
|
const themedStyle = (0, styles_1.getThemedStyles)(theme);
|
|
23
16
|
const providerButtons = (0, react_1.useMemo)(() => socialProviders?.map((provider) => {
|
|
24
17
|
const providerIconSource = assets_1.icons[`${provider}Logo`];
|
|
25
18
|
const handlePress = () => {
|
|
26
|
-
|
|
19
|
+
toFederatedSignIn({ provider: (0, ui_1.capitalize)(provider) });
|
|
27
20
|
};
|
|
28
21
|
return (<FederatedProviderButton_1.FederatedProviderButton key={provider} onPress={handlePress} source={providerIconSource} style={[themedStyle.button, buttonStyle]}>
|
|
29
22
|
{getSignInWithFederationText(route, provider)}
|
|
30
23
|
</FederatedProviderButton_1.FederatedProviderButton>);
|
|
31
|
-
}), [route, socialProviders, themedStyle, buttonStyle]);
|
|
24
|
+
}), [route, socialProviders, themedStyle, buttonStyle, toFederatedSignIn]);
|
|
32
25
|
return providerButtons?.length ? (<react_native_1.View style={[themedStyle.container, style]} testID="amplify__federated-provider-buttons">
|
|
33
26
|
{providerButtons}
|
|
34
27
|
<primitives_1.Divider labelStyle={[themedStyle.dividerLabel, dividerLabelStyle]}>
|
package/lib/version.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aws-amplify/ui-react-native",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.2",
|
|
4
4
|
"main": "lib/index.js",
|
|
5
5
|
"module": "dist/index.js",
|
|
6
6
|
"react-native": "src/index.ts",
|
|
@@ -29,9 +29,9 @@
|
|
|
29
29
|
"react-native-safe-area-context": "^4.7.3"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@aws-amplify/ui": "6.0.
|
|
33
|
-
"@aws-amplify/ui-react-core": "3.0.
|
|
34
|
-
"@aws-amplify/ui-react-core-notifications": "2.0.
|
|
32
|
+
"@aws-amplify/ui": "6.0.10",
|
|
33
|
+
"@aws-amplify/ui-react-core": "3.0.10",
|
|
34
|
+
"@aws-amplify/ui-react-core-notifications": "2.0.10"
|
|
35
35
|
},
|
|
36
36
|
"peerDependencies": {
|
|
37
37
|
"aws-amplify": "^6.0.2",
|
|
@@ -14,7 +14,7 @@ function useThemedStyles<Style>(getStyle: (theme: StrictTheme) => Style) {
|
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
export default function DefaultContent<
|
|
17
|
-
FieldsType extends TextFieldOptionsType | RadioFieldOptions
|
|
17
|
+
FieldsType extends TextFieldOptionsType | RadioFieldOptions,
|
|
18
18
|
>({
|
|
19
19
|
body,
|
|
20
20
|
buttons: { primary, links, secondary },
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import React, { useMemo } from 'react';
|
|
2
2
|
import { View } from 'react-native';
|
|
3
|
-
import { signInWithRedirect } from 'aws-amplify/auth';
|
|
4
3
|
|
|
5
4
|
import {
|
|
6
5
|
SocialProvider,
|
|
@@ -17,21 +16,13 @@ import { getThemedStyles } from './styles';
|
|
|
17
16
|
|
|
18
17
|
const { getSignInWithFederationText, getOrText } = authenticatorTextUtil;
|
|
19
18
|
|
|
20
|
-
// use `signInWithRedirect` directly instead of `toFederatedSignIn`
|
|
21
|
-
// exposed on `useAuthenticator` for RN. `@aws-amplify/rtn-web-browser`
|
|
22
|
-
// does not emit an event on federated sign in flow cancellation,
|
|
23
|
-
// preventing the `Authenticator` from updating state and leaving the
|
|
24
|
-
// UI in a "pending" state
|
|
25
|
-
const handleSignInWithRedirect = (
|
|
26
|
-
provider: 'amazon' | 'apple' | 'facebook' | 'google'
|
|
27
|
-
) => signInWithRedirect({ provider: capitalize(provider) });
|
|
28
|
-
|
|
29
19
|
export default function FederatedProviderButtons({
|
|
30
20
|
buttonStyle,
|
|
31
21
|
dividerLabelStyle,
|
|
32
22
|
route,
|
|
33
23
|
socialProviders,
|
|
34
24
|
style,
|
|
25
|
+
toFederatedSignIn,
|
|
35
26
|
}: FederatedProviderButtonsProps): JSX.Element | null {
|
|
36
27
|
const theme = useTheme();
|
|
37
28
|
const themedStyle = getThemedStyles(theme);
|
|
@@ -42,7 +33,7 @@ export default function FederatedProviderButtons({
|
|
|
42
33
|
const providerIconSource = icons[`${provider}Logo`];
|
|
43
34
|
|
|
44
35
|
const handlePress = () => {
|
|
45
|
-
|
|
36
|
+
toFederatedSignIn({ provider: capitalize(provider) });
|
|
46
37
|
};
|
|
47
38
|
|
|
48
39
|
return (
|
|
@@ -56,7 +47,7 @@ export default function FederatedProviderButtons({
|
|
|
56
47
|
</FederatedProviderButton>
|
|
57
48
|
);
|
|
58
49
|
}),
|
|
59
|
-
[route, socialProviders, themedStyle, buttonStyle]
|
|
50
|
+
[route, socialProviders, themedStyle, buttonStyle, toFederatedSignIn]
|
|
60
51
|
);
|
|
61
52
|
|
|
62
53
|
return providerButtons?.length ? (
|
package/src/version.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const VERSION = '2.1.
|
|
1
|
+
export const VERSION = '2.1.2';
|