@umituz/react-native-auth 3.5.7 → 3.5.9
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@umituz/react-native-auth",
|
|
3
|
-
"version": "3.5.
|
|
3
|
+
"version": "3.5.9",
|
|
4
4
|
"description": "Authentication service for React Native apps - Secure, type-safe, and production-ready. Provider-agnostic design with dependency injection, configurable validation, and comprehensive error handling.",
|
|
5
5
|
"main": "./src/index.ts",
|
|
6
6
|
"types": "./src/index.ts",
|
package/src/index.ts
CHANGED
|
@@ -168,7 +168,6 @@ export type {
|
|
|
168
168
|
} from './presentation/navigation/AuthNavigator';
|
|
169
169
|
|
|
170
170
|
// COMPONENTS
|
|
171
|
-
export { AuthContainer } from './presentation/components/AuthContainer';
|
|
172
171
|
export { AuthHeader } from './presentation/components/AuthHeader';
|
|
173
172
|
export { LoginForm } from './presentation/components/LoginForm';
|
|
174
173
|
export { RegisterForm } from './presentation/components/RegisterForm';
|
|
@@ -4,8 +4,11 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
import React from "react";
|
|
7
|
-
import {
|
|
8
|
-
|
|
7
|
+
import {
|
|
8
|
+
AlertInline,
|
|
9
|
+
AlertService,
|
|
10
|
+
AlertMode,
|
|
11
|
+
} from "@umituz/react-native-design-system";
|
|
9
12
|
|
|
10
13
|
interface AuthErrorDisplayProps {
|
|
11
14
|
error: string | null;
|
|
@@ -14,46 +17,20 @@ interface AuthErrorDisplayProps {
|
|
|
14
17
|
export const AuthErrorDisplay: React.FC<AuthErrorDisplayProps> = ({
|
|
15
18
|
error,
|
|
16
19
|
}) => {
|
|
17
|
-
const
|
|
18
|
-
|
|
19
|
-
|
|
20
|
+
const alert = React.useMemo(() => {
|
|
21
|
+
if (!error) return null;
|
|
22
|
+
return AlertService.createErrorAlert(error, undefined, {
|
|
23
|
+
mode: AlertMode.INLINE,
|
|
24
|
+
});
|
|
25
|
+
}, [error]);
|
|
26
|
+
|
|
27
|
+
if (!alert) {
|
|
20
28
|
return null;
|
|
21
29
|
}
|
|
22
30
|
|
|
23
|
-
return
|
|
24
|
-
<View
|
|
25
|
-
style={[
|
|
26
|
-
styles.errorContainer,
|
|
27
|
-
{
|
|
28
|
-
backgroundColor: tokens.colors.errorLight,
|
|
29
|
-
borderColor: tokens.colors.error,
|
|
30
|
-
},
|
|
31
|
-
]}
|
|
32
|
-
>
|
|
33
|
-
<AtomicText
|
|
34
|
-
type="bodyMedium"
|
|
35
|
-
color="error"
|
|
36
|
-
style={styles.errorText}
|
|
37
|
-
>
|
|
38
|
-
{error}
|
|
39
|
-
</AtomicText>
|
|
40
|
-
</View>
|
|
41
|
-
);
|
|
31
|
+
return <AlertInline alert={alert} />;
|
|
42
32
|
};
|
|
43
33
|
|
|
44
|
-
const styles = StyleSheet.create({
|
|
45
|
-
errorContainer: {
|
|
46
|
-
marginBottom: 16,
|
|
47
|
-
padding: 14,
|
|
48
|
-
borderRadius: 12,
|
|
49
|
-
borderWidth: 1,
|
|
50
|
-
},
|
|
51
|
-
errorText: {
|
|
52
|
-
textAlign: "center",
|
|
53
|
-
fontWeight: "500",
|
|
54
|
-
},
|
|
55
|
-
});
|
|
56
|
-
|
|
57
34
|
|
|
58
35
|
|
|
59
36
|
|
|
@@ -4,28 +4,34 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
import React from "react";
|
|
7
|
-
import { useAppNavigation, AtomicCard } from "@umituz/react-native-design-system";
|
|
7
|
+
import { useAppNavigation, AtomicCard, ScreenLayout, useAppDesignTokens } from "@umituz/react-native-design-system";
|
|
8
8
|
import { useLocalization } from "@umituz/react-native-localization";
|
|
9
9
|
import type { AuthStackParamList } from "../navigation/AuthNavigator";
|
|
10
|
-
import { AuthContainer } from "../components/AuthContainer";
|
|
11
10
|
import { AuthHeader } from "../components/AuthHeader";
|
|
12
11
|
import { LoginForm } from "../components/LoginForm";
|
|
13
12
|
|
|
14
13
|
export const LoginScreen: React.FC = () => {
|
|
15
14
|
const { t } = useLocalization();
|
|
16
15
|
const navigation = useAppNavigation<AuthStackParamList>();
|
|
16
|
+
const tokens = useAppDesignTokens();
|
|
17
17
|
|
|
18
18
|
const handleNavigateToRegister = () => {
|
|
19
19
|
navigation.navigate("Register");
|
|
20
20
|
};
|
|
21
21
|
|
|
22
22
|
return (
|
|
23
|
-
<
|
|
23
|
+
<ScreenLayout
|
|
24
|
+
scrollable
|
|
25
|
+
keyboardAvoiding
|
|
26
|
+
maxWidth={440}
|
|
27
|
+
contentContainerStyle={{ justifyContent: "center" }}
|
|
28
|
+
backgroundColor={tokens.colors.backgroundPrimary}
|
|
29
|
+
>
|
|
24
30
|
<AuthHeader title={t("auth.title")} />
|
|
25
|
-
<AtomicCard variant="elevated" padding="
|
|
31
|
+
<AtomicCard variant="elevated" padding="lg">
|
|
26
32
|
<LoginForm onNavigateToRegister={handleNavigateToRegister} />
|
|
27
33
|
</AtomicCard>
|
|
28
|
-
</
|
|
34
|
+
</ScreenLayout>
|
|
29
35
|
);
|
|
30
36
|
};
|
|
31
37
|
|
|
@@ -4,10 +4,9 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
import React from "react";
|
|
7
|
-
import { useAppNavigation, AtomicCard } from "@umituz/react-native-design-system";
|
|
7
|
+
import { useAppNavigation, AtomicCard, ScreenLayout, useAppDesignTokens } from "@umituz/react-native-design-system";
|
|
8
8
|
import { useLocalization } from "@umituz/react-native-localization";
|
|
9
9
|
import type { AuthStackParamList } from "../navigation/AuthNavigator";
|
|
10
|
-
import { AuthContainer } from "../components/AuthContainer";
|
|
11
10
|
import { AuthHeader } from "../components/AuthHeader";
|
|
12
11
|
import { RegisterForm } from "../components/RegisterForm";
|
|
13
12
|
|
|
@@ -26,15 +25,22 @@ export const RegisterScreen: React.FC<RegisterScreenProps> = ({
|
|
|
26
25
|
}) => {
|
|
27
26
|
const { t } = useLocalization();
|
|
28
27
|
const navigation = useAppNavigation<AuthStackParamList>();
|
|
28
|
+
const tokens = useAppDesignTokens();
|
|
29
29
|
|
|
30
30
|
const handleNavigateToLogin = () => {
|
|
31
31
|
navigation.navigate("Login");
|
|
32
32
|
};
|
|
33
33
|
|
|
34
34
|
return (
|
|
35
|
-
<
|
|
35
|
+
<ScreenLayout
|
|
36
|
+
scrollable
|
|
37
|
+
keyboardAvoiding
|
|
38
|
+
maxWidth={440}
|
|
39
|
+
contentContainerStyle={{ justifyContent: "center" }}
|
|
40
|
+
backgroundColor={tokens.colors.backgroundPrimary}
|
|
41
|
+
>
|
|
36
42
|
<AuthHeader title={t("auth.createAccount")} />
|
|
37
|
-
<AtomicCard variant="elevated" padding="
|
|
43
|
+
<AtomicCard variant="elevated" padding="lg">
|
|
38
44
|
<RegisterForm
|
|
39
45
|
onNavigateToLogin={handleNavigateToLogin}
|
|
40
46
|
termsUrl={termsUrl}
|
|
@@ -43,7 +49,7 @@ export const RegisterScreen: React.FC<RegisterScreenProps> = ({
|
|
|
43
49
|
onPrivacyPress={onPrivacyPress}
|
|
44
50
|
/>
|
|
45
51
|
</AtomicCard>
|
|
46
|
-
</
|
|
52
|
+
</ScreenLayout>
|
|
47
53
|
);
|
|
48
54
|
};
|
|
49
55
|
|
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Auth Container Component
|
|
3
|
-
* Main container for auth screens with background and scroll
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
import React, { useMemo } from "react";
|
|
7
|
-
import {
|
|
8
|
-
View,
|
|
9
|
-
StyleSheet,
|
|
10
|
-
ScrollView,
|
|
11
|
-
} from "react-native";
|
|
12
|
-
import { useResponsive, useSafeAreaInsets, AtomicKeyboardAvoidingView, useAppDesignTokens } from "@umituz/react-native-design-system";
|
|
13
|
-
|
|
14
|
-
/** Layout constants for auth screens */
|
|
15
|
-
const AUTH_LAYOUT = {
|
|
16
|
-
VERTICAL_PADDING: 40,
|
|
17
|
-
HORIZONTAL_PADDING: 20,
|
|
18
|
-
MAX_CONTENT_WIDTH: 440,
|
|
19
|
-
} as const;
|
|
20
|
-
|
|
21
|
-
interface AuthContainerProps {
|
|
22
|
-
children: React.ReactNode;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
export const AuthContainer: React.FC<AuthContainerProps> = ({ children }) => {
|
|
26
|
-
const insets = useSafeAreaInsets();
|
|
27
|
-
const { spacingMultiplier } = useResponsive();
|
|
28
|
-
|
|
29
|
-
const tokens = useAppDesignTokens();
|
|
30
|
-
|
|
31
|
-
const dynamicStyles = useMemo(() => ({
|
|
32
|
-
paddingTop: insets.top + (AUTH_LAYOUT.VERTICAL_PADDING * spacingMultiplier),
|
|
33
|
-
paddingBottom: insets.bottom + (AUTH_LAYOUT.VERTICAL_PADDING * spacingMultiplier),
|
|
34
|
-
}), [insets.top, insets.bottom, spacingMultiplier]);
|
|
35
|
-
|
|
36
|
-
return (
|
|
37
|
-
<AtomicKeyboardAvoidingView
|
|
38
|
-
style={[styles.container, { backgroundColor: tokens.colors.backgroundPrimary }]}
|
|
39
|
-
behavior="padding"
|
|
40
|
-
>
|
|
41
|
-
<ScrollView
|
|
42
|
-
contentContainerStyle={[styles.scrollContent, dynamicStyles]}
|
|
43
|
-
keyboardShouldPersistTaps="handled"
|
|
44
|
-
showsVerticalScrollIndicator={false}
|
|
45
|
-
>
|
|
46
|
-
<View style={styles.content}>{children}</View>
|
|
47
|
-
</ScrollView>
|
|
48
|
-
</AtomicKeyboardAvoidingView>
|
|
49
|
-
);
|
|
50
|
-
};
|
|
51
|
-
|
|
52
|
-
const styles = StyleSheet.create({
|
|
53
|
-
container: {
|
|
54
|
-
flex: 1,
|
|
55
|
-
},
|
|
56
|
-
scrollContent: {
|
|
57
|
-
flexGrow: 1,
|
|
58
|
-
paddingHorizontal: AUTH_LAYOUT.HORIZONTAL_PADDING,
|
|
59
|
-
},
|
|
60
|
-
content: {
|
|
61
|
-
flex: 1,
|
|
62
|
-
justifyContent: "center",
|
|
63
|
-
maxWidth: AUTH_LAYOUT.MAX_CONTENT_WIDTH,
|
|
64
|
-
alignSelf: "center",
|
|
65
|
-
width: "100%",
|
|
66
|
-
},
|
|
67
|
-
});
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|