Package Exports
- @mikekhristo/expo-tiktok-opensdk
- @mikekhristo/expo-tiktok-opensdk/build/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@mikekhristo/expo-tiktok-opensdk) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
expo-tiktok-opensdk
TikTok OpenSDK module for Expo apps
Installation
npx expo install expo-tiktok-opensdk
Configuration
Add the plugin to your app.json
/app.config.js
:
{
"expo": {
"plugins": [
[
"expo-tiktok-opensdk",
{
"iosClientKey": "YOUR_IOS_CLIENT_KEY",
"androidClientKey": "YOUR_ANDROID_CLIENT_KEY",
"iosUniversalLink": "YOUR_UNIVERSAL_LINK", // Optional
"scheme": "YOUR_APP_SCHEME", // Optional
"redirectScheme": "YOUR_REDIRECT_SCHEME" // Optional
}
]
]
}
}
Usage
Share Content
import TikTokOpenSDK from 'expo-tiktok-opensdk';
// Share a video
await TikTokOpenSDK.share({
mediaUrls: ['path/to/video.mp4'],
isImage: false,
description: 'Check out this cool video!',
hashtags: ['expo', 'react-native']
});
// Share images
await TikTokOpenSDK.share({
mediaUrls: ['path/to/image1.jpg', 'path/to/image2.jpg'],
isImage: true,
description: 'Beautiful photos!',
hashtags: ['photography', 'nature']
});
// Share with green screen effect
await TikTokOpenSDK.share({
mediaUrls: ['path/to/video.mp4'],
isImage: false,
isGreenScreen: true,
description: 'Green screen magic!'
});
Authentication
import TikTokOpenSDK from 'expo-tiktok-opensdk';
const result = await TikTokOpenSDK.auth();
if (result.isSuccess) {
console.log('Auth code:', result.authCode);
console.log('Granted permissions:', result.grantedPermissions);
} else {
console.error('Auth failed:', result.errorMsg);
}
API Reference
Share Options
Property | Type | Required | Description |
---|---|---|---|
mediaUrls | string[] | Yes | Array of local file URLs to share |
isImage | boolean | No | Whether the media is an image (default: false) |
isGreenScreen | boolean | No | Whether to use green screen effect (default: false) |
hashtags | string[] | No | Optional hashtags to include |
description | string | No | Optional description for the shared content |
Share Result
Success result:
{
isSuccess: true
}
Error result:
{
isSuccess: false,
errorCode: number,
subErrorCode?: number, // Android only
shareState?: number, // iOS only
errorMsg: string
}
Auth Result
{
isSuccess: boolean,
errorCode?: number,
errorMsg?: string,
authCode?: string,
state?: string,
grantedPermissions?: string[]
}
Requirements
- Expo SDK 49 or newer
- iOS 13.0 or newer
- Android API level 21 or newer
License
MIT