Skip to content

Instantly share code, notes, and snippets.

@Addono
Created April 18, 2021 08:01
Show Gist options
  • Save Addono/c6541723e81def891c7653d3bb239d24 to your computer and use it in GitHub Desktop.
Save Addono/c6541723e81def891c7653d3bb239d24 to your computer and use it in GitHub Desktop.
ClaimR React Native app example
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