import React from 'react'; import { Content, Card, CardItem, Body, Text, Button } from 'native-base'; import { Image, ScrollView } from 'react-native'; import { connect } from 'react-redux'; import { startSession} from '../state/ActionCreators'; function HomeView(props) { const buttonText = props.running ? "View Swim Session" : "Start swimming"; const onButtonPress = () => { if(!props.running) { props.dispatch(startSession()); } props.navigation.navigate('Training') }; return ( ); } const mapStateToProps = (state) => { return { running: state.session.running }; }; export default connect(mapStateToProps)(HomeView);