Advertisement
Guest User

Untitled

a guest
Jun 22nd, 2017
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.37 KB | None | 0 0
  1. mport React, { Component } from 'react';
  2. import { Alert, AppRegistry, Platform, StyleSheet, Text, TouchableNativeFeedback, TouchableWithoutFeedback, View } from 'react-native';
  3.  
  4. class Button extends Component {
  5. constructor(props) {
  6. super(props);
  7. this.state = {status: "-"};
  8. }
  9. // _onPressButton(num) {
  10. // this.state.board[num] =
  11. // }
  12. render() {
  13. <View style={styles.button}>
  14. <Text style={styles.buttonText}>TouchableWithoutFeedback</Text>
  15. </View>
  16. }
  17. }
  18.  
  19. export default class Board extends Component {
  20. constructor(props) {
  21. super(props);
  22. this.state = {board: Array(9).fill("-"), turn: false};
  23. }
  24. _onPressButton(num, status, turn) {
  25. if (status == "-") {
  26. newStatus = turn
  27. this.setState( () => {
  28. return { board[num]: turn, turn: !turn }
  29. })
  30. }
  31. this.state.board[num] =
  32. }
  33. render() {
  34. return (
  35. <View>
  36. </View>
  37. );
  38. }
  39. }
  40.  
  41. const styles = StyleSheet.create({
  42. container: {
  43. paddingTop: 60,
  44. alignItems: 'center'
  45. },
  46. button: {
  47. marginBottom: 30,
  48. width: 100,
  49. height: 100,
  50. alignItems: 'center',
  51. backgroundColor: '#2196F3'
  52. },
  53. buttonText: {
  54. fontSize: 50,
  55. padding: 20,
  56. color: 'white',
  57. alignText: 'center',
  58. fontWeight: 'bold',
  59. }
  60. })
  61.  
  62. // skip this line if using Create React Native App
  63. AppRegistry.registerComponent('TicTacToe', () => TicTacToe);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement