Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 16 additions & 4 deletions packages/react-native-sdk/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

A thin React Native wrapper around `@reflag/react-sdk`.

For more usage details, see the React SDK README in `packages/react-sdk/README.md`.
For more usage details, see the [React SDK README](../react-sdk/README.md).

An Expo example app lives at `packages/react-native-sdk/dev/expo`.
An Expo example app lives in [packages/react-native-sdk/dev/expo](https://github.com/reflagcom/javascript/tree/main/packages/react-native-sdk/dev/expo).

## Get started

Expand Down Expand Up @@ -46,6 +46,13 @@ function StartHuddleButton() {
}
```

See the [React SDK README](../react-sdk/README.md) for more details.

## React Native differences

- The Reflag toolbar is web-only and is not available in React Native.
- Built-in feedback UI is web-only. In React Native, use your own UI and call `useSendFeedback` or `client.feedback` when you're ready to send feedback.

## Reference

The React Native SDK shares its API with the React SDK. Use the React SDK reference for full types and details:
Expand All @@ -56,8 +63,8 @@ The React Native SDK shares its API with the React SDK. Use the React SDK refere

### Refresh flags when the app returns to the foreground

Flags are updated if the context passed to <ReflagProvider> changes, but you might also want to update them in when the app comes to the foreground.
See this snipped on how to achieve that:
Flags are updated if the context passed to `<ReflagProvider>` changes, but you might also want to update them when the app comes to the foreground.
See this snippet:

```tsx
import React, { useEffect, useRef } from "react";
Expand Down Expand Up @@ -94,3 +101,8 @@ export function App() {
);
}
```

## Bootstrapping

You can use `<ReflagBootstrappedProvider>` in React Native when you already have pre-fetched flags and want to avoid an initial fetch.
For bootstrap usage patterns and options, see the [React SDK bootstrapping docs](../react-sdk/README.md#server-side-rendering-and-bootstrapping).