This repository was archived by the owner on Jan 14, 2025. It is now read-only.
This repository was archived by the owner on Jan 14, 2025. It is now read-only.
On local notification action btn click not working #2034
Open
Description
Bug
On creation of local notification with action ['Yes', 'No'] given as per example. And when I click on one of these btn onAction or onNotification is not triggering. When I am tapping on notification onNotification() is triggering.
And for scheduleNotification it's working.
Environment info
react-native info
output:
System:
OS: Linux 5.8 Ubuntu 20.04.2 LTS (Focal Fossa)
CPU: (8) x64 Intel(R) Core(TM) i5-8250U CPU @ 1.60GHz
Memory: 222.84 MB / 15.41 GB
Shell: 5.0.17 - /bin/bash
Binaries:
Node: 10.23.0 - ~/.nvm/versions/node/v10.23.0/bin/node
npm: 6.14.8 - ~/.nvm/versions/node/v10.23.0/bin/npm
Watchman: 4.9.0 - /usr/bin/watchman
SDKs:
Android SDK:
API Levels: 28, 29, 30
Build Tools: 28.0.3, 29.0.2, 30.0.2, 30.0.3
System Images: android-28 | Google APIs Intel x86 Atom, android-29 | Google APIs Intel x86 Atom, android-30 | Google APIs Intel x86 Atom
npmPackages:
react: 16.8.6 => 16.8.6
react-native: 0.60.0 => 0.60.0
npmGlobalPackages:
react-native-cli: 2.0.1
Library version: x.x.x
Steps To Reproduce
- Used your example repo and did setup
- on generating local notification and clicking on action btn watch for onAction trigger
...
Describe what you expected to happen:
- It should trigger onAction()
Reproducible sample code
localNotif(iconName, soundName=undefined) {
this.lastId++;
PushNotification.localNotification({
/* Android Only Properties */
channelId: soundName ? 'sound-channel-id' : 'default-channel-id',
ticker: 'My Notification Ticker', // (optional)
largeIcon: 'ic_launcher', // (optional) default: "ic_launcher"
smallIcon: 'ic_launcher', // (optional) default: "ic_notification" with fallback for "ic_launcher"
bigText: 'My big text that will be shown when notification is expanded', // (optional) default: "message" prop
subText: 'This is a subText', // (optional) default: none
actions: "['Yes', 'No']", // (Android only) See the doc for notification actions to know more
invokeApp: true, // (optional) This enable click on actions to bring back the application to foreground or stay in background, default: true
id: this.lastId, // (optional) Valid unique 32 bit integer specified as string. default: Autogenerated Unique ID
title: 'Local Notification', // (optional)
message: 'My Notification Message', // (required)
userInfo: { screen: 'home' }, // (optional) default: {} (using null throws a JSON value '<null>' error)
});
}