@umituz/react-native-firebase 2.3.4 → 2.4.0
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-firebase",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.4.0",
|
|
4
4
|
"description": "Unified Firebase package for React Native apps - Auth and Firestore services using Firebase JS SDK (no native modules).",
|
|
5
5
|
"main": "./src/index.ts",
|
|
6
6
|
"types": "./src/index.ts",
|
|
@@ -29,6 +29,3 @@ export {
|
|
|
29
29
|
|
|
30
30
|
export { PasswordPromptScreen } from './presentation/components/PasswordPromptScreen';
|
|
31
31
|
export type { PasswordPromptScreenProps } from './presentation/components/PasswordPromptScreen';
|
|
32
|
-
|
|
33
|
-
export { usePasswordPrompt } from './presentation/hooks/usePasswordPrompt';
|
|
34
|
-
export type { UsePasswordPromptOptions, UsePasswordPromptReturn } from './presentation/hooks/usePasswordPrompt';
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Password Prompt Screen
|
|
3
|
-
*
|
|
3
|
+
* Navigation screen for password input during account deletion reauthentication
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import React, { useState } from 'react';
|
|
7
|
-
import { View, StyleSheet,
|
|
8
|
-
import { Portal } from '@gorhom/portal';
|
|
6
|
+
import React, { useState, useEffect } from 'react';
|
|
7
|
+
import { View, StyleSheet, KeyboardAvoidingView, Platform, TouchableOpacity } from 'react-native';
|
|
9
8
|
import {
|
|
10
9
|
AtomicInput,
|
|
11
10
|
AtomicButton,
|
|
@@ -16,111 +15,112 @@ import {
|
|
|
16
15
|
} from '@umituz/react-native-design-system';
|
|
17
16
|
|
|
18
17
|
export interface PasswordPromptScreenProps {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
18
|
+
route: {
|
|
19
|
+
params: {
|
|
20
|
+
onComplete: (password: string | null) => void;
|
|
21
|
+
title?: string;
|
|
22
|
+
message?: string;
|
|
23
|
+
confirmText?: string;
|
|
24
|
+
cancelText?: string;
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
navigation: {
|
|
28
|
+
goBack: () => void;
|
|
29
|
+
};
|
|
26
30
|
}
|
|
27
31
|
|
|
28
32
|
export const PasswordPromptScreen: React.FC<PasswordPromptScreenProps> = ({
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
onCancel,
|
|
32
|
-
title = 'Password Required',
|
|
33
|
-
message = 'Enter your password to continue',
|
|
34
|
-
confirmText = 'Confirm',
|
|
35
|
-
cancelText = 'Cancel',
|
|
33
|
+
route,
|
|
34
|
+
navigation,
|
|
36
35
|
}) => {
|
|
37
36
|
const tokens = useAppDesignTokens();
|
|
38
37
|
const [password, setPassword] = useState('');
|
|
39
38
|
const [error, setError] = useState('');
|
|
40
39
|
|
|
40
|
+
const {
|
|
41
|
+
onComplete,
|
|
42
|
+
title = 'Password Required',
|
|
43
|
+
message = 'Enter your password to continue',
|
|
44
|
+
confirmText = 'Confirm',
|
|
45
|
+
cancelText = 'Cancel',
|
|
46
|
+
} = route.params;
|
|
47
|
+
|
|
48
|
+
useEffect(() => {
|
|
49
|
+
return () => {
|
|
50
|
+
onComplete(null);
|
|
51
|
+
};
|
|
52
|
+
}, [onComplete]);
|
|
53
|
+
|
|
41
54
|
const handleConfirm = () => {
|
|
42
55
|
if (!password.trim()) {
|
|
43
56
|
setError('Password is required');
|
|
44
57
|
return;
|
|
45
58
|
}
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
setError('');
|
|
59
|
+
onComplete(password);
|
|
60
|
+
navigation.goBack();
|
|
49
61
|
};
|
|
50
62
|
|
|
51
63
|
const handleCancel = () => {
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
onCancel();
|
|
64
|
+
onComplete(null);
|
|
65
|
+
navigation.goBack();
|
|
55
66
|
};
|
|
56
67
|
|
|
57
|
-
if (!visible) return null;
|
|
58
|
-
|
|
59
68
|
return (
|
|
60
|
-
<
|
|
61
|
-
<
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
<View style={
|
|
69
|
-
|
|
70
|
-
<AtomicIcon name="close" size="lg" color="textSecondary" />
|
|
71
|
-
</TouchableOpacity>
|
|
72
|
-
<AtomicText variant="h3" weight="semibold" color="textPrimary">
|
|
73
|
-
{title}
|
|
74
|
-
</AtomicText>
|
|
75
|
-
<View style={styles.placeholder} />
|
|
76
|
-
</View>
|
|
69
|
+
<SafeAreaView style={[styles.safeArea, { backgroundColor: tokens.colors.background }]} edges={['top', 'bottom']}>
|
|
70
|
+
<View style={[styles.headerBar, { borderBottomColor: tokens.colors.border }]}>
|
|
71
|
+
<TouchableOpacity onPress={handleCancel} style={styles.closeButton}>
|
|
72
|
+
<AtomicIcon name="close" size="lg" color="textSecondary" />
|
|
73
|
+
</TouchableOpacity>
|
|
74
|
+
<AtomicText type="headlineLarge" fontWeight="600" color="textPrimary">
|
|
75
|
+
{title}
|
|
76
|
+
</AtomicText>
|
|
77
|
+
<View style={styles.placeholder} />
|
|
78
|
+
</View>
|
|
77
79
|
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
80
|
+
<KeyboardAvoidingView
|
|
81
|
+
behavior={Platform.OS === 'ios' ? 'padding' : 'height'}
|
|
82
|
+
style={styles.keyboardView}
|
|
83
|
+
>
|
|
84
|
+
<View style={[styles.container, { padding: tokens.spacing.xl }]}>
|
|
85
|
+
<View style={styles.messageContainer}>
|
|
86
|
+
<AtomicText type="bodyMedium" color="textSecondary" style={styles.message}>
|
|
87
|
+
{message}
|
|
88
|
+
</AtomicText>
|
|
89
|
+
</View>
|
|
88
90
|
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
91
|
+
<View style={styles.content}>
|
|
92
|
+
<AtomicInput
|
|
93
|
+
value={password}
|
|
94
|
+
onChangeText={(text: string) => {
|
|
95
|
+
setPassword(text);
|
|
96
|
+
setError('');
|
|
97
|
+
}}
|
|
98
|
+
placeholder="Password"
|
|
99
|
+
secureTextEntry
|
|
100
|
+
autoFocus
|
|
101
|
+
state={error ? 'error' : 'default'}
|
|
102
|
+
helperText={error}
|
|
103
|
+
style={{ marginBottom: tokens.spacing.md }}
|
|
104
|
+
/>
|
|
105
|
+
</View>
|
|
104
106
|
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
</View>
|
|
107
|
+
<View style={[styles.buttons, { gap: tokens.spacing.sm }]}>
|
|
108
|
+
<AtomicButton
|
|
109
|
+
title={cancelText}
|
|
110
|
+
onPress={handleCancel}
|
|
111
|
+
variant="secondary"
|
|
112
|
+
style={styles.button}
|
|
113
|
+
/>
|
|
114
|
+
<AtomicButton
|
|
115
|
+
title={confirmText}
|
|
116
|
+
onPress={handleConfirm}
|
|
117
|
+
variant="primary"
|
|
118
|
+
style={styles.button}
|
|
119
|
+
/>
|
|
119
120
|
</View>
|
|
120
|
-
</
|
|
121
|
-
</
|
|
122
|
-
|
|
123
|
-
</Portal>
|
|
121
|
+
</View>
|
|
122
|
+
</KeyboardAvoidingView>
|
|
123
|
+
</SafeAreaView>
|
|
124
124
|
);
|
|
125
125
|
};
|
|
126
126
|
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Password Prompt Hook
|
|
3
|
-
* Manages password prompt modal state and logic
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
import React, { useState, useCallback, useMemo } from 'react';
|
|
7
|
-
import { PasswordPromptScreen } from '../components/PasswordPromptScreen';
|
|
8
|
-
|
|
9
|
-
export interface UsePasswordPromptOptions {
|
|
10
|
-
title?: string;
|
|
11
|
-
message?: string;
|
|
12
|
-
confirmText?: string;
|
|
13
|
-
cancelText?: string;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
export interface UsePasswordPromptReturn {
|
|
17
|
-
showPasswordPrompt: () => Promise<string | null>;
|
|
18
|
-
PasswordPromptComponent: React.ReactNode;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
export const usePasswordPrompt = (options: UsePasswordPromptOptions = {}): UsePasswordPromptReturn => {
|
|
22
|
-
const [isVisible, setIsVisible] = useState(false);
|
|
23
|
-
const [resolvePromise, setResolvePromise] = useState<((value: string | null) => void) | null>(null);
|
|
24
|
-
|
|
25
|
-
const showPasswordPrompt = useCallback((): Promise<string | null> => {
|
|
26
|
-
console.log("[usePasswordPrompt] showPasswordPrompt called - opening modal");
|
|
27
|
-
return new Promise((resolve) => {
|
|
28
|
-
setResolvePromise(() => resolve);
|
|
29
|
-
setIsVisible(true);
|
|
30
|
-
console.log("[usePasswordPrompt] Modal visibility set to true");
|
|
31
|
-
});
|
|
32
|
-
}, []);
|
|
33
|
-
|
|
34
|
-
const handleConfirm = useCallback((password: string) => {
|
|
35
|
-
if (resolvePromise) {
|
|
36
|
-
resolvePromise(password);
|
|
37
|
-
}
|
|
38
|
-
setIsVisible(false);
|
|
39
|
-
setResolvePromise(null);
|
|
40
|
-
}, [resolvePromise]);
|
|
41
|
-
|
|
42
|
-
const handleCancel = useCallback(() => {
|
|
43
|
-
if (resolvePromise) {
|
|
44
|
-
resolvePromise(null);
|
|
45
|
-
}
|
|
46
|
-
setIsVisible(false);
|
|
47
|
-
setResolvePromise(null);
|
|
48
|
-
}, [resolvePromise]);
|
|
49
|
-
|
|
50
|
-
const PasswordPromptComponent = useMemo(() => (
|
|
51
|
-
<PasswordPromptScreen
|
|
52
|
-
visible={isVisible}
|
|
53
|
-
onConfirm={handleConfirm}
|
|
54
|
-
onCancel={handleCancel}
|
|
55
|
-
title={options.title}
|
|
56
|
-
message={options.message}
|
|
57
|
-
confirmText={options.confirmText}
|
|
58
|
-
cancelText={options.cancelText}
|
|
59
|
-
/>
|
|
60
|
-
), [isVisible, handleConfirm, handleCancel, options.title, options.message, options.confirmText, options.cancelText]);
|
|
61
|
-
|
|
62
|
-
return {
|
|
63
|
-
showPasswordPrompt,
|
|
64
|
-
PasswordPromptComponent,
|
|
65
|
-
};
|
|
66
|
-
};
|