





Prepara tus exámenes y mejora tus resultados gracias a la gran cantidad de recursos disponibles en Docsity
Gana puntos ayudando a otros estudiantes o consíguelos activando un Plan Premium
Esta página no es visible en la vista previa
¡No te pierdas las partes importantes!






import React, { Component } from 'react'; import { View, Text, StyleSheet, Button } from 'react-native'; export default class calculadora extends Component { constructor(props) { super(props); this.state = { resultado: '', temp: '', bandera: '0', }; } render() { const clickbtn1 = () => { this.setState({resultado: this.state.resultado+1}); }; const clickbtn2 = () => { this.setState({resultado: this.state.resultado+2}); }; const clickbtn3 = () => { this.setState({resultado: this.state.resultado+3}); }; const clickbtn4 = () => { this.setState({resultado: this.state.resultado+4}); }; const clickbtn5 = () => { this.setState({resultado: this.state.resultado+5}); };
const clickbtn6 = () => { this.setState({resultado: this.state.resultado+6}); }; const clickbtn7 = () => { this.setState({resultado: this.state.resultado+7}); }; const clickbtn8 = () => { this.setState({resultado: this.state.resultado+8}); }; const clickbtn9 = () => { this.setState({resultado: this.state.resultado+9}); }; const clickbtn0 = () => { this.setState({resultado: this.state.resultado+0}); }; const clickbtnsuma = () => { this.setState({temp: this.state.resultado}); this.setState({resultado:''}); this.setState({bandera: '1'}) }; const clickbtnresta = () => { this.setState({temp: this.state.resultado}); this.setState({resultado:''}); this.setState({bandera: '2'}) }; const clickbtnmult = () => { this.setState({temp: this.state.resultado}); this.setState({resultado:''}); this.setState({bandera: '3'})
return (
height:50, width:50, marginLeft:230, marginTop:-50, }, btn4:{ height:50, width:50, marginLeft:50, marginTop:20, }, btn5:{ height:50, width:50, marginLeft:110, marginTop:-50, }, btn6:{ height:50, width:50, marginLeft:170, marginTop:-50, }, btnsuma:{ height:50, width:50, marginLeft:230, marginTop:-50, },
btn7:{ height:50, width:50, marginLeft:50, marginTop:20, }, btn8:{ height:50, width:50, marginLeft:110, marginTop:-50, }, btn9:{ height:50, width:50, marginLeft:170, marginTop:-50, }, btnresta:{ height:50, width:50, marginLeft:230, marginTop:-50, }, btn0:{ height:50, width:50, marginLeft:50, marginTop:20,