Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
@iroomit/react-native-in-app-notification
Advanced tools
A simple dropdown notification view for React Native that imitates a push notification for while the app is open. Can be called anywhere throughout your React Native application.
This library provides a simple interface for showing push notification-like messages throughout your React Native app on iOS and Android while it is in the foreground. Fully written in JS (TypeScript), no external libraries needed.
✅ No additional libraries/imports (Pure JS)
✅ Implemented in TypeScript/Full TypeScript Support
Used in production for the in-app messaging portion of iROOMit Roommates & Rooms for Rent Finder iOS & Android app.
✅ Animates in/out from top of screen
✅ Custom title and message preview
✅ Optional image preview
✅ Drag up to close
✅ onPress functionality for each notification
✅ Customizable styles
Install the package by running:
npm install @iroomit/react-native-in-app-notification
or
yarn add @iroomit/react-native-in-app-notification
You must wrap the root of your app in your App.js
or App.tsx
file with <InAppNotificationProvider />
:
...
import { InAppNotificationProvider } from '@iroomit/react-native-in-app-notification';
const App = () => {
return (
<InAppNotificationProvider>
<View>
...
</View>
</InAppNotificationProvider>
)
}
...
To display a notification from any functional component within your application, you can use the useInAppNotification()
hook to get access to the showNotification(...)
and dismissAll()
methods:
...
import { useInAppNotification } from '@iroomit/react-native-in-app-notification';
const MyButton = () => {
const { showNotification } = useInAppNotification();
return (
<TouchableOpacity onPress={() => {
showNotification("My Title", "My notification text can go here", "https://mydomain.com/myimage.png", {
onPress: () => console.log('Notification pressed!')
});
}}>
...
</TouchableOpacity>
)
}
...
You can wrap your class component definition with the withInAppNotification(...)
higher-order component function to access the inAppNotification
prop that provides showNotification(...)
and dismissAll()
methods:
...
import React from 'react';
import { withInAppNotification } from '@iroomit/react-native-in-app-notification';
export default withInAppNotification(class MyButton extends React.Component {
constructor(props) {
super(props);
}
render() {
return (
<TouchableOpacity onPress={() => {
this.props.inAppNotification.showNotification("My Title", "My notification text can go here", "https://mydomain.com/myimage.png", {
onPress: () => console.log('Notification pressed!')
});
}}>
...
</TouchableOpacity>
)
}
});
...
This function adds a notification to the queue to be shown. By default, one notification is shown every 3 seconds. If there are no more notifications in the queue, the last/only notification in the queue is shown for up to 9 seconds.
An optional object to further customize each individual notification. For now, just used to assign a callback for the onPress action.
If onPress is not defined, then the notification shown will not be pressable.
This function immediately dismisses any visible notifications and clears the queue of any remaining notifications that were to be shown.
While this package is production-ready, we are open to collaboration on new features and bug fixes. We also intend on supporting various kinds of notification styles in the near future.
If you would like to contribute, please open a new issue on GitHub or contact iROOMit.
FAQs
A simple dropdown notification view for React Native that imitates a push notification for while the app is open. Can be called anywhere throughout your React Native application.
The npm package @iroomit/react-native-in-app-notification receives a total of 2 weekly downloads. As such, @iroomit/react-native-in-app-notification popularity was classified as not popular.
We found that @iroomit/react-native-in-app-notification demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.