Created
April 18, 2021 08:01
-
-
Save Addono/c6541723e81def891c7653d3bb239d24 to your computer and use it in GitHub Desktop.
ClaimR React Native app example
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
import React from 'react' | |
import { StyleSheet, View, Text, Button } from 'react-native' | |
import { ClaimrClient, useLazyVerifiedLocation } from '@claimr/react-native-client' | |
const client = new ClaimrClient({ apiKey: 'YOUR_API_KEY' }) | |
const App = () => { | |
const { claim, state, submit } = useLazyVerifiedLocation({ client }) | |
return ( | |
<View style={styles.container}> | |
<Text style={styles.titleText}>My ClaimR App</Text> | |
<Text>State: {state.toLocaleUpperCase()}</Text> | |
{submit && <Button onPress={submit} title={'Submit'} />} | |
{claim && ( | |
<Text> | |
{claim.location.latitude}, {claim.location.longitude} | |
</Text> | |
)} | |
</View> | |
) | |
} | |
const styles = StyleSheet.create({ | |
container: { | |
flex: 1, | |
alignItems: 'center', | |
justifyContent: 'center', | |
padding: 10, | |
}, | |
titleText: { | |
fontSize: 20, | |
fontWeight: 'bold', | |
}, | |
}) | |
export default App |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment