
Security News
Feross on the 10 Minutes or Less Podcast: Nobody Reads the Code
Socket CEO Feross Aboukhadijeh joins 10 Minutes or Less, a podcast by Ali Rohde, to discuss the recent surge in open source supply chain attacks.
@taboola/rnt-dev
Advanced tools
🚀 The official Taboola React Native Plugin for integrating native recommendations and content discovery into your React Native applications.
useCreateUnitnpm install @taboola/react-native-plugin-4x
In your project's Android folder, edit android/settings.gradle:
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.PREFER_SETTINGS)
repositories {
google()
mavenCentral()
maven {
// Taboola:
url 'https://taboolapublic.jfrog.io/artifactory/mobile-release'
}
}
}
cd ios && pod install
Note for Apple Silicon users: If you are using an Apple silicon machine, add an exclusion for
arm64to your Podfile (as well as your project settings) to prevent potential problems with the iPhone simulator.
// Initialize in your index.js or index.ts (application entry-point)
import { Taboola } from '@taboola/react-native-plugin-4x';
// Initialize as soon as possible
Taboola.init('your-publisher-name');
// Your app registration
import { AppRegistry } from 'react-native';
import App from './App';
import { name as appName } from './app.json';
AppRegistry.registerComponent(appName, () => App);
import React from 'react';
import { ActivityIndicator, Text } from 'react-native';
import {
useCreateUnit,
TBLClassicPage,
TBLClassicUnit,
TBLPlacementType
} from '@taboola/react-native-plugin-4x';
const TaboolaFeedScreen = () => {
// Create page instance with separate parameters
const classicPage = new TBLClassicPage(
'https://example.com/article',
'article'
);
// Create unit with complete listener interface
const { tblClassicUnitController } = useCreateUnit({
tblClassicPage: classicPage,
placement: 'Mid Article',
mode: 'alternating-widget-1',
placementType: TBLPlacementType.FEED,
tblClassicListener: {
onItemClick: (placementName, itemId, clickUrl, isOrganic, customData) => {
console.log('Item clicked:', clickUrl);
},
onTaboolaWidgetOnTop: () => {
console.log('Widget scrolled to top');
},
onAdReceiveSuccess: () => {
console.log('Ads loaded successfully');
},
onAdReceiveFail: (error) => {
console.log('Failed to load ads:', error);
},
onResize: (height) => {
console.log(`Widget resized to ${height}px`);
},
onUpdateContentCompleted: () => {
console.log('Content update completed');
},
onEvent: (actionType, data) => {
console.log('Custom event:', actionType, data);
}
}
});
return (
<TBLClassicUnit
tblClassicPage={classicPage}
tblClassicUnitController={tblClassicUnitController}
/>
);
};
| Component/Hook | Purpose |
|---|---|
useCreateUnit | Hook for creating Taboola unit controllers |
TBLClassicUnit | React component that renders Taboola content |
TBLClassicPage | Page-level configuration and management |
Taboola.init() | Initialize the SDK with your credentials |
import { TBLPlacementType } from '@taboola/react-native-plugin-4x';
TBLPlacementType.FEED // Endless scrolling feed
TBLPlacementType.PAGE_MIDDLE // Widget within content
TBLPlacementType.PAGE_BOTTOM // Widget at page bottom
const tblClassicListener = {
onItemClick: (placementName, itemId, clickUrl, isOrganic, customData) => {},
onTaboolaWidgetOnTop: () => {},
onAdReceiveSuccess: () => {},
onAdReceiveFail: (error) => {},
onResize: (height) => {},
onUpdateContentCompleted: () => {},
onEvent: (actionType, data) => {},
};
import { Taboola } from '@taboola/react-native-plugin-4x';
// Set Taboola-global-level
Taboola.setGlobalExtraProperties({
'custom-property': 'value',
'user-segment': 'premium'
})
// Create page first, then set extra properties
const classicPage = new TBLClassicPage(
'https://example.com',
'article'
);
// Set page-level extra properties
classicPage.setPageExtraProperties({
'custom-property': 'value',
'user-segment': 'premium'
});
// Set unit-level extra properties (after unit creation)
tblClassicUnitController?.setUnitExtraProperties({
'unit-specific': 'property'
});
import { useEffect } from 'react';
const TaboolaScreen = () => {
const classicPage = new TBLClassicPage(pageUrl, pageType);
const { tblClassicUnitController } = useCreateUnit({...});
// Cleanup when component unmounts
useEffect(() => {
return () => {
Taboola.removeClassicPage(classicPage);
};
}, [classicPage]);
return (
<TBLClassicUnit
tblClassicPage={classicPage}
tblClassicUnitController={tblClassicUnitController}
/>
);
};
Taboola SDK provides different log levels to help you debug integration issues. Set the appropriate log level based on your needs:
import { Taboola, TBLLogLevel } from '@taboola/react-native-plugin-4x';
// Set log level for debugging (should be done after Taboola.init())
Taboola.setLogLevel(TBLLogLevel.DEBUG);
// Example: Full debugging setup
import { Taboola, TBLLogLevel } from '@taboola/react-native-plugin-4x';
// Initialize Taboola
Taboola.init('your-publisher-name');
// Enable detailed logging for development
Taboola.setLogLevel(TBLLogLevel.DEBUG);
const FeedWithMultipleUnits = () => {
const classicPage = new TBLClassicPage(pageUrl, pageType);
const { tblClassicUnitController: widgetUnit } = useCreateUnit({
tblClassicPage: classicPage,
placement: 'Mid Article',
mode: 'alternating-widget-1',
placementType: TBLPlacementType.PAGE_MIDDLE,
tblClassicListener: { /* ... */ }
});
const { tblClassicUnitController: feedUnit } = useCreateUnit({
tblClassicPage: classicPage,
placement: 'Bottom Feed',
mode: 'thumbs-feed-01',
placementType: TBLPlacementType.FEED,
tblClassicListener: { /* ... */ }
});
return (
<ScrollView>
<TBLClassicUnit
tblClassicPage={classicPage}
tblClassicUnitController={widgetUnit}
/>
<TBLClassicUnit
tblClassicPage={classicPage}
tblClassicUnitController={feedUnit}
/>
</ScrollView>
);
};
Taboola.setGlobalExtraProperties({ 'darkMode': 'true' });
classicPage.setPageExtraProperties({ 'darkMode': 'true' });
// For dynamic dark-mode use this level, right after tblClassicUnitController?.setUnitExtraProperties({
// 'darkMode': 'true'
// });
// call tblClassicUnitController.fetchContent()
tblClassicUnitController?.setUnitExtraProperties({ 'darkMode': 'true' });
const TaboolaControls = ({ tblClassicUnitController, classicPage }) => {
const handleRefresh = () => {
tblClassicUnitController?.refresh();
};
const handleFetchContent = () => {
tblClassicUnitController?.fetchContent();
};
const handleReset = () => {
tblClassicUnitController?.reset();
};
const handlePageRefresh = () => {
classicPage.refresh();
};
return (
<View>
<Button title="Refresh Unit" onPress={handleRefresh} />
<Button title="Fetch Content" onPress={handleFetchContent} />
<Button title="Reset Unit" onPress={handleReset} />
<Button title="Refresh Page" onPress={handlePageRefresh} />
</View>
);
};
MIT © Taboola
Need help getting started? Check out our complete integration guide or try the sample app.
FAQs
Taboola React-Native plugin
The npm package @taboola/rnt-dev receives a total of 28 weekly downloads. As such, @taboola/rnt-dev popularity was classified as not popular.
We found that @taboola/rnt-dev demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 3 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
Socket CEO Feross Aboukhadijeh joins 10 Minutes or Less, a podcast by Ali Rohde, to discuss the recent surge in open source supply chain attacks.

Research
/Security News
Campaign of 108 extensions harvests identities, steals sessions, and adds backdoors to browsers, all tied to the same C2 infrastructure.

Security News
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.