@yappr/expo
v0.2.0
Published
Realtime chat for Expo and React Native apps — AsyncStorage-backed client, AppState reconnect, one import.
Maintainers
Readme
@yappr/expo
Realtime chat for Expo and React Native apps. One import.
Install
npx expo install @yappr/expo @react-native-async-storage/async-storageUse
import { createExpoClient, YapprProvider, useChannel } from "@yappr/expo";
import { Button, FlatList, Text } from "react-native";
const client = createExpoClient({
tenantId: "your-tenant",
key: "pk_live_...",
userId: "user-123",
});
function Chat() {
const { messages, status, send } = useChannel("general");
return (
<>
<Text>{status}</Text>
<FlatList
data={messages}
keyExtractor={(m) => m.id}
renderItem={({ item }) => <Text>{item.content}</Text>}
/>
<Button title="Say hi" onPress={() => send("hi")} />
</>
);
}
export default function App() {
return (
<YapprProvider client={client}>
<Chat />
</YapprProvider>
);
}createExpoClient supplies React Native defaults for storage, id generation, and
foreground reconnection. Every field of YapprClientConfig stays overridable — pass
your own storage to use MMKV or expo-sqlite/kv-store instead of AsyncStorage.
Create the client once, at module scope or in a useState initializer — never
inline in render. See @yappr/react for why.
Push notifications
Not yet available. Push is not implemented in this release — there is no webhook, callback, or other integration point for it today.
The planned approach: Yappr will report who is offline and holds unread messages, and your own push tooling (Expo push, FCM, APNs, or whatever you already use) will handle sending, since Yappr does not want to own device tokens or delivery. No date is set for this.
