This repository contains the Ketch React Native package in the /package
folder and an example app in the /example
folder.
node
- We usenode v20.11.1
(LTS).- It's recommended to use Node Version Manager (NVM) to manage your Node.js versions.
For a working example, see the example directory.
- Install core dependency
npm install @ketch-com/ketch-react-native --registry=https://npm.pkg.github.com --legacy-peer-deps
When running the above command, you may see a 401 Unauthorized
response. This occurs because Github packages require authentication through a personal access token (PAT). See their Authentication to Github Packages document to set this up.
- Install peer dependencies
npm install react-native-default-preference react-native-webview
- (IOS) Install Pods
cd ios && pod install
- Use the
<KetchServiceProvider/>
component
<KetchServiceProvider
organizationCode="YOUR_ORGANIZATION_CODE"
propertyCode="YOUR_PROPERTY_CODE"
identities={{ YOUR_IDENTIFIER_NAME: "YOUR_IDENTIFIER_VALUE" }}
>
{/* The rest of your app code here */}
</KetchServiceProvider>
Where YOUR_ORGANIZATION_CODE
, YOUR_PROPERTY_CODE
, YOUR_IDENTIFIER_NAME
, and YOUR_IDENTIFIER_VALUE
are replaced with those configured within the Ketch application.
See our Getting Started and Technical Documentation documentation for further usage instructions.
For a working example, see the example-expo directory.
- Install core dependency
npm install @ketch-com/ketch-react-native --registry=https://npm.pkg.github.com --legacy-peer-deps
When running the above command, you may see a 401 Unauthorized
response. This occurs because Github packages require authentication through a personal access token (PAT). See their Authentication to Github Packages document to set this up.
- Install peer dependencies
npx expo install expo-shared-preferences react-native-webview
- (Android) Configure SharedPreferences import
Create a separate SharedPreferences.android.ts
file:
// Place this in a separate .android.ts file so it is only imported on Android
import * as SharedPreferences from "expo-shared-preferences";
export default SharedPreferences;
Next, import it in the file where you will use KetchServiceProvider
:
// then when setting up KetchServiceProvider
import SharedPrefences from './SharedPreferences';
<KetchServiceProvider
// ...
preferenceStorage={SharedPreferences}
>
- Setup a Development Build
To run through Expo on Android, you must use a development build. See the Expo Documentation for steps to create a development build.
- (IOS) Install Pods
cd ios && pod install
- Use the
<KetchServiceProvider/>
component
<KetchServiceProvider
organizationCode="YOUR_ORGANIZATION_CODE"
propertyCode="YOUR_PROPERTY_CODE"
identities={{ YOUR_IDENTIFIER_NAME: "YOUR_IDENTIFIER_VALUE" }}
>
{/* The rest of your app code here */}
</KetchServiceProvider>
Where YOUR_ORGANIZATION_CODE
, YOUR_PROPERTY_CODE
, YOUR_IDENTIFIER_NAME
, and YOUR_IDENTIFIER_VALUE
are replaced with those configured within the Ketch application.
See our Getting Started and Technical Documentation documentation for further usage instructions.
See the example app README, or the example expo app README.
See the package README.