import React, { Component } from 'react'; import sharedStyles from '../shared-styles'; import { TouchableHighlight, Platform, StyleSheet, Text, View } from 'react-native'; export default class WalkButton extends Component { constructor(props) { super(props); this.start = this.props.start; this.stop = this.props.stop; this.state = { value: this.props.value, activeWalk: false, buttonText: "Start Capture", buttonColour: 'rgba(0,255,0,0.5)' }; } formatValue() { return this.state.value; } render() { return ( { if (this.state.activeWalk){ console.log("state true to false") this.setState({ activeWalk: false, buttonText: "Start Capture", buttonColour: 'rgba(0,255,0,0.5)' }) this.start(); }else{ console.log("state false to true") this.setState({ activeWalk: true, buttonText: "Stop Capture", buttonColour: 'rgba(255,0,0,0.5)' }) this.stop() }}} // style={sharedStyles.new} > {this.state.buttonText} ) } }