diff --git a/App.js b/App.js index 56421fc..2125c99 100644 --- a/App.js +++ b/App.js @@ -1,12 +1,19 @@ import React, { Component } from 'react'; import { - Platform, - StyleSheet, - Text, - View + Platform, + StyleSheet, + Image, + ListView, + Text, + ScrollView, + TextInput, + TouchableHighlight, + View } from 'react-native'; import RunInfo from './components/run-info'; +import RunInfoNumeric from './components/run-info-num'; + import MapView from 'react-native-maps'; const instructions = Platform.select({ ios: 'Press Cmd+R to reload,\n' + @@ -15,29 +22,87 @@ const instructions = Platform.select({ 'Shake or press menu button for dev menu', }); +{/**/} +{/**/} + type Props = {}; export default class App extends Component { - render() { - return ( - - - {/*Map View*/} - {/**/} - {/**/} - {/**/} - {/**/} - {/**/} - + constructor(props) { + super(props); + + let ds = new ListView.DataSource({rowHasChanged: (a, b) => a !== b}); + this.state = {dataSource: ds.cloneWithRows([ + 'john', 'joel', 'miki', 'iu lol', 'yeeet', + 'john', 'joel', 'miki', 'iu lol', 'yeeet', + 'john', 'joel', 'miki', 'iu lol', 'yeeet', + 'john', 'joel', 'miki', 'iu lol', 'yeeet', + 'john', 'joel', 'miki', 'iu lol', 'yeeet', + ])}; + + setInterval(() => { + // this.distanceInfo.setState({value: Math.random() * 100}); + // this.speedInfo.setState({value: Math.random() * 15}); + // this.directionInfo.setState({value: this.directionInfo.state === 'N' ? 'NW' : 'N'}); + }, 1000); + } + render() { + return ( + } + renderRow={(row) => ( + + + {row} + + )} + /> +// +// this.setState({text})} +// onBlur={() => this.setState({ text: this.state.text.toUpperCase() })} +// /> +// +// this.setState({confirmedText: this.state.text})} +// onLongPress={() => this.setState({confirmedText: this.state.text.toLowerCase()})} +// > +// Press Me +// +// +// +// {this.state.confirmedText} +// +// +// +// +// this.distanceInfo = info} +// /> +// this.speedInfo = info} +// /> +// this.directionInfo = info} +// /> +// +// ); } } diff --git a/components/run-info.js b/components/run-info.js index 9638893..951b578 100644 --- a/components/run-info.js +++ b/components/run-info.js @@ -1,4 +1,5 @@ import React, { Component } from 'react'; +import sharedStyles from '../shared-styles'; import { Platform, StyleSheet, @@ -7,11 +8,22 @@ import { } from 'react-native'; export default class RunInfo extends Component { + constructor(props) { + super(props); + this.state = { value: this.props.value}; + } + + formatValue() { + return this.state.value; + } + render() { + let value = this.state.value ? this.formatValue() : '-'; return ( - - {this.props.title} - {this.props.value} + + {value} + {this.props.title} + ) } diff --git a/package.json b/package.json index ad0ffbb..4716a94 100644 --- a/package.json +++ b/package.json @@ -7,6 +7,7 @@ "test": "jest" }, "dependencies": { + "npm": "^6.4.0", "react": "16.3.1", "react-native": "0.55.4", "react-native-maps": "^0.21.0"