-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathEvent.js
106 lines (94 loc) · 3.46 KB
/
Event.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
import React, { Component } from "react";
import { Image, keyboard, Linking, AsyncStorage, Dimensions, StyleSheet, StatusBar, TouchableOpacity } from 'react-native';
import { Container, Header, Content, Title, Spinner, Card,Item, Input, CardItem, Text, Body, View, Fab, Left, Right, Button, Icon, List, ListItem, Thumbnail } from "native-base";
import * as Font from 'expo-font';
import { Ionicons } from '@expo/vector-icons';
import api from './DbConfig';
StatusBar.setBackgroundColor('#0099ff',true);
const {width, height} = Dimensions.get("window");
export default class Event extends Component {
constructor(props) {
super(props);
this.state = {
btnsnipper:1,
showfeed:[],
caption:'',
searchproject:'',
};
}
allprojectfeed=()=>{
var InsertAPI = api+'allevents.php';
var headers={
'Accept':'application/json',
'Content-Type':'application.json'
}
fetch(InsertAPI,{
method:'POST',
headers:headers,
}).then((response)=>response.json()).then((response)=>{
if(response===null){
this.setState({caption:'No feed to show'});
this.setState({btnsnipper:0});
}
else{
this.setState({showfeed:response});
this.setState({btnsnipper:0});
}
})
.catch(err=>{
alert('Something went wrong');
this.setState({feedLoading:0});
})
}
linkAction=(link, active)=>{
if(active==0){
alert('Link will available on event time.');
}
else{
Linking.openURL(link);
}
}
async componentDidMount() {
this.allprojectfeed();
await Font.loadAsync({
'Roboto': require('native-base/Fonts/Roboto.ttf'),
'Roboto_medium': require('native-base/Fonts/Roboto_medium.ttf'),
...Ionicons.font,
})
this.setState({ loading: false })
}
render() {
return (
<Container>
<Header style={{backgroundColor:'#0099ff'}} androidStatusBarColor='#0099ff'>
<Left>
<Button transparent onPress={()=>{this.props.navigation.goBack()}}>
<Icon name='arrow-back' />
</Button>
</Left>
<Body>
<Title>EVENTS</Title>
</Body>
<Right />
</Header>
{this.state.btnsnipper==0?
<View>
{this.state.showfeed==null?
<Text style={{textAlign:'center', marginTop:50}}>No Event found !</Text>:<List dataArray={this.state.showfeed} renderRow={(item) =>
<ListItem thumbnail onPress={()=>this.linkAction(item.link, item.link_active)}>
<Left>
<Thumbnail source={require('./assets/projectlogo.png')}
style={{resizeMode:'contain'}} />
</Left>
<Body>
<Text numberOfLines={2}>{item.event}</Text>
<Text note>Time: {item.time} and Date: {item.date}</Text>
</Body>
</ListItem>}/>}
</View>:<Thumbnail source={require('./assets/searchprofile.gif')}
style={{height:height/3,width:width, resizeMode:'contain'}}
/>}
</Container>
);
}
}