Initialization
Here is how to initialize the Wepin React Native SDK.
Import SDK
import Wepin from '@wepin/react-native-sdk
const wepin = Wepin.getInstance()Add the <Wepin.WidgetView> component to the main component and insert content inside it.
function App(): JSX.Element {
....
return (
<Wepin.WidgetView>
...
</Wepin.WidgetView>
)
}init
initawait wepin.init(appId, appSdkKey[, attributes])Initialize the Wepin instance.
Parameters
appId: String App ID assigned during registrationappKey: String App Key assigned during registrationattributes: IAttributes (optional) Properties of the Wepin Widget. It is defined in@wepin/types.type: String It determines how the app widget window will be displayed on initial loading. The default value ishide.show: Show the widget window immediately after loading for the first time.hide: Hide the widget window initially when loading and show it later usingopenWindow().defaultLanguage: String The language to be displayed on the widget. The default value isko. The currently supported languages areenandko.defaultCurrency: String The currency to be displayed on the widget. The default value isKRW. The currently supported currencies areUSDandKRW.loginProviders: [String] Here is the list of login providers:google,apple,naver, anddiscord. Define and use only the necessary login providers. If you do not specify this value, all the four providers can be used by default.The
loginProvidersparameter is supported from@wepin/typesversionv0.0.11or higher.
Example
await wepin.init('APPID', 'APPKEY', {
type: 'hide',
defaultLanguage: 'en',
defaultCurrency: 'USD',
loginProviders: ['google', 'apple'],
})isInitialized
isInitializedwepin.isInitialized()You can use the isInitialized method to check if the Wepin stance has been initialized successfully.
Returned value
<boolean>
init result;
trueif Wepin SDK is already initialized, otherwisefalse.
Last updated
Was this helpful?