fln-espranza 1.1.19 → 1.1.21
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/components/PageHeader.tsx +50 -71
- package/components/SecondaryBaseLayout.tsx +32 -52
- package/package.json +1 -1
|
@@ -1,15 +1,11 @@
|
|
|
1
|
-
import { View, Animated,
|
|
1
|
+
import { View, Animated, TouchableOpacity } from "react-native";
|
|
2
2
|
import React, { JSX, useEffect, useRef } from "react";
|
|
3
3
|
import tw from "../lib/tailwind";
|
|
4
4
|
import { useNavigation } from "@react-navigation/native";
|
|
5
5
|
import EText from "./EText";
|
|
6
|
-
import Constants from "expo-constants";
|
|
7
6
|
import EIconArrowLeft from "./icons/EIconArrowLeft";
|
|
8
7
|
import EIconMenu from "./icons/EIconMenu";
|
|
9
8
|
|
|
10
|
-
const SCREEN_WIDTH = Dimensions.get("window").width;
|
|
11
|
-
const HEADER_HEIGHT = 90;
|
|
12
|
-
|
|
13
9
|
interface PageHeaderProps {
|
|
14
10
|
title: string;
|
|
15
11
|
subtitle?: string;
|
|
@@ -27,96 +23,79 @@ export default function PageHeader({
|
|
|
27
23
|
curved,
|
|
28
24
|
children,
|
|
29
25
|
iconEnd,
|
|
30
|
-
border,
|
|
31
26
|
menuButton,
|
|
32
27
|
hideBackBtn,
|
|
33
28
|
}: PageHeaderProps) {
|
|
34
29
|
const navigation = useNavigation();
|
|
35
30
|
|
|
36
|
-
const
|
|
31
|
+
const translateY = useRef(new Animated.Value(-20)).current;
|
|
37
32
|
const opacity = useRef(new Animated.Value(0)).current;
|
|
38
33
|
|
|
39
34
|
useEffect(() => {
|
|
40
|
-
Animated.
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
35
|
+
Animated.parallel([
|
|
36
|
+
Animated.spring(translateY, {
|
|
37
|
+
toValue: 0,
|
|
38
|
+
stiffness: 120,
|
|
39
|
+
damping: 14,
|
|
40
|
+
useNativeDriver: true,
|
|
41
|
+
}),
|
|
42
|
+
Animated.timing(opacity, {
|
|
43
|
+
toValue: 1,
|
|
44
|
+
duration: 250,
|
|
45
|
+
useNativeDriver: true,
|
|
46
|
+
}),
|
|
47
|
+
]).start();
|
|
48
|
+
}, []); // ✅ RUN ONCE ONLY
|
|
49
|
+
|
|
52
50
|
return (
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
{
|
|
64
|
-
paddingTop: Constants.statusBarHeight + 8,
|
|
65
|
-
},
|
|
66
|
-
]}
|
|
67
|
-
>
|
|
51
|
+
<Animated.View
|
|
52
|
+
style={[
|
|
53
|
+
tw`bg-white`,
|
|
54
|
+
{
|
|
55
|
+
opacity,
|
|
56
|
+
transform: [{ translateY }],
|
|
57
|
+
},
|
|
58
|
+
]}
|
|
59
|
+
>
|
|
60
|
+
<View style={tw`flex-row items-center px-4 py-3`}>
|
|
68
61
|
{/* LEFT ICON */}
|
|
69
|
-
{hideBackBtn
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
62
|
+
{!hideBackBtn && (
|
|
63
|
+
<TouchableOpacity
|
|
64
|
+
activeOpacity={0.6}
|
|
65
|
+
onPress={
|
|
66
|
+
menuButton
|
|
67
|
+
? () => navigation.openDrawer()
|
|
68
|
+
: () => navigation.goBack()
|
|
69
|
+
}
|
|
70
|
+
style={tw`p-1`}
|
|
71
|
+
>
|
|
73
72
|
{menuButton ? (
|
|
74
|
-
<
|
|
75
|
-
activeOpacity={0.6}
|
|
76
|
-
onPress={() => navigation?.openDrawer()}
|
|
77
|
-
>
|
|
78
|
-
<EIconMenu size={24} style={tw`text-slate-800`} />
|
|
79
|
-
</TouchableOpacity>
|
|
73
|
+
<EIconMenu size={24} style={tw`text-slate-800`} />
|
|
80
74
|
) : (
|
|
81
|
-
<
|
|
82
|
-
activeOpacity={0.6}
|
|
83
|
-
onPress={() => navigation.goBack()}
|
|
84
|
-
style={tw`p-1`}
|
|
85
|
-
>
|
|
86
|
-
<EIconArrowLeft
|
|
87
|
-
iconColor={curved ? "white" : "tint-slate-900"}
|
|
88
|
-
size={24}
|
|
89
|
-
style={tw`text-slate-800`}
|
|
90
|
-
/>
|
|
91
|
-
</TouchableOpacity>
|
|
75
|
+
<EIconArrowLeft size={24} style={tw`text-slate-800`} />
|
|
92
76
|
)}
|
|
93
|
-
</
|
|
77
|
+
</TouchableOpacity>
|
|
94
78
|
)}
|
|
79
|
+
|
|
95
80
|
{/* TITLE */}
|
|
96
|
-
<View style={tw`flex-1
|
|
81
|
+
<View style={tw`flex-1 px-3`}>
|
|
97
82
|
<EText
|
|
98
83
|
size="base"
|
|
99
|
-
style={tw.style("text-slate-700 font-bold")}
|
|
100
84
|
numberOfLines={1}
|
|
85
|
+
style={tw`font-bold text-slate-800`}
|
|
101
86
|
>
|
|
102
87
|
{title}
|
|
103
88
|
</EText>
|
|
104
|
-
{subtitle
|
|
105
|
-
<EText
|
|
106
|
-
|
|
107
|
-
"text-slate-700 opacity-40 font-semibold mt-0.25"
|
|
108
|
-
)}
|
|
109
|
-
>
|
|
110
|
-
{subtitle}
|
|
111
|
-
</EText>
|
|
112
|
-
) : null}
|
|
89
|
+
{subtitle && (
|
|
90
|
+
<EText style={tw`text-xs text-slate-400 mt-0.5`}>{subtitle}</EText>
|
|
91
|
+
)}
|
|
113
92
|
</View>
|
|
114
93
|
|
|
115
94
|
{/* RIGHT ICON */}
|
|
116
|
-
{iconEnd
|
|
95
|
+
{iconEnd && <View>{iconEnd}</View>}
|
|
117
96
|
</View>
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
97
|
+
|
|
98
|
+
{children && <View style={tw`pb-4`}>{children}</View>}
|
|
99
|
+
</Animated.View>
|
|
121
100
|
);
|
|
122
101
|
}
|
|
@@ -1,16 +1,12 @@
|
|
|
1
|
-
import { View, Dimensions, ScrollView, Platform } from "react-native";
|
|
2
1
|
import React, { JSX } from "react";
|
|
2
|
+
import { View, ScrollView } from "react-native";
|
|
3
3
|
import { useSafeAreaInsets } from "react-native-safe-area-context";
|
|
4
|
-
import tw from "../lib/tailwind";
|
|
5
4
|
import { StatusBar } from "expo-status-bar";
|
|
5
|
+
import tw from "../lib/tailwind";
|
|
6
6
|
import { PageHeader } from ".";
|
|
7
|
-
import Constants from "expo-constants";
|
|
8
|
-
import { useNavigation } from "@react-navigation/native";
|
|
9
7
|
|
|
10
|
-
const
|
|
11
|
-
const
|
|
12
|
-
const HEADER_HEIGHT = Constants.statusBarHeight + 60;
|
|
13
|
-
const SCROLL_PADDING_BOTTOM = 100;
|
|
8
|
+
const HEADER_HEIGHT = 72;
|
|
9
|
+
const SCROLL_PADDING_BOTTOM = 120;
|
|
14
10
|
|
|
15
11
|
interface BaseLayoutProps {
|
|
16
12
|
title: string;
|
|
@@ -23,7 +19,6 @@ interface BaseLayoutProps {
|
|
|
23
19
|
bottomButton?: JSX.Element;
|
|
24
20
|
border?: boolean;
|
|
25
21
|
menuButton?: boolean;
|
|
26
|
-
paddingTop?: number;
|
|
27
22
|
hideBackBtn?: boolean;
|
|
28
23
|
scrollViewRef?: any;
|
|
29
24
|
}
|
|
@@ -39,78 +34,63 @@ export default function SecondaryBaseLayout({
|
|
|
39
34
|
bottomButton,
|
|
40
35
|
border,
|
|
41
36
|
menuButton,
|
|
42
|
-
paddingTop,
|
|
43
37
|
hideBackBtn,
|
|
44
38
|
scrollViewRef,
|
|
45
39
|
}: BaseLayoutProps) {
|
|
46
40
|
const insets = useSafeAreaInsets();
|
|
47
41
|
|
|
48
|
-
const
|
|
42
|
+
const topOffset = insets.top + HEADER_HEIGHT;
|
|
49
43
|
|
|
50
44
|
return (
|
|
51
|
-
<View
|
|
52
|
-
style=
|
|
53
|
-
tw`flex-1 bg-white`,
|
|
54
|
-
{
|
|
55
|
-
paddingBottom: Platform.OS === "ios" ? insets.bottom : 0,
|
|
56
|
-
paddingTop:
|
|
57
|
-
Platform.OS === "ios"
|
|
58
|
-
? paddingTop
|
|
59
|
-
? paddingTop
|
|
60
|
-
: 44
|
|
61
|
-
: paddingTop
|
|
62
|
-
? paddingTop
|
|
63
|
-
: 24,
|
|
64
|
-
},
|
|
65
|
-
]}
|
|
66
|
-
>
|
|
67
|
-
<StatusBar style="dark" animated />
|
|
45
|
+
<View style={tw`flex-1 bg-white`}>
|
|
46
|
+
<StatusBar style="dark" />
|
|
68
47
|
|
|
69
|
-
{/* HEADER */}
|
|
48
|
+
{/* FIXED HEADER */}
|
|
70
49
|
<View
|
|
71
50
|
style={[
|
|
72
|
-
tw`absolute top-0
|
|
73
|
-
|
|
74
|
-
}`,
|
|
51
|
+
tw`absolute top-0 left-0 right-0 z-50 bg-white`,
|
|
52
|
+
{ paddingTop: insets.top },
|
|
75
53
|
]}
|
|
76
54
|
>
|
|
77
55
|
<PageHeader
|
|
78
|
-
border={border}
|
|
79
56
|
title={title}
|
|
80
57
|
subtitle={subtitle}
|
|
81
58
|
curved={curved}
|
|
82
59
|
iconEnd={iconEnd}
|
|
60
|
+
border={border}
|
|
83
61
|
menuButton={menuButton}
|
|
84
62
|
hideBackBtn={hideBackBtn}
|
|
85
63
|
>
|
|
86
64
|
{headerContent}
|
|
87
65
|
</PageHeader>
|
|
88
66
|
</View>
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
67
|
+
|
|
68
|
+
{/* CONTENT */}
|
|
69
|
+
{noScroll ? (
|
|
70
|
+
<View style={{ marginTop: topOffset, flex: 1 }}>{children}</View>
|
|
71
|
+
) : (
|
|
72
|
+
<ScrollView
|
|
73
|
+
ref={scrollViewRef}
|
|
74
|
+
contentContainerStyle={{
|
|
75
|
+
paddingTop: topOffset,
|
|
76
|
+
paddingBottom: SCROLL_PADDING_BOTTOM,
|
|
77
|
+
}}
|
|
78
|
+
showsVerticalScrollIndicator={false}
|
|
79
|
+
>
|
|
80
|
+
{children}
|
|
81
|
+
</ScrollView>
|
|
82
|
+
)}
|
|
83
|
+
|
|
84
|
+
{/* FIXED BOTTOM BUTTON */}
|
|
85
|
+
{bottomButton && (
|
|
104
86
|
<View
|
|
105
87
|
style={[
|
|
106
|
-
tw` px-4 `,
|
|
107
|
-
{
|
|
88
|
+
tw`absolute left-0 right-0 bg-white px-4 pt-3`,
|
|
89
|
+
{ bottom: insets.bottom },
|
|
108
90
|
]}
|
|
109
91
|
>
|
|
110
92
|
{bottomButton}
|
|
111
93
|
</View>
|
|
112
|
-
) : (
|
|
113
|
-
<></>
|
|
114
94
|
)}
|
|
115
95
|
</View>
|
|
116
96
|
);
|