
Security News
PolinRider: North Korea-Linked Supply Chain Campaign Expands Across Open Source Ecosystems
PolinRider expands across npm, Packagist, Go modules, and Chrome extensions, using hidden loaders to target developer environments.
@d11/flagship-rn-sdk
Advanced tools
A React Native SDK for managing feature flags with support for dynamic configuration, context-based targeting, and real-time flag evaluation.
npm install @d11/flagship-rn-sdk
or
yarn add @d11/flagship-rn-sdk
cd ios && pod install && cd ..
No additional setup required. The SDK is automatically linked.
The SDK includes an Expo config plugin that automatically configures your project. The plugin is applied automatically when you install the package.
For Expo projects:
npx expo install @d11/flagship-rn-sdk
npx expo prebuild
The plugin automatically:
use_frameworks! in your PodfileBUILD_LIBRARY_FOR_DISTRIBUTION for required dependenciesManual Configuration (Optional):
If you need to manually configure the plugin, add it to your app.json:
{
"expo": {
"plugins": [
"@d11/flagship-rn-sdk/expo-plugin-flagship-rn-sdk.js"
]
}
}
Initialize the SDK with your configuration before using any flag evaluation methods:
import { initialize } from '@d11/flagship-rn-sdk';
await initialize({
baseUrl: 'https://api.example.com',
tenantId: 'your-tenant-id',
refreshInterval: 60, // in seconds (default: 30)
});
Configuration Options:
baseUrl (string, required): Base URL of your feature flag servicetenantId (string, required): Your tenant identifierrefreshInterval (number, optional): Polling interval in seconds (default: 30)Set the user context to enable context-based flag targeting:
import { setContext } from '@d11/flagship-rn-sdk';
await setContext({
targetingKey: 'user-123',
user_tier: 'premium',
country: 'US',
is_logged_in: true,
session_count: 5,
profile: {
age: 25,
city: 'New York',
},
});
Context Requirements:
targetingKey (string, required): Unique identifier for the user/contextEvaluate feature flags with type-safe methods:
import { getBooleanValue } from '@d11/flagship-rn-sdk';
const darkModeEnabled = await getBooleanValue('dark_mode', false);
if (darkModeEnabled) {
// Enable dark mode
}
import { getStringValue } from '@d11/flagship-rn-sdk';
const theme = await getStringValue('app_theme', 'light');
import { getIntegerValue } from '@d11/flagship-rn-sdk';
const maxItems = await getIntegerValue('max_cart_items', 10);
import { getDoubleValue } from '@d11/flagship-rn-sdk';
const discountRate = await getDoubleValue('discount_rate', 0.0);
import { getObjectValue } from '@d11/flagship-rn-sdk';
const config = await getObjectValue('app_config', {});
import React, { useEffect, useState } from 'react';
import { View, Text } from 'react-native';
import {
initialize,
setContext,
getBooleanValue,
getStringValue,
} from '@d11/flagship-rn-sdk';
export default function App() {
const [isReady, setIsReady] = useState(false);
const [darkMode, setDarkMode] = useState(false);
const [theme, setTheme] = useState('light');
useEffect(() => {
async function setupFlags() {
// Initialize SDK
await initialize({
baseUrl: 'https://api.example.com',
tenantId: 'your-tenant-id',
refreshInterval: 60,
});
// Set user context
await setContext({
targetingKey: 'user-123',
user_tier: 'premium',
country: 'US',
});
// Evaluate flags
const darkModeFlag = await getBooleanValue('dark_mode', false);
const themeFlag = await getStringValue('app_theme', 'light');
setDarkMode(darkModeFlag);
setTheme(themeFlag);
setIsReady(true);
}
setupFlags();
}, []);
if (!isReady) {
return <Text>Loading...</Text>;
}
return (
<View style={{ backgroundColor: darkMode ? '#000' : '#fff' }}>
<Text>Theme: {theme}</Text>
</View>
);
}
initialize(config: InitializeConfig): Promise<boolean>Initializes the SDK with the provided configuration.
Parameters:
config.baseUrl (string): Base URL for the feature flag serviceconfig.tenantId (string): Tenant identifierconfig.refreshInterval (number, optional): Polling interval in seconds (default: 30)Returns: Promise<boolean> - true if initialization succeeds
setContext(context: SetContextConfig): Promise<boolean>Sets the user context for flag evaluation.
Parameters:
context.targetingKey (string, required): Unique user identifiercontext[key: string] (ContextValue): Additional context fieldsReturns: Promise<boolean> - true if context is set successfully
Context Value Types:
stringnumberbooleanDateContextValue[] (array){ [key: string]: ContextValue } (object)getBooleanValue(key: string, defaultValue: boolean): Promise<boolean>Gets a boolean flag value.
Parameters:
key (string): Flag keydefaultValue (boolean): Default value if flag is not foundReturns: Promise<boolean> - Flag value or default
getStringValue(key: string, defaultValue: string): Promise<string>Gets a string flag value.
Parameters:
key (string): Flag keydefaultValue (string): Default value if flag is not foundReturns: Promise<string> - Flag value or default
getIntegerValue(key: string, defaultValue: number): Promise<number>Gets an integer flag value.
Parameters:
key (string): Flag keydefaultValue (number): Default value if flag is not foundReturns: Promise<number> - Flag value or default
getDoubleValue(key: string, defaultValue: number): Promise<number>Gets a double/float flag value.
Parameters:
key (string): Flag keydefaultValue (number): Default value if flag is not foundReturns: Promise<number> - Flag value or default
getObjectValue(key: string, defaultValue: Object): Promise<Object>Gets an object flag value.
Parameters:
key (string): Flag keydefaultValue (Object): Default value if flag is not foundReturns: Promise<Object> - Flag value or default
The SDK is written in TypeScript and includes full type definitions. Import types as needed:
import type { InitializeConfig, SetContextConfig, ContextValue } from '@d11/flagship-rn-sdk';
If you encounter build issues on iOS:
cd ios && xcodebuild clean && cd ..cd ios && pod deintegrate && pod install && cd ..If the Expo plugin doesn't apply automatically:
app.json:{
"expo": {
"plugins": [
"@d11/flagship-rn-sdk/expo-plugin-flagship-rn-sdk.js"
]
}
}
npx expo prebuild --cleanIf flags always return default values:
baseUrl is correct and accessibletenantId matches your configurationsetContext is called with valid targetingKeySee the contributing guide to learn how to contribute to the repository and the development workflow.
MIT
Made with create-react-native-library
FAQs
Feature Flag Management
The npm package @d11/flagship-rn-sdk receives a total of 19 weekly downloads. As such, @d11/flagship-rn-sdk popularity was classified as not popular.
We found that @d11/flagship-rn-sdk demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 6 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
PolinRider expands across npm, Packagist, Go modules, and Chrome extensions, using hidden loaders to target developer environments.

Security News
Open source attacks are accelerating as AI coding agents pull in dependencies faster, with less human review.

Research
/Security News
Malicious Chrome and Firefox extensions posed as free VPNs while stealing clipboard data through later extension updates.