@plaude/react-native
v1.1.0
Published
Plaude React Native SDK
Downloads
12
Readme
Getting started
First, install the Plaude SDK.
npm install @plaude/react-native
Then, add the following environment variable from your Plaude dashboard.
PLAUDE_APP_ID="This is an example"
Then, wrap your application with the PlaudeProvider
component.
import { PlaudeProvider } from '@plaude/react-native';
export default function RootLayout({ children }: React.PropsWithChildren) {
return <PlaudeProvider>{children}</PlaudeProvider>;
}
Although Plaude automatically gets the App ID
from your environment, you can opt for manually setting it in the PlaudeProvider
component.
import { PlaudeProvider } from '@plaude/react-native';
export default function RootLayout({ children }: React.PropsWithChildren) {
return <PlaudeProvider appId="Your App ID">{children}</PlaudeProvider>;
}
At this point the installation is completed, you can make use of the Plaude messenger by calling the openMessenger()
method from the usePlaude()
hook.
import { Pressable, Text, View } from 'react-native';
import { usePlaude } from '@plaude/react-native';
export default function Page() {
const { openMessenger } = usePlaude();
return (
<View>
<Pressable onPress={openMessenger}>
<Text>Open Plaude</Text>
</Pressable>
</View>
);
}