Skip to content

Instantly share code, notes, and snippets.

@eugenehp
Created April 5, 2021 20:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save eugenehp/1f103986d3d19fb3985ecaf313c63541 to your computer and use it in GitHub Desktop.
Save eugenehp/1f103986d3d19fb3985ecaf313c63541 to your computer and use it in GitHub Desktop.
react-native-randomness example app
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