This repository showcases a reference demo app to help you integrate the @passiolife/nutritionai-react-native-sdk-v3 SDK using the Expo framework. This Quick Start Guide walks you through the essential steps and provides examples for a seamless implementation with custom UI.
In this Quick Start Guide, you will learn how to implement the following:
- Installation
- Configuring the SDK
- Recognizing Image Remotely
- Accessing Food Details
-
Node.js installed
brew install node brew install watchmanIf you haven't set up your environment yet, please follow this link to Set Up Your Environment.
-
Yarn Install
brew install yarn -
Expo CLI installed
yarn global add expo-cli
Access to GitHub Packages (for @passiolife scope)
-
Create
.npmrcfile and add at root level OR Create.yarnrc.ymlfile and add at root level//npm.pkg.github.com/:_authToken=YOUR_GITHUB_AUTH_TOKEN @passiolife:registry=https://npm.pkg.github.com
OR
nodeLinker: node-modules npmScopes: passiolife: npmRegistryServer: "https://npm.pkg.github.com" npmAuthToken: "YOUR_GITHUB_AUTH_TOKEN" yarnPath: .yarn/releases/yarn-4.3.1.cjs -
Create
.envfile at root and provide PASSIO_KEYPASSIO_KEY = YOUR_PASSIO_KEY -
Install dependencies
yarn
-
Create pre build
npx expo prebuild --clean
-
Install pod for IOS
cd ios && pod install && cd ..
-
Run on IOS
yarn ios
-
Run on android
yarn android
1. What are the steps to integrate the @passiolife/nutritionai-react-native-sdk-v3 SDK into my Expo CLI framework project?
Follow below instructions for integration
-
Create a GitHub Personal Access Token
Go to GitHub Settings and create a "classic" personal access token with read:packages access.
-
Configure .npmrc
Create an .npmrc file in the root directory of your project with the following content, replacing GITHUB_ACCESS_TOKEN with your personal access token:
//npm.pkg.github.com/:_authToken=GITHUB_ACCESS_TOKEN @passiolife:registry=<https://npm.pkg.github.com> -
Install Passio SDK
Add the Passio SDK dependency to your package.json and run either npm or yarn to install it.
For npm:
npm install @passiolife/nutritionai-react-native-sdk-v3For yarn:
yarn add @passiolife/nutritionai-react-native-sdk-v3 -
Install Expo Build Properties Plugin
To manage Android-specific build settings, install the expo-build-properties plugin.
or npm:
npm install --save-dev expo-build-propertiesFor yarn:
yarn add expo-build-properties --dev -
Update app.json for Android and iOS Permissions
Add the necessary expo-build-properties and expo-camera configurations to app.json at the root of your project.
{ "expo": { "plugins": [ [ "expo-build-properties", { "android": { "minSdkVersion": 26 } } ], [ "expo-camera", { "cameraPermission": "Allow App to access your camera", "microphonePermission": "Allow App to access your microphone", "recordAudioAndroid": true } ] ], "ios": { "infoPlist": { "NSCameraUsageDescription": "App wants to access your camera" } } } } -
Prebuild the Project
Run the following command to generate native build files (this is required for adding the native modules):
npx expo prebuild --clean -
iOS: Install CocoaPods
Navigate to the ios directory and install the necessary CocoaPods for iOS:
cd ios && pod install && cd .. -
Run the Project
To run the project on iOS:
yarn ios -
To run the project on Android
yarn android
2. How can I integrate the @passiolife/nutritionai-react-native-sdk-v3 from scratch using the Expo CLI framework?
-
Create a New Expo Project
First, create a new Expo project if you haven't done so already:
Require Expo CLI
yarn global add expo-clinpx create-expo-app my-nutrition-app cd my-nutrition-app
Follow What are the steps to integrate the @passiolife/ nutritionai-react-native-sdk-v3 SDK into my Expo CLI framework project? Sections for next steps
For more detail click on documment
Happy Coding !!!