React Native API reference

Complete API reference for the Knock React Native SDK.

In this section, you'll find the complete documentation for the components exposed in @knocklabs/react-native, including the props available.

Note: You can see a reference for the methods available for the Knock class, as well as a Feed instance under the client JS docs.



The top-level feed provider that connects to Knock with the given API key, authenticates a user, and then connects to a feed for that user.


Accepts KnockFeedProviderProps:

apiKey*stringThe public API key for the environment
userId*stringThe ID of the user for which to retrieve a feed
feedId*stringThe channel ID of the in-app feed to be displayed
userTokenstringA JWT that identifies the authenticated user, signed with the private key provided in the Knock dashboard. Required to secure your production environment. Learn more.
hoststringA custom API host for Knock
defaultFeedOptionsFeedClientOptionsSet defaults for `tenant`, `has_tenant`, `source`, `archived` to scope all subsequent feed queries
colorModeColorModeSets the theme as either light or dark mode (defaults to light)
rootlessbooleanWhen set as false, doesn't wrap the children in a `<KnockFeedContainer>`
i18nI18nContentAn optional set of translations to override the default `en` translations used in the feed components


A provider to inject translations into components.


i18nI18nContentA set of translations and a locale to use in child components via the `useTranslations` hook
children*ReactNodeOne or more `Button` components



The KnockFeedProvider exposes a useKnockFeed hook for all child components.

Returns: KnockFeedProviderState

knockKnockThe instance of the Knock client
feedClientFeedThe instance of the authenticated Feed
useFeedStoreUseStore<FeedStoreState>A zustand store containing the FeedStoreState
statusFilterStatusCurrent value of the filter status for the Feed
setStatusfunctionA function to set the current FilterStatus
colorModeColorModeThe current theme color



Creates an authenticated Knock client.

Returns: Knock instance, authenticated against the user



Creates a Feed instance for the provided Knock client which creates a stateful, real-time connection to Knock to build in-app experiences.

Returns: Feed instance



Exposed under KnockI18nProvider child components.


localestringThe current locale code (defaults to `en`)
t(key: string) => stringA helper function to get the value of a translation from the current `Translations`.
dateFnsLocale() => LocaleReturns a Locale for use in date-fns. Defaults to `en-US`.



Used to set translations available in the child components exposed under KnockFeedProvider. Used in the useTranslations hook.

Note: locale must be a valid locale code.