Initialize Gameball Player Profile

Show your user's profile including all details, user challenges, and the leaderboard on React-native app.
Showing the GameBall widget on your mobile application is slightly different than showing it on the website. You have two options; first, if you want to design your customer interface, you will use our set of REST APIs. To know more information, you can follow this guide. The other option as this section elaborates, is through using our react native SDK.
Using the SDK, you can open the Gameball player profile from a button in your app, programmatically when someone does something, or from a persistent button that sits over your app’s UI.
When you trigger the Gameball player profile, your player is presented with a home screen. This is configurable inside Gameball to change how it looks and what’s presented.
From there, your player can check his progress across different Gameball programs as per your configurations.
To show the Gameball player profile that contains the user details, user challenges, and the leaderboard use the below steps.
import {GameballWidget} from 'react-native-gameball';
There are two ways to view the widget.

Show as standalone screen

<GameballWidget />

Show as Modal

<GameballWidget
modal={true}
/>
and then to open the widget you need to call the showProfile function on the ref property of the widget
Example on running the widget as a Modal:

Class component

return (
<View style={{ flex: 1 }}>
<Button
title={'open widget'}
onPress={() => this.widget.showProfile()}
/>
<GameballWidget
ref={(ref) => this.widget = ref}
modal={true}
/>
</View>
)

Functional component

const ref = createRef();
return (
<View>
<Button title="Open modal" onPress={() => ref.current.showProfile()} />
<GameballWidget modal={true} ref={ref} />
</View>
)