Added tweak to announcements and json for url of CMS

This commit is contained in:
M10T 2020-08-13 18:55:10 -04:00
parent 4b14f130cc
commit e663cc9a95
6 changed files with 18 additions and 11 deletions

View File

@ -18,10 +18,15 @@ import {
} from 'react-native/Libraries/NewAppScreen'; } from 'react-native/Libraries/NewAppScreen';
import styles from './styles/liststyles' import styles from './styles/liststyles'
import { url } from './resources/fetchInfo.json'
const Announcement = ({item}) => { const Announcement = ({item}) => {
const date = new Date
const dateStr = `${date.getMonth()+1}/${date.getUTCDate()}/${date.getFullYear()}`
const dateInfo = dateStr===item.item.date&&item.item.time!==undefined?item.item.time:item.item.date;
return ( return (
<View style={styles.item}> <View style={styles.item}>
{dateInfo!==undefined?<Text style={styles.date}>{dateInfo}</Text>:<></>}
<Text style={styles.title}>{item.item.message}</Text> <Text style={styles.title}>{item.item.message}</Text>
</View> </View>
) )
@ -37,7 +42,7 @@ class Announcements extends React.Component {
} }
componentDidMount() { componentDidMount() {
fetch('https://6dc2642ae9b3.ngrok.io/api/en/announcements',{ fetch(`${url}/api/en/announcements`,{
headers: { headers: {
'Cache-Control': 'no-cache' 'Cache-Control': 'no-cache'
} }

View File

@ -1,11 +1,3 @@
/**
* Sample React Native App
* https://github.com/facebook/react-native
*
* @format
* @flow strict-local
*/
import React from 'react'; import React from 'react';
import { import {
SafeAreaView, SafeAreaView,

View File

@ -20,6 +20,7 @@ import {
} from 'react-native/Libraries/NewAppScreen'; } from 'react-native/Libraries/NewAppScreen';
import { SearchBar } from 'react-native-elements'; import { SearchBar } from 'react-native-elements';
import styles from './styles/liststyles' import styles from './styles/liststyles'
import { url } from './resources/fetchInfo.json'
const ClubElement = ({item}) => { const ClubElement = ({item}) => {
const [visible, setVisible] = useState(0) const [visible, setVisible] = useState(0)
@ -49,7 +50,7 @@ class Clubs extends React.Component {
componentDidMount() { componentDidMount() {
fetch('https://6dc2642ae9b3.ngrok.io/api/en/clubs',{ fetch(`${url}/api/en/clubs`,{
headers: { headers: {
'Cache-Control': 'no-cache' 'Cache-Control': 'no-cache'
} }) } })

View File

@ -19,6 +19,7 @@ import {
} from 'react-native/Libraries/NewAppScreen'; } from 'react-native/Libraries/NewAppScreen';
import styles from './styles/liststyles' import styles from './styles/liststyles'
import { url } from './resources/fetchInfo.json'
const LunchEvent = ({item}) => { const LunchEvent = ({item}) => {
const [visible, setVisible] = useState(0) const [visible, setVisible] = useState(0)
@ -43,7 +44,7 @@ class LunchEvents extends React.Component {
} }
componentDidMount() { componentDidMount() {
fetch('https://6dc2642ae9b3.ngrok.io/api/en/lunchEvents',{ fetch(`${url}/api/en/lunchEvents`,{
headers: { headers: {
'Cache-Control': 'no-cache' 'Cache-Control': 'no-cache'
} }

View File

@ -0,0 +1 @@
{"url":"http://10.0.2.2:5000"}

View File

@ -14,6 +14,13 @@ const styles = StyleSheet.create({
title: { title: {
fontSize: 32, fontSize: 32,
}, },
date: {
fontSize:12,
marginBottom:'-3%',
alignSelf:'flex-end',
marginTop:'-3%',
marginRight:'-3%'
}
}); });
export default styles; export default styles;