Permalink
Browse files

Added toggle button.

  • Loading branch information...
dblock committed Jun 28, 2018
1 parent 7445d1f commit 599fd191ff4e2fef4a9aa5e728d172dcd5290420
Showing with 27 additions and 5 deletions.
  1. +27 −5 App.js
32 App.js
@@ -1,13 +1,35 @@
import React from 'react';
import { StyleSheet, Text, View } from 'react-native';
import { StyleSheet, Text, View, Button } from 'react-native';

export default class App extends React.Component {
state = {
isMeetingStarted: false
}

startMeeting() {
this.setState({ isMeetingStarted: true })
}

stopMeeting() {
this.setState({ isMeetingStarted: false })
}

toggleMeeting() {
if (this.state.isMeetingStarted) {
this.stopMeeting();
} else {
this.startMeeting();
}
}

render() {
return (
<View style={styles.container}>
<Text>Open up App.js to start working on your app!</Text>
<Text>Changes you make will automatically reload.</Text>
<Text>Shake your phone to open the developer menu.</Text>
<Text>33 Minutes</Text>
<Button
onPress={() => this.toggleMeeting()}
title={ this.state.isMeetingStarted ? 'Stop Meeting' : 'Start Meeting' }>
</Button>
</View>
);
}
@@ -19,5 +41,5 @@ const styles = StyleSheet.create({
backgroundColor: '#fff',
alignItems: 'center',
justifyContent: 'center',
},
}
});

0 comments on commit 599fd19

Please sign in to comment.