react-native-notifly
v0.1.9
Published
Notifly allows you to show application notifications within the application and with your own components
Downloads
4
Maintainers
Readme
Installation
npm install --save react-native-notifly
Usage
First you have to add Notifly to App
//App.js
import React from "react";
import { Notifly } from "react-native-notifly";
export default function App() {
return (
<View>
{/* ... */}
<Notifly />
</View>
);
}
Show notification
import React from "react";
import { Button } from "react-native";
import { fire } from "react-native-notifly";
export default function ExampleScreen() {
return (
<Button
title="Fire Notification"
onPress={() =>
fire({
title: "Title",
message: "Some text message",
avatar: { uri: "image url" },
options: {
behaviour: "swipe",
duration: 2000,
},
onPress: (args) => console.log(args),
})
}
/>
);
}
export default function ExampleScreen() {
return (
<Button
title="Fire Notification"
onPress={() =>
fire({
title: "Title",
message: "Some text message",
component: (args) => (
<View>
<Text>{args.title}</Text>
</View>
),
})
}
/>
);
}