
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 for Android.
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',
flagshipApiKey: 'your-api-key',
refreshInterval: 60, // in seconds (default: 30)
});
Configuration Options:
baseUrl (string, required): Base URL of your feature flag serviceflagshipApiKey (string, required): Your Flagship API keyrefreshInterval (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';
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 = getBooleanValue('dark_mode', false);
if (darkModeEnabled) {
// Enable dark mode
}
import { getStringValue } from '@d11/flagship-rn-sdk';
const theme = getStringValue('app_theme', 'light');
import { getIntegerValue } from '@d11/flagship-rn-sdk';
const maxItems = getIntegerValue('max_cart_items', 10);
import { getDoubleValue } from '@d11/flagship-rn-sdk';
const discountRate = getDoubleValue('discount_rate', 0.0);
import { getObjectValue } from '@d11/flagship-rn-sdk';
const config = 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',
flagshipApiKey: 'your-api-key',
refreshInterval: 60,
});
// Set user context
setContext({
targetingKey: 'user-123',
user_tier: 'premium',
country: 'US',
});
// Evaluate flags
const darkModeFlag = getBooleanValue('dark_mode', false);
const themeFlag = 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.flagshipApiKey (string): Flagship API keyconfig.refreshInterval (number, optional): Polling interval in seconds (default: 30)Returns: Promise<boolean> - true if initialization succeeds
setContext(context: SetContextConfig): booleanSets the user context for flag evaluation.
Parameters:
context.targetingKey (string, required): Unique user identifiercontext[key: string] (ContextValue): Additional context fieldsReturns: boolean - true if context is set successfully
Context Value Types:
stringnumberbooleanDateContextValue[] (array){ [key: string]: ContextValue } (object)getBooleanValue(key: string, defaultValue: boolean): booleanGets a boolean flag value.
Parameters:
key (string): Flag keydefaultValue (boolean): Default value if flag is not foundReturns: boolean - Flag value or default
getStringValue(key: string, defaultValue: string): stringGets a string flag value.
Parameters:
key (string): Flag keydefaultValue (string): Default value if flag is not foundReturns: string - Flag value or default
getIntegerValue(key: string, defaultValue: number): numberGets an integer flag value.
Parameters:
key (string): Flag keydefaultValue (number): Default value if flag is not foundReturns: number - Flag value or default
getDoubleValue(key: string, defaultValue: number): numberGets a double/float flag value.
Parameters:
key (string): Flag keydefaultValue (number): Default value if flag is not foundReturns: number - Flag value or default
getObjectValue(key: string, defaultValue: Object): ObjectGets an object flag value.
Parameters:
key (string): Flag keydefaultValue (Object): Default value if flag is not foundReturns: 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 flags always return default values:
baseUrl is correct and accessibleflagshipApiKey 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
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.