
Security News
Vite Releases Technical Preview of Rolldown-Vite, a Rust-Based Bundler
Vite releases Rolldown-Vite, a Rust-based bundler preview offering faster builds and lower memory usage as a drop-in replacement for Vite.
tiktok-opensdk-react-native
Advanced tools
This package provides a React Native wrapper for the TikTok OpenSDK, allowing you to integrate TikTok sharing functionality into your React Native applications.
npm install tiktok-opensdk-react-native
# or
yarn add tiktok-opensdk-react-native
import TikTokOpenSDK from 'tiktok-opensdk-react-native';
// ...
try {
const result = await TikTokOpenSDK.share(
['path/to/media1', 'path/to/media2'],
false, // isImage (true for images, false for videos)
false // isGreenScreen
);
if (result.isSuccess) {
console.log('Share successful!');
} else {
console.error('Share failed:', result.errorMsg);
}
} catch (error) {
console.error('Error sharing to TikTok:', error);
}
TikTokOpenSDK.share(mediaPaths: string[], isImage: boolean, isGreenScreen: boolean): Promise<ShareResult>
Shares media to TikTok.
mediaPaths: string[]
- Array of local media file paths to shareisImage: boolean
- Set to true
for images, false
for videosisGreenScreen: boolean
- Set to true
to use green screen effect (TikTok app only)Returns a Promise that resolves to a ShareResult
object.
type ShareResult = ShareSuccessResult | ShareErrorResult;
interface ShareSuccessResult {
isSuccess: true;
}
interface ShareErrorResult {
isSuccess: false;
errorCode: number;
subErrorCode?: number;
shareState?: number;
errorMsg: string;
}
# iOS Setup
Minimum iOS version: 12.0 Minimum Xcode version: 10.0
npx pod-install
or cd ios && pod install
.Info.plist
file:<key>LSApplicationQueriesSchemes</key>
<array>
<string>tiktokopensdk</string>
<string>tiktoksharesdk</string>
<string>snssdk1180</string>
<string>snssdk1233</string>
</array>
<key>TikTokClientKey</key>
<string>$TikTokClientKey</string>
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleURLSchemes</key>
<array>
<string>$TikTokClientKey</string>
</array>
</dict>
</array>
Info.plist
file:<key>NSPhotoLibraryAddUsageDescription</key>
<string>$(PRODUCT_NAME) would like to save photos to your photo library</string>
<key>NSPhotoLibraryUsageDescription</key>
<string>$(PRODUCT_NAME) would like to access your photo library</string>
#import <TiktokOpensdkReactNative-Bridging-Header.h>
@implementation AppDelegate
// ... other methods ...
- (BOOL)application:(UIApplication *)app openURL:(NSURL *)url options:(NSDictionary<UIApplicationOpenURLOptionsKey,id> *)options
{
BOOL handled = NO;
if ([TiktokOpensdkReactNative handleOpenURL:url]) {
handled = YES;
}
// Handle other custom URL schemes
return handled;
}
- (BOOL)application:(UIApplication *)application continueUserActivity:(nonnull NSUserActivity *)userActivity restorationHandler:(nonnull void (^)(NSArray<id<UIUserActivityRestoring>> * _Nullable))restorationHandler
{
BOOL handled = NO;
if ([TiktokOpensdkReactNative handleUserActivity:userActivity]) {
handled = YES;
}
// Handle other user activities
return handled;
}
@end
Minimum Android version: API level 21 (Android 5.0 Lollipop) or later
allprojects {
repositories {
maven { url "https://artifact.bytedance.com/repository/AwemeOpenSDK" }
}
}
dependencies {
implementation 'com.tiktok.open.sdk:tiktok-open-sdk-core:2.3.0'
implementation 'com.tiktok.open.sdk:tiktok-open-sdk-share:2.3.0' // for share API
}
<queries>
<package android:name="com.zhiliaoapp.musically" />
<package android:name="com.ss.android.ugc.trill" />
</queries>
<string name="tiktok_client_key">$TikTokClientKey</string>
<meta-data android:name="com.tiktokopensdkreactnative.tiktok.CLIENT_KEY" android:value="@string/tiktok_client_key" />
<provider
android:name="androidx.core.content.FileProvider"
android:authorities="${applicationId}.tiktokopensdkfileprovider"
android:exported="false"
android:grantUriPermissions="true">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/filepaths" />
</provider>
<?xml version="1.0" encoding="utf-8"?>
<paths xmlns:android="http://schemas.android.com/apk/res/android">
<cache-path name="cached_files" path="." />
</paths>
If you encounter any issues, please check the TikTok OpenSDK documentation for more detailed setup instructions and troubleshooting tips.
MIT
share
method with an options objectFAQs
tiktok sdk for react-native
The npm package tiktok-opensdk-react-native receives a total of 35 weekly downloads. As such, tiktok-opensdk-react-native popularity was classified as not popular.
We found that tiktok-opensdk-react-native demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Vite releases Rolldown-Vite, a Rust-based bundler preview offering faster builds and lower memory usage as a drop-in replacement for Vite.
Research
Security News
A malicious npm typosquat uses remote commands to silently delete entire project directories after a single mistyped install.
Research
Security News
Malicious PyPI package semantic-types steals Solana private keys via transitive dependency installs using monkey patching and blockchain exfiltration.