diff --git a/App/App.js b/App/App.js index bee3033b3..017eb645f 100644 --- a/App/App.js +++ b/App/App.js @@ -1,8 +1,8 @@ import React, { Component } from 'react' -import HomeScreen from 'App/Containers/HomeScreen' import { Provider } from 'react-redux' import { PersistGate } from 'redux-persist/lib/integration/react' import createStore from 'App/Stores' +import ExampleScreen from './Containers/Example/ExampleScreen' const { store, persistor } = createStore() @@ -21,7 +21,7 @@ export default class App extends Component { * @see https://github.com/rt2zz/redux-persist/blob/master/docs/PersistGate.md */} - + ) diff --git a/App/Containers/Example/ExampleScreen.js b/App/Containers/Example/ExampleScreen.js new file mode 100644 index 000000000..19c300bc8 --- /dev/null +++ b/App/Containers/Example/ExampleScreen.js @@ -0,0 +1,58 @@ +import React from 'react' +import { Platform, Text, View, Button } from 'react-native' +import { connect } from 'react-redux' +import { PropTypes } from 'prop-types' +import ExampleActions from 'App/Stores/Example/Actions' +import { isHot } from 'App/Stores/Example/Selectors' +import Style from './ExampleScreenStyle' + +const instructions = Platform.select({ + ios: 'Press Cmd+R to reload,\nCmd+D or shake for dev menu.', + android: 'Double tap R on your keyboard to reload,\nShake or press menu button for dev menu.', +}) + +class ExampleScreen extends React.Component { + componentDidMount() { + this.props.fetchTemperature() + } + + render() { + let temperature = this.props.temperatureIsLoading ? '...' : this.props.temperature + if (temperature === null) { + temperature = '??' + } + + return ( + + Welcome to React Native! + To get started, edit App.js + {instructions} + The weather temperature is: {temperature} + {this.props.isHot ? "It's pretty hot!" : ''} + {this.props.temperatureErrorMessage} +