Installation
Install @dpage-ai/react-native-dpage and its peer dependencies in your React Native or Expo project.
Package Installation
npm
npm install @dpage-ai/react-native-dpageyarn
yarn add @dpage-ai/react-native-dpageExpo
expo install @dpage-ai/react-native-dpage
expo install @react-native-async-storage/async-storage react-native-safe-area-contextNote: Expo will automatically pin the peer dependency versions that match your SDK. For bare React Native apps, install peer dependencies manually.
Peer Dependencies
The SDK requires these peer dependencies for caching and safe area handling:
npm install @react-native-async-storage/async-storage react-native-safe-area-contextOptional React Navigation Peers
You only need these packages when you want MiniappComponent to render with navigationEngine="react-navigation" or "auto" in an app that has React Navigation available. If you stay on the built-in portable renderer, you can skip them.
npm install @react-navigation/native @react-navigation/native-stack
npm install @react-navigation/bottom-tabs @react-navigation/material-top-tabs
expo install react-native-screens react-native-gesture-handler react-native-pager-viewChoosing an engine: the portable renderer works with no extra navigation setup. React Navigation peers are only required when you want native stacks or tabs from the host app.
iOS Setup
For React Native 0.60+, install pods:
cd ios && pod install && cd ..NPM Registry Configuration
If you're using GitHub Packages registry, configure your .npmrc:
@dpage-ai:registry=https://npm.pkg.github.comBasic Setup
Initialize the SDK once at your app's entry point:
import { initDPage, initLifecycleListener } from '@dpage-ai/react-native-dpage';
initDPage({
projectId: 'my-project',
apiToken: 'dpage_live_xxx',
});
// Enable auto-save on app background (for persistent state)
initLifecycleListener();
export default function App() {
return <YourApp />;
}Miniapp Navigation Setup
Manifest-backed miniapps can now arrive from the server with a navigation payload in addition to components[]. That payload is handled automatically by MiniappComponent.
<MiniappComponent
miniappId="support-center"
navigationEngine="auto"
initialTarget="/tickets/details"
/>Verification
Test your installation by rendering a dynamic component:
import { DynamicComponent } from '@dpage-ai/react-native-dpage';
function TestScreen() {
return (
<DynamicComponent
name="TestComponent"
renderLoading={() => <Text>Loading...</Text>}
renderError={(error) => <Text>Error: {error.message}</Text>}
/>
);
}Next Steps
Now that you've installed the SDK, learn about configuration options or dive into using components.