Last active
August 26, 2022 17:17
-
-
Save alexjosesilva/f8a71222c7ca3ff506fc13e67364cfd6 to your computer and use it in GitHub Desktop.
#App1: Gerar números Aleatórios com React Native
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Sessão 6 | |
* #App1: Gerar numero aleatorios | |
* Alex Jose | |
*/ | |
import React from 'react'; | |
import { Text, View, Button, AppRegistry } from 'react-native'; | |
const geraNumeroAleatorio = () => { | |
var numero_aleatorio = Math.random(); | |
numero_aleatorio = Math.floor(numero_aleatorio * 10); | |
alert(numero_aleatorio); | |
} | |
const App = () => { | |
return ( | |
<View> | |
<Text>Gerador numero</Text> | |
<Button | |
title="Gerar numero" | |
onPress={geraNumeroAleatorio} | |
/> | |
</View> | |
); | |
}; | |
AppRegistry.registerComponent('App1', () => App); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
como faço para determinar qual numero eu quero atraves da propria tela? preciso receber dois valores e calculalos