There is a lot of text, but don't worry, only point #1 is required for everyone, all other points are necessary only if you use some specific parameters.
Below you’ll find the key changes introduced in v3.0.0 and how to update your existing code.
For a full list of changes, see the Changelog in the repository.
What Changed? The library now relies on react-native-safe-area-context internally for safe area handling.
Action Required:
- Install the dependency:
yarn add react-native-safe-area-context
# or
npm install --save react-native-safe-area-context-
Install Pods and build your application
-
Wrap the root of your app (or the
NotifierRoot/NotifierWrapper) with<SafeAreaProvider>:
import { SafeAreaProvider } from 'react-native-safe-area-context';
const App = () => (
<SafeAreaProvider>
<NotifierWrapper>
{/* ... your app code ... */}
</NotifierWrapper>
</SafeAreaProvider>
);What Changed?
- Alert now uses
typeprop instead ofalertType. ThealertTypeprop is still available but deprecated.
Action Required:
- Switch
alertType="error"etc. totype="error"in your code.
What Changed?
- Removed:
animationDuration,showAnimationDuration,hideAnimationDuration,swipeAnimationDuration,easing,showEasing,hideEasing,swipeEasing. - Use:
showAnimationConfig,hideAnimationConfig,swipeOutAnimationConfig,resetSwipeAnimationConfiginstead.
Action Required:
- Replace old params with new config objects:
Notifier.showNotification({
// Old:
showAnimationDuration: 800,
showEasing: Easing.bounce,
// New:
showAnimationConfig: {
method: 'timing',
config: {
duration: 800,
easing: Easing.bounce,
},
},
// ...
});- If
Component !== NotifierComponents.Alert,showAnimationConfigdefaults to a spring animation.
What Changed?
swipeEnabledhas been removed. To disable swiping, setswipeDirection: 'none'.
Action Required:
- Remove
swipeEnabledusage. UseswipeDirection: 'none'to disable swipe-to-dismiss.
What Changed?
containerStylenow only accepts simple style objects (e.g., background color, margins).- For custom animations, use the new
animationFunctionparameter.
Suggestion:
- If you used custom animations to display notification at the bottom, use
positionparameter instead.
Action Required:
- Remove any animation logic from
containerStyle. - Implement animations via
animationFunction. Example:
Notifier.showNotification({
// ...
animationFunction: ({
animationState,
shakingTranslationX,
shakingTranslationY,
}: AnimationFunctionParams) => {
return {
opacity: animationState,
transform: [
{
translateX: shakingTranslationX,
},
{
translateY: shakingTranslationY,
},
],
};
},
});What Changed?
The duration timer now begins after the “appearing” animation finishes (instead of at animation start). If you use a long appear animation, your notification remains on screen longer than before.
Action Required:
- Lower
durationif you want the on-screen time to match previous behavior.
What Changed?
Component is now fully unmounted while the notification is not visible. Now you can, for example use useEffect hook to do something when notification appears/disappears. For example, play sound, etc.
Action Required:
- If you relied on notification component persisting, consider updating your logic.
What Changed?
positionplaces a notification at the top, bottom, or any screen edge.enterFrom,exitTo,swipeDirectionfor custom entering/exiting/swipe directions.
Suggestion:
- Explore these new props if you want advanced positioning or direction-based animations.
What Changed?
- You can mount multiple
NotifierWrapper/NotifierRootcomponents. - Global
Notifier.*methods control the last mounted instance. Notifier.broadcast.*commands all mounted instances simultaneously.
Suggestion:
- You can mount
NotifierWrapper/NotifierRootinside of a modals, and shown notification withNotifier.showNotificationas you usually do. No need to provide aref.
What Changed?
- Each notification has a unique ID by default, generated via
idStrategyif not provided. duplicateBehaviordefines how to handle a new notification if one with the same ID is already visible.
Suggestion:
- If you track notifications manually, note that IDs are now automatically assigned unless you set them.
- Use
duplicateBehaviorto handle duplicates gracefully.
What Changed?
updateNotification,shakeNotification,hideNotificationare joined byupdateById,shakeById,isVisibleById,hideById— these affect a notification only if the ID matches.isNotificationVisiblereturns whether any notification is currently displayed.
Suggestion:
- Use the
ByIdvariants for more precise targeting of notifications if needed.
What Changed?
- Notification now has a
typeprop; any value other than'classic'(success,error, etc.) shows an icon and left border with different colors. - There is also more new props added to the Notification component for better customization, such us
useTypeColorForTitle,useTypeColorForDescription,iconSource,safeAreaStyle,iconContainerStyle,iconStyle,textContainerStyle,
Suggestion:
- Explore these new props to see new variations of the Notification component.
What Changed?
- Can now be passed both as props on
NotifierRoot/NotifierWrapperand as parameters toshowNotification.
Suggestion:
- If you want to display the notifications above
native-stackmodals on ios, setuseRNScreensOverlaytotrue
- When
useRNScreensOverlayistrue,SafeAreaViewmay not behave correctly. - Use the
ViewWithOffsetscomponent in your custom components to handle safe area insets if needed.
To upgrade to v3.0.0:
- Install
react-native-safe-area-context& wrap your app root withSafeAreaProvider. - Remove old animation params (e.g.,
animationDuration,easing) and switch to*AnimationConfigoranimationFunction. - Adjust
durationif you rely on the old timing (it now starts after appear animation finishes). - Set
swipeDirection: 'none'if you want to disable swiping (swipeEnabledwas removed). - Optionally explore new features like
duplicateBehavior,idStrategy,ByIdmethods, advanced positioning, or directions.