Update your OneSignal initialization function (see below)
Remove the initialization hook (now handled for you automagically)
Event listeners are now set up using the on function
New functions supporting newer OneSignal features
The initialization function has been changed to match 1:1 with the underlying OneSignal WebSDK. The function has been renamed init. The appId is now set via the single config options argument passed to the init function:
import OneSignal from 'react-onesignal';
OneSignal.init({ appId: 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' });
Furthermore, there is no longer a need to wrap the initialization in the useOneSignalSetup hook. The order of functions relative to the OneSignal initialization no longer matters (although we still recommend initializing OneSignal in a top-level component).
Event listeners can now be added directly via the on function. This function takes an event string and a callback.
We have added new functions to support the latest OneSignal functions and features.
Typings are included in the package automatically. See below for a full list of the functions included in this package:
🚧 2.0 Beta Release 🚧
Howdy! We are happy to announce that we have released the 2.0 beta version of this package which includes several major changes.
Yarn
yarn add react-onesignal@2.0.0-beta1
npm
npm install --save react-onesignal@2.0.0-beta1
⚠️ Includes breaking changes
If you are coming from <2.0, you will need to migrate if you choose to update the package.
Migration Guide
Review the updated documentation in the README.
Key Changes
on
functionThe initialization function has been changed to match 1:1 with the underlying OneSignal WebSDK. The function has been renamed
init
. TheappId
is now set via the single config options argument passed to theinit
function:Furthermore, there is no longer a need to wrap the initialization in the
useOneSignalSetup
hook. The order of functions relative to the OneSignal initialization no longer matters (although we still recommend initializing OneSignal in a top-level component).Event listeners can now be added directly via the
on
function. This function takes an event string and a callback.We have added new functions to support the latest OneSignal functions and features.
Typings are included in the package automatically. See below for a full list of the functions included in this package:
Summary
Consider the above changes when migrating to version 2 and make sure to thoroughly test your application.
Feedback
Please provide any feedback in the below thread during the Beta period to ensure we can address any potential issues.
Enjoy!