-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCourse.js
123 lines (111 loc) · 3.89 KB
/
Course.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
117
118
119
120
121
122
123
import React, { Component } from 'react';
import { Image, keyboard, AsyncStorage, Linking, Dimensions, StyleSheet, StatusBar, TouchableOpacity } from 'react-native';
import { Container, Text, Header, View, Button, Icon, Fab, Tab, Tabs, ScrollableTab, Left, Right, Body, Title, Subtitle } from 'native-base';
import Tab1 from './Projects';
import Tab2 from './Issues';
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 Course extends Component {
constructor(props) {
super(props);
this.state = {
active: false,
tag:'Course',
};
}
_retrieveData = async () => {
try{
const useruid = await AsyncStorage.getItem('userid').then((value) => {
this.checkUser();
});
}
catch(err){
console.log('Profile Page store error: '+err);
}
};
checkUser = async ()=>{
try{
const useruid = await AsyncStorage.getItem('userid');
if (useruid!==null) {
}
else{
this.props.navigation.replace("Login");
}
}
catch(err){
console.log('Profile Page store error: '+err);
}
}
async componentDidMount() {
this._retrieveData();
await this.setState({tag:this.props.route.params.tag});
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>
{/* <View style={styles.myHeader}>
<Text style={styles.headerText}>Arduino</Text>
</View> */}
<Header style={{backgroundColor:'#0099ff'}} androidStatusBarColor='#0099ff'>
<Left>
<Button transparent onPress={()=>{this.props.navigation.goBack()}}>
<Icon name='arrow-back' />
</Button>
</Left>
<Body>
<Title>{this.state.tag}</Title>
</Body>
<Right />
</Header>
<Tabs renderTabBar={()=> <ScrollableTab />}>
<Tab heading="PROJECTS" tabStyle={{ backgroundColor: "#0099ff"}} activeTabStyle={{ backgroundColor: "#0099ff", flex:2}}>
<Tab1 tag={this.props.route.params.tag} navigation={this.props.navigation}/>
</Tab>
<Tab heading="DISSCUSSIONS" tabStyle={{ backgroundColor: "#0099ff"}} activeTabStyle={{ backgroundColor: "#0099ff", flex:2 }}>
<Tab2 tag={this.props.route.params.tag} navigation={this.props.navigation}/>
</Tab>
</Tabs>
<View>
<Fab
active={this.state.active}
direction="up"
containerStyle={{}}
style={{ backgroundColor: '#0099ff' }}
position="bottomRight"
onPress={() => this.setState({ active: !this.state.active })}>
<Icon name="add" />
<Button style={{ backgroundColor: '#34A34F' }} onPress={()=>{this.props.navigation.navigate("Querypost",{tag:this.state.tag})}}>
<Icon name="query" />
</Button>
<Button style={{ backgroundColor: '#DD5144' }} onPress={()=>{Linking.openURL('https://mandawamart.com/roboclub/web/index.php')}}>
<Icon name="book" />
</Button>
</Fab>
</View>
</Container>
);
}
}
const styles = StyleSheet.create({
myHeader:{
height:60,
backgroundColor:'#0099FF',
justifyContent:'center',
padding:15,
marginTop:25,
},
headerText:{
fontSize:25,
fontWeight:'bold',
color:'#fff',
},
})