Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions packages/jsActions/mobile-resources-native/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,27 +6,34 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),

## [Unreleased]

### Changed

- We have migrated from `react-native-push-notification` to `@notifee/react-native` for better new architecture compatibility and enhanced push notification features.

## [10.1.8] Native Mobile Resources - 2025-11-7

## [] Notifications

### BREAKING

- Updated the react-native-firebase to v20.1.0. Ensure that the Native Template and Native Builder are updated accordingly.

## [4.2.0] Notifications

## BREAKING

- Updated the react-native-firebase to v20.1.0. Ensure that the Native Template and Native Builder are updated accordingly.

## [10.1.6] Native Mobile Resources - 2025-10-17


## [2.0.1] Gallery

### Fixed

- We've fixed an issue where the Gallery widget would not properly load more items when scrolling down quickly.
- We've fixed an issue where the Gallery widget would not properly load more items when scrolling down quickly.

## [6.1.2] VideoPlayer

- We have updated `react-native-video` version to 6.10.2.
- We have fixed an issue where videos were muted in iOS silent mode. The video player now plays sound even when the device is set to silent.

Expand Down
5 changes: 2 additions & 3 deletions packages/jsActions/mobile-resources-native/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@
"release:marketplace": "node ../../../scripts/release/marketplaceRelease.js"
},
"dependencies": {
"@notifee/react-native": "9.1.8",
"@react-native-camera-roll/camera-roll": "7.4.0",
"@react-native-community/push-notification-ios": "1.10.1",
"@react-native-firebase/messaging": "20.1.0",
"@swan-io/react-native-browser": "^0.4.1",
"fbjs": "3.0.4",
Expand All @@ -38,7 +38,6 @@
"react-native-image-picker": "7.2.3",
"react-native-localize": "3.2.1",
"react-native-permissions": "4.1.5",
"react-native-push-notification": "8.1.1",
"react-native-schedule-exact-alarm-permission": "^0.1.3",
"react-native-sound": "0.11.0",
"react-native-touch-id": "4.4.1",
Expand All @@ -54,4 +53,4 @@
"rimraf": "^4.4.1",
"rollup": "^2.79.2"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
// - the code between BEGIN USER CODE and END USER CODE
// - the code between BEGIN EXTRA CODE and END EXTRA CODE
// Other code you write will be lost the next time you deploy the project.
import { NativeModules, Platform } from "react-native";
import PushNotification from "react-native-push-notification";
import { NativeModules } from "react-native";
import notifee from "@notifee/react-native";

// BEGIN EXTRA CODE
// END EXTRA CODE
Expand All @@ -17,13 +17,12 @@ import PushNotification from "react-native-push-notification";
*/
export async function CancelAllScheduledNotifications(): Promise<void> {
// BEGIN USER CODE
// Documentation https://github.com/zo0r/react-native-push-notification
const isIOS = Platform.OS === "ios";
if (NativeModules && isIOS && !NativeModules.RNCPushNotificationIOS) {
return Promise.reject(new Error("Notifications module is not available in your app"));
// Documentation https://github.com/invertase/notifee
if (NativeModules && !NativeModules.NotifeeApiModule) {
return Promise.reject(new Error("Notifee native module is not available in your app"));
}

PushNotification.cancelAllLocalNotifications();
notifee.cancelAllNotifications();
return Promise.resolve();

// END USER CODE
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
// - the code between BEGIN USER CODE and END USER CODE
// - the code between BEGIN EXTRA CODE and END EXTRA CODE
// Other code you write will be lost the next time you deploy the project.
import { NativeModules, Platform } from "react-native";
import PushNotification from "react-native-push-notification";
import { NativeModules } from "react-native";
import notifee from "@notifee/react-native";

// BEGIN EXTRA CODE
// END EXTRA CODE
Expand All @@ -17,17 +17,16 @@ import PushNotification from "react-native-push-notification";
*/
export async function CancelScheduledNotification(notificationId?: string): Promise<void> {
// BEGIN USER CODE
// Documentation https://github.com/zo0r/react-native-push-notification
const isIOS = Platform.OS === "ios";
if (NativeModules && isIOS && !NativeModules.RNCPushNotificationIOS) {
return Promise.reject(new Error("Notifications module is not available in your app"));
// Documentation Documentation https://github.com/invertase/notifee
if (NativeModules && !NativeModules.NotifeeApiModule) {
return Promise.reject(new Error("Notifee native module is not available in your app"));
}

if (!notificationId) {
return Promise.reject(new Error("Input parameter 'Notification id' is required"));
}

PushNotification.cancelLocalNotification(notificationId);
notifee.cancelNotification(notificationId);
return Promise.resolve();

// END USER CODE
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
// - the code between BEGIN USER CODE and END USER CODE
// - the code between BEGIN EXTRA CODE and END EXTRA CODE
// Other code you write will be lost the next time you deploy the project.
import { NativeModules, Platform } from "react-native";
import PushNotification from "react-native-push-notification";
import { NativeModules } from "react-native";
import notifee from "@notifee/react-native";

// BEGIN EXTRA CODE
// END EXTRA CODE
Expand All @@ -17,13 +17,12 @@ import PushNotification from "react-native-push-notification";
*/
export async function ClearAllDeliveredNotifications(): Promise<void> {
// BEGIN USER CODE
// Documentation https://github.com/zo0r/react-native-push-notification
const isIOS = Platform.OS === "ios";
if (NativeModules && isIOS && !NativeModules.RNCPushNotificationIOS) {
return Promise.reject(new Error("Notifications module is not available in your app"));
// Documentation Documentation https://github.com/invertase/notifee
if (NativeModules && !NativeModules.NotifeeApiModule) {
return Promise.reject(new Error("Notifee native module is not available in your app"));
}

PushNotification.removeAllDeliveredNotifications();
notifee.cancelAllNotifications();

return Promise.resolve();
// END USER CODE
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
// - the code between BEGIN EXTRA CODE and END EXTRA CODE
// Other code you write will be lost the next time you deploy the project.
import { NativeModules, Platform } from "react-native";
import PushNotification, { PushNotificationObject } from "react-native-push-notification";
import notifee, { AndroidChannel, AndroidImportance, Notification } from "@notifee/react-native";

// BEGIN EXTRA CODE
// END EXTRA CODE
Expand All @@ -32,59 +32,54 @@ export async function DisplayNotification(
actionGuid?: string
): Promise<void> {
// BEGIN USER CODE
// Documentation https://github.com/zo0r/react-native-push-notification

const isIOS = Platform.OS === "ios";
if (NativeModules && isIOS && !NativeModules.RNCPushNotificationIOS) {
return Promise.reject(new Error("Notifications module is not available in your app"));
if (!body) {
throw new Error("Input parameter 'Body' is required");
}

if (!body) {
return Promise.reject(new Error("Input parameter 'Body' is required"));
// Documentation Documentation https://github.com/invertase/notifee
if (NativeModules && !NativeModules.NotifeeApiModule) {
return Promise.reject(new Error("Notifee native module is not available in your app"));
}

const notification = { message: body } as PushNotificationObject;
const channelId = playSound ? "mendix-local-notifications-withsound" : "mendix-local-notifications";
await createNotificationChannelIfNeeded(channelId);

if (!isIOS) {
const channelId = "mendix-local-notifications";
const channelExists = await new Promise(resolve =>
PushNotification.channelExists(channelId, (exists: boolean) => resolve(exists))
);
if (!channelExists) {
const channel = await new Promise(resolve =>
PushNotification.createChannel(
{
channelId,
channelName: "Local notifications"
},
created => resolve(created)
)
);
if (!channel) {
return Promise.reject(new Error("Could not create the local notifications channel"));
}
}
notification.channelId = channelId;
}
const notification: Notification = {
title: title || undefined,
body,
android: { channelId, sound: "default" },
ios: playSound ? { sound: "default" } : {}
};

if (title) {
notification.title = title;
if (subtitle && Platform.OS === "ios") {
notification.subtitle = subtitle;
}

if (subtitle && !isIOS) {
notification.subText = subtitle;
if (actionName || actionGuid) {
notification.data = {
actionName: actionName ?? "",
guid: actionGuid ?? ""
};
}

notification.playSound = !!playSound;
await notifee.displayNotification(notification);

if (actionName || actionGuid) {
notification.userInfo = {
actionName,
guid: actionGuid
async function createNotificationChannelIfNeeded(channelId: string): Promise<void> {
if (Platform.OS === "ios") {
return;
}
const existingChannel = await notifee.getChannel(channelId);
const channel: AndroidChannel = {
id: channelId,
name: "Local Notifications",
importance: AndroidImportance.HIGH,
...(playSound ? { sound: "default" } : {})
};
if (existingChannel === null) {
await notifee.createChannel(channel);
}
}

PushNotification.localNotification(notification);
return Promise.resolve();
// END USER CODE
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,13 @@
// - the code between BEGIN EXTRA CODE and END EXTRA CODE
// Other code you write will be lost the next time you deploy the project.
import { NativeModules, Platform } from "react-native";
import PushNotification, { PushNotificationScheduleObject } from "react-native-push-notification";
import notifee, {
AndroidChannel,
AndroidImportance,
Notification,
TimestampTrigger,
TriggerType
} from "@notifee/react-native";

// BEGIN EXTRA CODE
// END EXTRA CODE
Expand Down Expand Up @@ -36,68 +42,64 @@ export async function ScheduleNotification(
actionGuid?: string
): Promise<void> {
// BEGIN USER CODE
// Documentation https://github.com/zo0r/react-native-push-notification

const isIOS = Platform.OS === "ios";
if (NativeModules && isIOS && !NativeModules.RNCPushNotificationIOS) {
return Promise.reject(new Error("Notifications module is not available in your app"));
}

if (!body) {
return Promise.reject(new Error("Input parameter 'Body' is required"));
throw new Error("Input parameter 'Body' is required");
}

const notification = { message: body } as PushNotificationScheduleObject;
const notificationIdNumber = Number(notificationId);

if (!isIOS) {
const channelId = "mendix-local-notifications";
const channelExists = await new Promise(resolve =>
PushNotification.channelExists(channelId, (exists: boolean) => resolve(exists))
);
if (!channelExists) {
const channel = await new Promise(resolve =>
PushNotification.createChannel(
{
channelId,
channelName: "Local notifications"
},
created => resolve(created)
)
);
if (!channel) {
return Promise.reject(new Error("Could not create the local notifications channel"));
}
}
notification.channelId = channelId;
if (!date) {
throw new Error("Input parameter 'Date' is required");
}

if (notificationIdNumber) {
notification.id = notificationIdNumber;
// Documentation Documentation https://github.com/invertase/notifee
if (NativeModules && !NativeModules.NotifeeApiModule) {
return Promise.reject(new Error("Notifee native module is not available in your app"));
}

if (title) {
notification.title = title;
}
const channelId = playSound ? "mendix-local-notifications-withsound" : "mendix-local-notifications";
await createNotificationChannelIfNeeded(channelId);

if (subtitle && !isIOS) {
notification.subText = subtitle;
}
const notification: Notification = {
id: notificationId,
title: title || undefined,
body,
android: { channelId, sound: "default" },
ios: playSound ? { sound: "default" } : {}
};

notification.playSound = !!playSound;
if (subtitle && Platform.OS === "ios") {
notification.subtitle = subtitle;
}

if (actionName || actionGuid) {
notification.userInfo = {
actionName,
guid: actionGuid
notification.data = {
actionName: actionName ?? "",
guid: actionGuid ?? ""
};
}

if (date && date.getTime()) {
notification.date = date;
const trigger: TimestampTrigger = {
type: TriggerType.TIMESTAMP,
timestamp: date.getTime()
};

await notifee.createTriggerNotification(notification, trigger);

async function createNotificationChannelIfNeeded(channelId: string): Promise<void> {
if (Platform.OS === "ios") {
return;
}
const existingChannel = await notifee.getChannel(channelId);
const channel: AndroidChannel = {
id: channelId,
name: "Local Notifications",
importance: AndroidImportance.HIGH,
...(playSound ? { sound: "default" } : {})
};
if (existingChannel === null) {
await notifee.createChannel(channel);
}
}

PushNotification.localNotificationSchedule(notification);
return Promise.resolve();
// END USER CODE
}
Loading
Loading