123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120 |
- import { StatusBar } from 'expo-status-bar';
- import React from 'react';
- import { View, Image, StyleSheet, Text, Button, ScrollView } from 'react-native';
- import data from './transfer.json'
-
-
-
-
- //change this to an external css file later
- const styles = StyleSheet.create({
-
- buttons: {
- flexDirection: 'row',
- justifyContent: 'center',
- marginTop: 30
- },
- container: {
- flexDirection: 'column',
- justifyContent: 'center',
- backgroundColor: 'black',
- alignItems: 'center',
- justifyContent: 'center',
- marginTop: 20
- },
- intro: {
- fontWeight: "bold",
- color:"#beb2c8",
- fontSize: 30,
-
- },
- sub: {
- color:"#D7D6D6",
- fontSize: 20,
- },
- scrollView:{
- marginHorizontal: 20
- }
- });
-
- //default button press
-
- const handlePress = () => false
-
-
- //data parsing goes here
-
- function importJSON() {
- var stuff = JSON.stringify(data)
- return stuff
- }
-
- //states
-
- let states = {
- welcome:
-
- <View style = {styles.container}>
-
-
- <Text style={styles.intro}>WELCOME!!!!</Text>
-
- <Text style={styles.sub}>オレノウタヲキケ!</Text>
-
- <Image source={require('./testimg.gif')} />
-
- </View>,
-
- dataView:
-
- <ScrollView style={styles.scrollView}>
- <View style = {styles.container}>
-
-
- <Text style={styles.intro}>DATADATADATADATADATA</Text>
-
- <Text style={styles.sub}>{importJSON()}</Text>
-
- <Image source={require('./testimg.gif')} />
-
- </View>
- </ScrollView>
- }
-
-
-
- class App extends React.Component {
-
- //current state
- state = {current: states.welcome}
-
- //state changing functions
- setHome = () => this.setState({ current: states.welcome })
- setData = () => this.setState({ current: states.dataView })
-
-
- //render app
- render() {
- return (
- <View>
- <View style = {styles.buttons}>
- <Button
- onPress = {this.setHome}
- title = "Noticias"
- color = "blue"
- />
-
- <Button
- onPress = {this.setData}
- title = "Datos"
- color = "black"
- />
- </View>
- {this.state.current}
- </View>
- );
- }
- }
-
-
- export default App
|