From 068752da0e1670d54840c0fba0541013c8f2d25f Mon Sep 17 00:00:00 2001 From: Ron Cohen <744+roncohen@users.noreply.github.com> Date: Sun, 29 Nov 2026 06:28:35 +0000 Subject: [PATCH] docs: align React Native SDK README with the other framework guides --- packages/react-native-sdk/README.md | 144 ++++++++++++++++++---------- 1 file changed, 91 insertions(+), 53 deletions(-) diff --git a/packages/react-native-sdk/README.md b/packages/react-native-sdk/README.md index 2c6374e2..f9e610d5 100644 --- a/packages/react-native-sdk/README.md +++ b/packages/react-native-sdk/README.md @@ -1,64 +1,69 @@ # Reflag React Native SDK v2 -React Native providers and hooks for Boolean and multivariate flags. Built on the matching React v2 SDK, with AsyncStorage persistence and a native SSE transport included. +Feature flags for React Native, built on the [React SDK](../react-sdk/README.md). -The [React SDK README](../react-sdk/README.md) covers the shared API. - -## Install and initialize +## Setup ```sh npm install @reflag/react-native-sdk ``` -Requires React 17 or later (the modern JSX runtime) and a React version supported by your React Native app. Wrap your app with the React Native provider, which supplies the platform adapters: +The SDK requires React 17 or later. Wrap your app in `ReflagProvider`: ```tsx import { ReflagProvider } from "@reflag/react-native-sdk"; ; ``` -Use only publishable keys in the app, never server secret keys. React Native providers default live updates on, persistence to AsyncStorage, and SSE to `react-native-sse` with transport polling disabled. `storage`, `eventSourceFactory`, and `enableLiveFlagUpdates` remain configurable. +Use your publishable key in the app. Keep secret keys on your server. -## Read flags and track usage +The provider takes the same props as the React SDK's provider. In React Native, live updates are on by default and flags are cached in AsyncStorage. Use `enableLiveFlagUpdates`, `storage` and `eventSourceFactory` to change this. -Pass a flag key to check whether it's enabled, or add a default to read another value: +## `useFlag(key, defaultValue?)` ```tsx import { Button } from "react-native"; import { useFlag, useTrack } from "@reflag/react-native-sdk"; function StartHuddleButton() { - const enabled = useFlag("huddle"); + const enabled = useFlag("huddles"); // true or false const settings = useFlag("huddle-settings", { maxParticipants: 10 }); const track = useTrack(); if (!enabled) return null; return (