Created
April 5, 2021 20:57
-
-
Save eugenehp/1f103986d3d19fb3985ecaf313c63541 to your computer and use it in GitHub Desktop.
react-native-randomness example app
This file contains hidden or 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
import * as React from 'react'; | |
import { StyleSheet, View, Text } from 'react-native'; | |
import { random } from 'react-native-randomness'; | |
export default function App() { | |
const [result, setResult] = React.useState<any | undefined>(); | |
React.useEffect(() => { | |
random().then(setResult); | |
}, []); | |
return ( | |
<View style={styles.container}> | |
<Text>True random result:</Text> | |
<Text>{result ? `[${result.join(',')}]` : 'N/A'}</Text> | |
</View> | |
); | |
} | |
const styles = StyleSheet.create({ | |
container: { | |
flex: 1, | |
alignItems: 'center', | |
justifyContent: 'center', | |
}, | |
box: { | |
width: 60, | |
height: 60, | |
marginVertical: 20, | |
}, | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment