Expo SDK API reference
Complete API reference for the Knock Expo SDK.
In this section, you'll find the complete documentation for the components exposed in @knocklabs/expo
, 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.
Components#
KnockProvider
#The top-level provider that connects to Knock with the given API key and authenticates a user.
Props#
Accepts KnockProviderProps
KnockFeedProvider
#The feed-specific provider that connects to a feed for that user. Must be a child of the KnockProvider
.
Props#
Accepts KnockFeedProviderProps
:
KnockExpoPushNotificationProvider
#A context provider designed to streamline the integration of Expo push notifications within your React Native application. It facilitates the registration of device push tokens with the Knock backend, enabling the delivery of notifications. Moreover, this provider empowers developers to define custom behavior for handling notifications when they are received or interacted with, either by tapping or performing another action. By default, it provides a basic notification handling strategy, but it also allows for custom logic to be easily implemented according to specific application needs.
Note: Must be a child of the KnockProvider
.
Props#
Accepts KnockExpoPushNotificationProviderProps
:
Hooks#
useKnock
#The KnockProvider
exposes a useKnock
hook for all child components.
Returns: Knock
, an instance of the Knock JS client.
Example:
useKnockFeed
#The KnockFeedProvider
exposes a useKnockFeed
hook for all child components.
Returns: KnockFeedProviderState
Example:
useAuthenticatedKnockClient
#Creates an authenticated Knock client.
Returns: Knock
instance, authenticated against the user
Example:
useNotifications
#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
Example:
useTranslations
#Exposed under KnockI18nProvider
child components.
Returns:
useExpoPushNotifications
#The KnockExpoPushNotificationProvider
exposes a useExpoPushNotifications
hook for all child components, enabling them to interact with push notification functionalities and state.
Returns: KnockExpoPushNotificationContextType
Example:
Types#
I18nContent
#Used to set translations available in the child components exposed under KnockFeedProvider
and KnockSlackProvider
. Used in the useTranslations
hook.
Note: locale
must be a valid locale code.