2020-08-22 20:01:15 -04:00
|
|
|
import React, { useState } from 'react';
|
2020-08-09 20:56:12 -04:00
|
|
|
import {
|
|
|
|
SafeAreaView,
|
|
|
|
StyleSheet,
|
|
|
|
ScrollView,
|
|
|
|
View,
|
|
|
|
Text,
|
|
|
|
StatusBar,
|
2020-08-22 20:01:15 -04:00
|
|
|
FlatList,
|
|
|
|
TouchableOpacity,
|
2020-10-21 15:35:35 -04:00
|
|
|
Image,
|
2020-08-09 20:56:12 -04:00
|
|
|
} from 'react-native';
|
|
|
|
|
|
|
|
import {
|
|
|
|
Header,
|
|
|
|
LearnMoreLinks,
|
|
|
|
Colors,
|
|
|
|
DebugInstructions,
|
|
|
|
ReloadInstructions,
|
|
|
|
} from 'react-native/Libraries/NewAppScreen';
|
2020-10-21 15:35:35 -04:00
|
|
|
import { NavigationContainer } from '@react-navigation/native'
|
|
|
|
import { createStackNavigator } from '@react-navigation/stack'
|
2020-08-22 20:01:15 -04:00
|
|
|
import styles from './styles/liststyles';
|
|
|
|
import { url } from './resources/fetchInfo.json';
|
|
|
|
|
2020-10-21 15:35:35 -04:00
|
|
|
const Stack = createStackNavigator();
|
|
|
|
|
|
|
|
export const SSLInfo = ({route}) => {
|
|
|
|
const item = route.params;
|
|
|
|
console
|
|
|
|
return (
|
|
|
|
<View style = {{padding: 10}}>
|
|
|
|
<View style ={styles.infoContainer}>
|
|
|
|
<Text style = {styles.title1}>Description: </Text>
|
|
|
|
<Text style = {styles.title}>{item.text}</Text>
|
|
|
|
</View>
|
|
|
|
<View style ={styles.infoContainer}>
|
|
|
|
<Text style = {styles.title1}>Who: </Text>
|
2020-10-25 02:57:39 -04:00
|
|
|
<Text style = {styles.title}>{item.teacher}</Text>
|
2020-10-21 15:35:35 -04:00
|
|
|
</View>
|
|
|
|
<View style ={styles.infoContainer}>
|
|
|
|
<Text style = {styles.title1}>Where: </Text>
|
|
|
|
<Text style = {styles.title}>{item.loc}</Text>
|
|
|
|
</View>
|
|
|
|
</View>
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
|
|
|
function SSLElement (props) {
|
|
|
|
const item = props.item;
|
|
|
|
return(
|
|
|
|
<View>
|
|
|
|
<TouchableOpacity style={styles.item1} onPress={()=>props.navigation.navigate('SSLInfo', {data: props.data, name: item.item.title, text: item.item.text, loc:item.item.loc, teacher: item.item.teacher})} activeOpacity={0.8}>
|
|
|
|
<View style = {{display: 'flex', flexDirection: 'row', alignItems: 'center'}}>
|
|
|
|
<Image source = {require('./assets/sslopps.png')} style = {{height: 40, width: 40, marginRight: 10}}/>
|
|
|
|
<Text style={styles.title}>{item.item.title}</Text>
|
|
|
|
</View>
|
|
|
|
</TouchableOpacity>
|
|
|
|
</View>
|
2020-08-22 20:01:15 -04:00
|
|
|
)
|
|
|
|
}
|
2020-08-09 20:56:12 -04:00
|
|
|
|
|
|
|
class SSLOps extends React.Component {
|
2020-08-22 20:01:15 -04:00
|
|
|
|
|
|
|
constructor(props) {
|
|
|
|
super(props)
|
|
|
|
this.state = {
|
|
|
|
data: []
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
componentDidMount() {
|
|
|
|
fetch(`${url}/api/en/sslOps`,{
|
|
|
|
headers: {
|
|
|
|
'Cache-Control': 'no-cache'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
)
|
|
|
|
.then((response) => {
|
|
|
|
return response.text();
|
|
|
|
})
|
|
|
|
.then((json) => {
|
|
|
|
this.setState({data: JSON.parse(json).ops});
|
|
|
|
})
|
|
|
|
.catch((error) => console.error(error))
|
|
|
|
}
|
|
|
|
|
2020-08-09 20:56:12 -04:00
|
|
|
render() {
|
|
|
|
return (
|
2020-08-22 20:01:15 -04:00
|
|
|
<View style={styles.container}>
|
|
|
|
<FlatList
|
|
|
|
data={this.state.data}
|
2020-10-21 15:35:35 -04:00
|
|
|
renderItem={item=><SSLElement item={item} name={item.title} navigation={this.props.navigation}/>}
|
2020-08-22 20:01:15 -04:00
|
|
|
keyExtractor={item=>JSON.stringify(item)}
|
|
|
|
/>
|
2020-08-09 20:56:12 -04:00
|
|
|
</View>
|
|
|
|
)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-11-06 16:34:17 -05:00
|
|
|
export default SSLOps;
|