import React, { Component } from 'react' import { AppRegistry, Dimensions, Image, StyleSheet, StatusBar, Text, View } from 'react-native' import { Route, Link, Redirect, withRouter } from 'react-router-dom' const window = Dimensions.get('window') import db from '../db' import Home from '../views/home' import Nav from '../views/nav' import Timeline from '../timeline' import Drone from '../drone' import Livestream from '../views/livestream' import Information from '../views/information' import Contact from '../views/contact' import Credits from '../views/credits' import Privacy from '../views/privacy' import WebViewModal from '../components/webViewModal' import Footer from '../components/footer' import Header from '../components/header' let touchTimeout; class App extends Component { constructor() { super() this.state = { view: 'home', db: db.backup(), visitedTimeline: false, url: '', } // reset to home screen after some period of inactivity this.visitedTimeline = false this.onLinkPress = this.onLinkPress.bind(this) this.onCloseWebViewModal = this.onCloseWebViewModal.bind(this) } onLinkPress(url) { if (url.indexOf('/') === 0) { this.props.history.push(url) } else { global.open(url) } } onCloseWebViewModal() { this.setState({ url: '' }) } render() { return ( { return (
) }}/> ( )}/> ( )}/> { if (! this.visitedTimeline) { setTimeout(() => { this.visitedTimeline = true }, 600) } else if (this.timelineView) { setImmediate( () => this.timelineView.onFilter('') ) } return ( this.timelineView = ref} firstTime={! this.visitedTimeline} content={this.state.db.page['history-of-surveillance']} events={this.state.db.timeline} onLinkPress={this.onLinkPress} {...props} /> ) }}/> ( )}/> ( )}/> ( )}/> ( )}/> ( )}/> ( )}/>