Skip to content

Commit f01749a

Browse files
committed
EXPO 37. expo-Fonts. React-navigation for header and drawer
1 parent f03f84a commit f01749a

File tree

99 files changed

+1928
-647
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

99 files changed

+1928
-647
lines changed

.gitignore

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,16 @@
11
node_modules/**/*
22
.expo/*
3-
.idea
43
npm-debug.*
54
*.jks
5+
*.p8
66
*.p12
77
*.key
88
*.mobileprovision
9-
env.js
9+
*.orig.*
10+
web-build/
11+
web-report/
12+
env.*
13+
app.json
14+
15+
# macOS
16+
.DS_Store

App.js

Lines changed: 0 additions & 65 deletions
This file was deleted.

Components/Background.tsx

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
import React from "react";
2+
import { StyleSheet, View } from "react-native";
3+
import { Video } from "expo-av";
4+
5+
export default function Background(props) {
6+
let source = require("../assets/back-blur-3.mp4");
7+
return (
8+
<View style={styles.container}>
9+
<Video
10+
source={source}
11+
rate={1.0}
12+
volume={1.0}
13+
isMuted={false}
14+
resizeMode="cover"
15+
shouldPlay
16+
isLooping
17+
style={styles.backgroundVideo}
18+
/>
19+
{props.children}
20+
</View>
21+
);
22+
}
23+
24+
const styles = StyleSheet.create({
25+
container: {
26+
flex: 1,
27+
// marginTop: 50,
28+
backgroundColor: "transparent"
29+
// alignItems: "stretch",
30+
// justifyContent: "space-between"
31+
},
32+
baseText: {},
33+
backgroundVideo: {
34+
position: "absolute",
35+
top: 0,
36+
left: 0,
37+
bottom: 0,
38+
right: 0,
39+
backgroundColor: "transparent"
40+
}
41+
});

Components/CustomMap.tsx

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
import React from "react";
2+
import { StyleSheet, Dimensions, Image } from "react-native";
3+
import MapView, { Marker, PROVIDER_GOOGLE } from "react-native-maps";
4+
5+
const BlueFlagImg = require("../assets/navPage/flag-pink.png");
6+
const { width, height } = Dimensions.get("window");
7+
const ASPECT_RATIO = width / height;
8+
9+
const region = {
10+
latitude: 31.99246,
11+
longitude: 34.76881,
12+
latitudeDelta: 0.01,
13+
longitudeDelta: 0.01 * ASPECT_RATIO
14+
};
15+
16+
function CustomMap() {
17+
return (
18+
<MapView
19+
provider={PROVIDER_GOOGLE}
20+
region={region}
21+
style={{
22+
...StyleSheet.absoluteFillObject
23+
}}
24+
>
25+
<Marker
26+
coordinate={region}
27+
title="KB-PURE"
28+
description="KB-PURE"
29+
>
30+
<Image
31+
source={BlueFlagImg}
32+
resizeMode="contain"
33+
style={{width: 100, height: 100}}
34+
/>
35+
</Marker>
36+
</MapView>
37+
);
38+
}
39+
40+
export default CustomMap;

Components/KBText.tsx

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import React from "react";
2+
import { Text, StyleSheet } from "react-native";
3+
import { RFPercentage } from "react-native-responsive-fontsize";
4+
5+
const KBText = props => (
6+
<Text adjustsFontSizeToFit {...props} style={[styles.baseText, props.style]}>
7+
{props.children}
8+
</Text>
9+
);
10+
11+
const styles = StyleSheet.create({
12+
baseText: {
13+
fontFamily: "heb-open-sans-regular",
14+
fontSize: RFPercentage(2.7),
15+
textAlign: "center"
16+
}
17+
});
18+
19+
export default KBText;

Components/KBTitle.tsx

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import React from "react";
2+
import { StyleSheet } from "react-native";
3+
import { RFPercentage } from "react-native-responsive-fontsize";
4+
import KBText from "./KBText";
5+
6+
const KBTitle = props => (
7+
<KBText {...props} style={[styles.baseTitle, props.style]}>
8+
{props.children}
9+
</KBText>
10+
);
11+
12+
const styles = StyleSheet.create({
13+
baseTitle: {
14+
fontFamily: "heb-open-sans-bold",
15+
fontSize: RFPercentage(3),
16+
textAlign: "center"
17+
}
18+
});
19+
20+
export default KBTitle;

Components/LoadAssets.tsx

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
import React, { useEffect, useState } from "react";
2+
import { Image } from "react-native";
3+
import { AppLoading } from "expo";
4+
import { Asset } from "expo-asset";
5+
import * as Font from "expo-font";
6+
import { FontAwesome, Ionicons } from "@expo/vector-icons";
7+
8+
function cacheAssetsAsync({ images = [], fonts = [] }) {
9+
return Promise.all([...cacheImages(images), ...cacheFonts(fonts)]);
10+
}
11+
12+
function cacheImages(images) {
13+
return images.map(image => {
14+
if (typeof image === "string") {
15+
return Image.prefetch(image);
16+
} else {
17+
return Asset.fromModule(image).downloadAsync();
18+
}
19+
});
20+
}
21+
22+
function cacheFonts(fonts) {
23+
return fonts.map(font => Font.loadAsync(font));
24+
}
25+
26+
function LoadAssets(props) {
27+
const [isReady, setReady] = useState(false);
28+
29+
useEffect(() => {
30+
async function _cache() {
31+
try {
32+
await cacheAssetsAsync({
33+
images: [
34+
require("../assets/images/logo-large.png"),
35+
require("../assets/images/user.png"),
36+
require("../assets/back-blur-3.mp4"),
37+
require("../assets/kb-icon.png"),
38+
require("../assets/hamburger.png"),
39+
require("../assets/navPage/flag-blue.png"),
40+
require("../assets/navPage/flag-pink.png"),
41+
require("../assets/navPage/waze.png"),
42+
],
43+
fonts: [
44+
FontAwesome.font,
45+
Ionicons.font,
46+
{
47+
"open-sans-bold": require("../assets/Fonts/OpenSans/English/OpenSans-Bold.ttf"),
48+
"open-sans-regular": require("../assets/Fonts/OpenSans/English/OpenSans-Regular.ttf"),
49+
"open-sans-light": require("../assets/Fonts/OpenSans/English/OpenSans-Light.ttf"),
50+
51+
"heb-open-sans-bold": require("../assets/Fonts/OpenSans/Hebrew/OpenSansHebrew-Bold.ttf"),
52+
"heb-open-sans-regular": require("../assets/Fonts/OpenSans/Hebrew/OpenSansHebrew-Regular.ttf"),
53+
"heb-open-sans-light": require("../assets/Fonts/OpenSans/Hebrew/OpenSansHebrew-Light.ttf"),
54+
55+
"heb-condense-open-sans-bold": require("../assets/Fonts/OpenSans/HebrewCondensed/OpenSansHebrewCondensed-Bold.ttf"),
56+
"heb-condense-open-sans-regular": require("../assets/Fonts/OpenSans/HebrewCondensed/OpenSansHebrewCondensed-Regular.ttf"),
57+
"heb-condense-open-sans-light": require("../assets/Fonts/OpenSans/HebrewCondensed/OpenSansHebrewCondensed-Light.ttf"),
58+
}
59+
]
60+
});
61+
} catch (e) {
62+
console.warn(
63+
"There was an error caching assets (see: main.js), perhaps due to a " +
64+
"network timeout, so we skipped caching. Reload the app to try again."
65+
);
66+
console.log(e.message);
67+
} finally {
68+
setReady(true);
69+
}
70+
}
71+
72+
_cache()
73+
return () => {};
74+
}, []);
75+
76+
return isReady ? props.children : <AppLoading/>;
77+
}
78+
79+
export default LoadAssets;

Components/Logo.tsx

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import { Image, StyleSheet, TouchableOpacity, Dimensions } from "react-native";
2+
import React from "react";
3+
4+
const Logo = props => (
5+
<TouchableOpacity style={props.style} onPress={props.onPress}>
6+
<Image
7+
source={require("../assets/images/logo-large.png")}
8+
resizeMode="contain"
9+
style={styles.logo}
10+
/>
11+
</TouchableOpacity>
12+
);
13+
14+
const deviceWidth = Dimensions.get("window").width;
15+
16+
const styles = StyleSheet.create({
17+
logo: {
18+
height: undefined,
19+
width: deviceWidth / 2.8,
20+
aspectRatio: 1,
21+
}
22+
});
23+
24+
export default Logo;

Components/Logout.tsx

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import React, { useEffect } from "react";
2+
3+
import { useStateValue } from "../Utils/State";
4+
5+
function Logout() {
6+
const [state, dispatch] = useStateValue();
7+
console.log("*** state", state);
8+
console.log("*** dispatch", dispatch);
9+
10+
useEffect(() => {
11+
}, []);
12+
return null;
13+
}
14+
export default Logout;

components/MaterialButtonDark.js renamed to Components/MaterialButtonDark.tsx

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,38 @@
1-
import React, { Component } from "react";
2-
import { StyleSheet, TouchableOpacity, Text } from "react-native";
1+
import React from "react";
2+
import { StyleSheet} from "react-native";
3+
import ButtonSpinner from 'react-native-button-spinner';
4+
import KBTitle from "./KBTitle";
35

46
function MaterialButtonDark(props) {
57
return (
6-
<TouchableOpacity style={[styles.container, props.style]} onPress={props.onPress}>
7-
<Text style={styles.caption}>{props.text1 || "BUTTON"}</Text>
8-
</TouchableOpacity>
8+
<ButtonSpinner disabled={false} style={{...styles.container, ...props.style}} onPress={props.onPress}>
9+
<KBTitle style={styles.caption}>{props.text1}</KBTitle>
10+
</ButtonSpinner>
911
);
1012
}
1113

1214
const styles = StyleSheet.create({
1315
container: {
1416
backgroundColor: "#212121",
17+
maxHeight: 100,
1518
flexDirection: "row",
1619
alignItems: "center",
1720
justifyContent: "center",
1821
paddingRight: 16,
1922
paddingLeft: 16,
2023
elevation: 2,
2124
minWidth: 88,
22-
borderRadius: 2,
25+
borderRadius: 20,
2326
shadowOffset: {
2427
height: 1,
2528
width: 0
2629
},
2730
shadowColor: "#000",
2831
shadowOpacity: 0.35,
29-
shadowRadius: 5
32+
shadowRadius: 50,
3033
},
3134
caption: {
3235
color: "#fff",
33-
fontSize: 30,
3436
}
3537
});
3638

Components/Top10.tsx

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import React from 'react';
2+
import KBTitle from "./KBTitle";
3+
import {translated} from "../Utils/Localization";
4+
5+
function Top10(props) {
6+
return (
7+
<KBTitle style={{}}>
8+
{translated("PersonalPage.Top10")}
9+
</KBTitle>
10+
)
11+
}
12+
13+
export default Top10;

0 commit comments

Comments
 (0)