import React from "react"; import { StyleSheet, View, StatusBar, Text, TouchableOpacity } from "react-native"; import themeColors from '../components/themeColors'; import EntypoIcon from "react-native-vector-icons/Entypo"; import { connect } from 'react-redux'; import { useKeepAwake } from 'expo-keep-awake'; import { stopSession } from '../state/DeviceReduxCoupling'; import CycleView from '../components/CycleView'; import IconCard from '../components/IconCard'; import Graph from '../components/Graph'; import {toTimeStr} from '../utility/TimeUtils'; function SmallHeaderView(props) { return ( props.navigation.goBack()}> {props.text} ) } const smallHeaderStyles = StyleSheet.create({ container: { flex: 1, minHeight: 80, maxHeight: 80, height: 80, width: "100%", backgroundColor: themeColors["WET ASPHALT"], }, row: { paddingTop: 30, flexDirection: "row", justifyContent: "space-between", }, backIcon: { color: "white", fontSize: 40, }, stopIcon: { color: themeColors["ALIZARIN"], fontSize: 40, paddingRight: 10, paddingLeft: 10, }, text: { color: "white", fontSize: 30, }, }); // --------------------------------------------------------------------------------------------- function TrainingView(props) { useKeepAwake(); const analysis = props.session.analysis; const laps = (analysis.peaks.size / props.peaksPerLap).toFixed(1); const totalMomentum = Math.trunc(analysis.totalMomentum * props.kgFactor / 10 / 60); const onStopPressed = () => { props.dispatch(stopSession()); props.navigation.navigate('Home'); }; return ( ) } const trainingViewStyles = StyleSheet.create({ container: { flex: 1, backgroundColor: themeColors["BELIZE HOLE"], padding: 20, justifyContent: "space-around", } }); const mapStateToProps = (state) => { return { session: state.deviceState, peaksPerLap: state.settings.analysis.peaksPerLap, theme: state.settings.theme, kgFactor: state.settings.analysis.kgFactor, }; }; export default connect(mapStateToProps)(TrainingView);