question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

LocalNotification on v6.1.1 and v6.1.2 do not work, but changing to v4.0.0 or v5.1.1 it works

See original GitHub issue

Bug

LocalNotification on v6.1.1 and v6.1.2 do not work but changing the version in package.json to v4.0.0 or v5.1.1 , it works as expected.

This is my super simple app using react native 0.63.3

/src/services/LocalPushController.js

import PushNotification from 'react-native-push-notification'

PushNotification.configure({
  onRegister: function (token) {
    console.log('TOKEN:', token);
  },
  onNotification: function (notification) {
    console.log('NOTIFICATION:', notification);
  },
  permissions: {
    alert: true,
    badge: true,
    sound: true,
  },
  popInitialNotification: true,
  requestPermissions: Platform.OS === 'ios',
});

export const LocalNotification = () => {
  PushNotification.localNotification({
    autoCancel: true,
    bigText: 'This is local notification demo in React Native app. Only shown, when expanded.',
    subText: 'Local Notification Demo',
    title: 'Local Notification Title',
    message: 'Expand me to see more',
    vibrate: true,
    vibration: 300,
    playSound: true,
    soundName: 'default',
    actions: '["Yes", "No"]'
  });
}

app.js

import React from 'react';
import { LocalNotification } from './src/services/LocalPushController'
import { Text, View, Button, StyleSheet } from 'react-native';

const handleButtonPress = () => {
  LocalNotification()
}

const App = () => {
  return (
    <View style={styles.container}>
      <Text>Press a button to trigger the notification</Text>
      <View style={{ marginTop: 20 }}>
        <Button title={'Local Push Notification'} onPress={handleButtonPress} />
      </View>
    </View>
  );
};

const styles = StyleSheet.create({
  container: {
    flex: 1,
    justifyContent: 'center',
    alignItems: 'center'
  },
  buttonContainer: {
    marginTop: 20
  }
})

export default App;

Environment info

react-native info output:

info Fetching system and libraries information...
System:
    OS: Linux 5.4 Ubuntu 20.04.1 LTS (Focal Fossa)
    CPU: (8) x64 Intel(R) Core(TM) i7-7700HQ CPU @ 2.80GHz
    Memory: 9.33 GB / 23.37 GB
    Shell: 5.0.17 - /bin/bash
  Binaries:
    Node: 12.17.0 - ~/.asdf/installs/nodejs/12.17.0/bin/node
    Yarn: Not Found
    npm: 6.14.4 - ~/.asdf/installs/nodejs/12.17.0/bin/npm
    Watchman: Not Found
  SDKs:
    Android SDK: Not Found
  IDEs:
    Android Studio: Not Found
  Languages:
    Java: Not Found
    Python: Not Found
  npmPackages:
    @react-native-community/cli: Not Found
    react: 16.13.1 => 16.13.1 
    react-native: 0.63.3 => 0.63.3 
  npmGlobalPackages:
    *react-native*: Not Found

Library version: x.x.x

Steps To Reproduce

  1. Create react native project with the above two files to push a simple push notification. Clicking the button doesn’t trigger push notification.
  2. Change react-native-push-notification version in package.json to 4.0.0 or 5.1.1 and do npm install. Now button triggers local notif successfully.
  3. Now change the version again to latest v6.1.2. Now it doesn’t work. …

Describe what you expected to happen:

  1. Expected to run using v6.1.2 as it runs on v4.0.0 or v5.1.1

Reproducible sample code

Provided above

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:11

github_iconTop GitHub Comments

1reaction
Dallas62commented, Oct 29, 2020

Hi,

Expected to run using v6.1.2 as it runs on v4.0.0 or v5.1.1

Major version, means breaking changes. Please read the README, and Changelog. You will also find similar issues closed in the history.

Regards

0reactions
matthieugayoncommented, Nov 13, 2020

No

Read more comments on GitHub >

github_iconTop Results From Across the Web

Changelog - FollowAnalytics
Fixed a crash occurring when the user changes the location authorization to Always in the iOS settings. Improvements . On the Javascript...
Read more >
Flutter schedule local notification does not work - Stack Overflow
I am trying to create a notification at a certain time but it is not working. The code does not throw any error...
Read more >
Notifications — eventsourcing 6.0.0 documentation
This section discusses how to use notifications to propagate the domain events of an application. If the domain events of an application can...
Read more >
Kea Administrator Reference Manual - ripe
The memfile backend is able to store lease information, but is not able to store host reservation details: these must be stored in....
Read more >
Releases | Notifee
[Android]: Fixes an issue that was introduced in v6.0.0 (Fixes #528). ... [Web]: Basic support for react-native-web - notifications do not work on...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found