-
Notifications
You must be signed in to change notification settings - Fork 0
/
App.js
116 lines (80 loc) · 2.85 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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
import React, { Component } from 'react';
import { Container, Header, Title, Content, Footer, FooterTab, Button, Left, Right, Body, Icon, Text, View } from 'native-base';
import H from './Components/Header'
import IconM from 'react-native-vector-icons/MaterialIcons';
import { ActivityIndicator, AsyncStorage } from 'react-native'
import { throwStatement } from '@babel/types';
import { BannerView } from 'react-native-fbads';
export default class App extends Component {
constructor(props) {
super(props)
this.state = {
spinner: false,
ascount: 1,
hasAd:true
}
}
NavigateCategory = (e) => {
this.props.navigation.navigate('QuotesList', {
Name: e,
});
}
spinner = (e) => {
this.setState({ spinner: e })
}
NavigateAuthor = () => {
this.props.navigation.navigate('AuthorList');
}
NavigateFavourite = () => {
this.props.navigation.navigate('Favourite');
}
componentDidMount() {
AsyncStorage.getItem("Favourite").then(data => {
const Dat = data
if (!Dat) {
AsyncStorage.setItem("Favourite", JSON.stringify([]))
}
})
AsyncStorage.getItem("AdFrequency").then(data => {
const Dat = data
if (!Dat) {
AsyncStorage.setItem("AdFrequency",JSON.stringify(false))
}
})
}
drawer = () => {
this.props.navigation.toggleDrawer()
}
render() {
return (
<Container>
<Header style={{ backgroundColor: '#3f51b5' }}>
<Left>
<Button transparent onPress={this.drawer}>
<Icon style={{ color: "#E8EEF8" }} name='menu' />
</Button>
</Left>
<Body>
<Title style={{ color: "#E8EEF8", fontFamily: 'JuliusSansOne-Regular',fontSize:15 }}>Quotes For You</Title>
</Body>
<Right>
{this.state.spinner && <ActivityIndicator size="large" color="#46FC11" animating={this.state.spinner} style={{ marginRight: 10, marginBottom: 5 }} />}
<Button transparent onPress={this.NavigateFavourite} style={{ borderRadius: 30, borderWidth: 1, borderColor: 'white', backgroundColor: 'rgba(82, 15, 169, 0.2)' }}>
<IconM name="favorite" size={30} color="red" borderRadius={15} iconStyle={marginRight = 0} style={{ marginLeft: 2 }} />
</Button>
</Right>
</Header>
<Content style={{ flex: 1, backgroundColor: 'rgba(63, 81, 181,0.9)' }}>
<H NavigateCategory={this.NavigateCategory} NavigateAuthor={this.NavigateAuthor} spinner={this.spinner} />
</Content>
<View>
{this.state.hasAd&&<BannerView
placementId="2349586242028466_2349592102027880"
type="standard"
onError={()=>this.setState({hasAd:false})}
/>}
</View>
</Container>
);
}
}