-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathApp.js
77 lines (66 loc) · 2.35 KB
/
App.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
import React from "react";
import { StyleSheet, View, Animated } from "react-native";
import { StatusBar } from "expo-status-bar";
import AppLoading from "expo-app-loading";
import { useFonts, Nunito_400Regular, Nunito_300Light } from "@expo-google-fonts/nunito";
import ProductList from "./components/ProductList";
import { SafeAreaProvider } from "react-native-safe-area-context";
import SafeAreaView from "react-native-safe-area-view";
export default function App() {
const AnimatedHeaderValue = new Animated.Value(0);
const AnimateHeaderBackgroundColor = AnimatedHeaderValue.interpolate({
inputRange: [0, Header_Maximum_Height - Header_Minimum_Height],
outputRange: ["#000", "#000"],
extrapolate: "clamp",
});
const AnimateHeaderHeight = AnimatedHeaderValue.interpolate({
inputRange: [0, Header_Maximum_Height - Header_Minimum_Height],
outputRange: [Header_Maximum_Height, Header_Minimum_Height],
extrapolate: "clamp",
});
const AnimateHeaderFontSize = AnimatedHeaderValue.interpolate({
inputRange: [0, Header_Maximum_Height - Header_Minimum_Height],
outputRange: [34, 22],
extrapolate: "clamp",
});
let [fontsLoaded] = useFonts({
Nunito_400Regular,
Nunito_300Light,
});
if (!fontsLoaded) {
return <AppLoading />;
} else
return (
<SafeAreaProvider>
<SafeAreaView style={styles.container} forceInset={{ top: "always" }}>
<View style={styles.container}>
<StatusBar style="light" />
<ProductList AnimatedHeaderValue={AnimatedHeaderValue} Header_Maximum_Height={Header_Maximum_Height} />
<Animated.View style={[styles.HeaderStyle, { height: AnimateHeaderHeight, backgroundColor: AnimateHeaderBackgroundColor }]}>
<Animated.Text style={[styles.headerTitle, { fontSize: AnimateHeaderFontSize }]}> Comparar Preços </Animated.Text>
</Animated.View>
</View>
</SafeAreaView>
</SafeAreaProvider>
);
}
const Header_Maximum_Height = 300;
const Header_Minimum_Height = 60;
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: "#000",
},
HeaderStyle: {
justifyContent: "center",
alignItems: "center",
position: "absolute",
left: 0,
right: 0,
},
headerTitle: {
textAlign: "center",
color: "#FFF",
fontFamily: "Nunito_300Light",
},
});