Skip to content

Instantly share code, notes, and snippets.

@alexjosesilva
Last active August 26, 2022 17:17
Show Gist options
  • Save alexjosesilva/f8a71222c7ca3ff506fc13e67364cfd6 to your computer and use it in GitHub Desktop.
Save alexjosesilva/f8a71222c7ca3ff506fc13e67364cfd6 to your computer and use it in GitHub Desktop.
#App1: Gerar números Aleatórios com React Native
/**
* 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);
@joaocarlos4
Copy link

joaocarlos4 commented Aug 26, 2022

como faço para determinar qual numero eu quero atraves da propria tela? preciso receber dois valores e calculalos

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment