lark-sdk-multi-mobile
v1.0.0
Published
React Native SDK for Lark Finserv loan eligibility
Maintainers
Readme
Lark SDK React Native
React Native SDK for Lark Finserv loan eligibility with support for Modal, Fullscreen, and Embedded modes.
Installation
npm install lark-sdk-react-native react-native-webview
# or
yarn add lark-sdk-react-native react-native-webviewUsage
1. Modal Mode
import React, { useState } from 'react';
import { Button } from 'react-native';
import { LarkSDKModal } from 'lark-sdk-react-native';
const App = () => {
const [visible, setVisible] = useState(false);
return (
<>
<Button title="Get Loan" onPress={() => setVisible(true)} />
<LarkSDKModal
visible={visible}
config={{
apiKey: 'YOUR_API_KEY',
apiSecret: 'YOUR_API_SECRET',
partnerId: 'YOUR_PARTNER_ID',
phoneNumber: '9876543210',
consentData: {
privacyConsent: true,
promotionalConsent: false,
},
}}
onClose={() => setVisible(false)}
onEvent={(event) => {
if (event.type === 'ELIGIBILITY_RESULT') {
console.log('Result:', event.data);
}
}}
/>
</>
);
};2. Fullscreen Mode
import React from 'react';
import { LarkSDKFullscreen } from 'lark-sdk-react-native';
const GetLoanScreen = ({ navigation }) => {
return (
<LarkSDKFullscreen
config={{
apiKey: 'YOUR_API_KEY',
apiSecret: 'YOUR_API_SECRET',
partnerId: 'YOUR_PARTNER_ID',
}}
onClose={() => navigation.goBack()}
onEvent={(event) => console.log(event)}
/>
);
};3. Embedded Mode
import React from 'react';
import { View } from 'react-native';
import { LarkSDKEmbedded } from 'lark-sdk-react-native';
const LoanSection = () => {
return (
<View style={{ height: 600 }}>
<LarkSDKEmbedded
config={{
apiKey: 'YOUR_API_KEY',
apiSecret: 'YOUR_API_SECRET',
partnerId: 'YOUR_PARTNER_ID',
}}
onEvent={(event) => console.log(event)}
/>
</View>
);
};Configuration
| Property | Type | Required | Description | |----------|------|----------|-------------| | apiKey | string | Yes | Your API key | | apiSecret | string | Yes | Your API secret | | partnerId | string | No | Your partner ID | | phoneNumber | string | No | Pre-fill phone number | | environment | 'sandbox' | 'production' | No | Environment (default: production) | | consentData | object | No | User consent data |
Events
READY: SDK initializedELIGIBILITY_RESULT: Eligibility check completedERROR: Error occurredCLOSE: User closed SDK
License
MIT
