-
Notifications
You must be signed in to change notification settings - Fork 0
/
App.tsx
68 lines (62 loc) · 1.84 KB
/
App.tsx
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
import Homescreen from "./src/screens/Homescreen";
import { Dimensions } from "react-native";
import { osName } from "expo-device";
import { useFonts } from "expo-font";
import { Inter_400Regular, Inter_600SemiBold } from "@expo-google-fonts/inter";
import { GrandHotel_400Regular } from "@expo-google-fonts/grand-hotel";
import AppLoading from "expo-app-loading";
const { faker } = require("@faker-js/faker");
export const backgroundColor = "#000000";
export const contentHorizontalSpacing = 8;
export const wcsColor = "#f76c6c";
export const isIOS = osName === "iOS";
export const deviceWidth = Dimensions.get("window").width;
export type IFakeAccount = {
picture: string;
name: string;
seen: boolean;
post: {
sponsored: boolean;
mediaUrl: string;
likes: number;
description: string;
comments: number;
date: number;
};
};
export default function App() {
const [fontsLoaded] = useFonts({
Inter_400Regular,
Inter_600SemiBold,
GrandHotel_400Regular,
});
const fakeData: IFakeAccount[] = [];
const fakeDataCount = 10;
for (let i = 0; i < fakeDataCount; i++) {
const randomBoolean = faker.datatype.boolean();
let newAccountItem: IFakeAccount = {
picture: faker.internet.avatar(),
name: faker.internet.userName(),
seen: randomBoolean,
post: {
sponsored: randomBoolean,
mediaUrl: faker.image.image(500, 500, true),
likes: faker.mersenne.rand(100, 500),
description: faker.lorem.sentences(3),
comments: faker.mersenne.rand(5, 100),
date: faker.mersenne.rand(1, 23),
},
};
fakeData.push(newAccountItem);
}
if (
!fontsLoaded ||
!backgroundColor ||
typeof isIOS === undefined ||
!Dimensions ||
!(fakeData && fakeData.length === 10)
) {
return <AppLoading />;
}
return <Homescreen fakeData={fakeData} />;
}