Native only
Notifications
in-app banner now (delay: 0), real OS notification when scheduled
function NotifyDemo() { const { notify, simulated } = useNotify(); return ( <View className="w-full gap-3"> <Button onPress={() => void notify({ title: 'Title', body: 'Description goes here, over two lines when it needs them.' }) }> <Text>Show a banner now</Text> </Button> <Button variant="outline" onPress={() => void notify({ title: 'Title', body: 'Description goes here, over two lines when it needs them.', delay: 5 }) }> <Text>Schedule one in 5s</Text> </Button> <Text className="text-muted-foreground text-sm"> {simulated ? 'Scheduled alerts need a device — it falls back to the banner after the same delay.' : 'Background the app to see the scheduled one arrive. If alerts are off it falls back to the banner.'} </Text> </View> );}Usage
No delay draws the in-app banner, which looks the same everywhere and is what a demo needs. A delay also schedules the real OS notification when it can.
API
const { notify } = useNotify(); notify({ title, body?, delay?, icon? })Get it
Already in every copy of the native kit:
import { useNotify, NotifyProvider } from '@/components/kit/notify';Details
- Exports
useNotify,NotifyProvider- Packages
- expo-notifications@~57.0.20, lucide-react-native@^1.21.0, react-native-safe-area-context@~5.7.0
- Installs with
- @halftone-native/icon, @halftone-native/lib-haptics, @halftone-native/lib-native-context, @halftone-native/lib-reduced-motion, @halftone-native/lib-theme, @halftone-native/lib-utils, @halftone-native/text, @halftone-native/toast
- Also searched as
- notification, alert, push, banner, reminder
- Registry JSON
- /r/native/notify.json
Agents: the whole registry is at /llms.txt.