-
Notifications
You must be signed in to change notification settings - Fork 374
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Looking for Feedback] OneSignal React Native SDK 5.0.0-beta1 Released! #1506
Comments
Hey there, I'm just trying to get everything installed according to the existing documentation on the site and I think I'm probably missing something. I'm getting the famous I've used OneSignal in the past on a few other apps and it's been great, but I am interested in using the new API as noted in the migration guide. It seems to be much clearer and more straightforward than all the 'player' verbiage and constantly sending tags and such. I would love any and all help I could get to be able to finish the setup step. I have followed this guide (https://documentation.onesignal.com/docs/react-native-sdk-setup) to a T and have been playing with header search paths for the service extension as well as I have this in my podfile:
as opposed to the Other than that, I'm pretty lost and would love to get rolling. Thanks for any help! |
Hello @jakehasler ! Thank you for your interest to our product! I would recommend checking out the example app we have in this repository. Let us know if it works for you. If you get the same error could you please provide your package.json file? |
Hi @kesheshyan, I can't seem to run To initialize I do nothing fancy, I just run the P.S. I am trying to integrate OneSignal with
|
Hi @jakehasler, were you able to get everything working? Hi @AfrazHussain, thanks for pointing out the Can you share the error you get when the app crashes for Android? Were you able to run on iOS? Or you have not tried that yet? |
Hey, I'd like to try this out but wanted to check whether you expect it to be compatible with the "onesignal-expo-plugin" already? Update: I tried it and get the following error. Using Expo SDK 49 and onesignal-expo-plugin v1.3.2:
|
Hello the only issue regarding iOS - it was failing during the build because of error I recreated However, I haven't got success with Android, it builds fine, but when I call
Note: We use RevenueCat in our app, but we don't use Amazon, so this is a weird error... |
Android, 33 SDK, 5.0.0 released version. OneSignal.initialize('appId');
console.log(OneSignal.Notifications.hasPermission()); // false
await new Promise(resolve => setTimeout(resolve, 500));
console.log(OneSignal.Notifications.hasPermission()); // suddenly true Calling |
this is because the library silently changed the XCFramework name from The import at the top of the NotificationService.swift file needs to be changed from: import OneSignal to import OneSignalExtension |
I've experienced that as well but not anymore (it seems... :sigh:). On my side. Similar / related issue (?!): OneSignal.Notifications.hasPermission() Returns And then if I try to Basically I cannot rely on Strange (hint?): |
I am seeing the same thing as @eightyfive where the Is the solution for now to just add in a timeout? This makes me feel there is a race condition happening but the types do not indicate there is a promise returned for any of these methods. |
having the same issue on v5.0.1, were you able to solve it? |
nope... we with the team decided to stay on v4.*, we needed to release our app ASAP, so we could not wait until v5 became stable... But probably we'll get back to this at some point |
same here, we're going to stay on v4 until v5 is production ready. |
My solution which seems to work is adding a timeout, try the following code and let me know if it also works for you: // Set the `permissionGranted` on first load based on device permission
useEffect(() => {
const setInitialPermission = async () => {
const granted = OneSignal.Notifications.hasPermission();
console.log('INITIAL PERM', granted);
setPermissionGranted(granted ?? null);
};
// FIXME: Hack to get correct value from `hasPermission()`
// @see https://github.com/OneSignal/react-native-onesignal/issues/1506#issuecomment-1706332448
setTimeout(setInitialPermission, 0);
}, []); I am using this to set some local state which should be in sync with the permission: If you are also trying to do that you may also need to listen to permission change event: |
Any update on this? We have implemented v5 but waiting for this to push to production. When we use |
I think that's been fixed in the just-released 5.0.3: https://github.com/OneSignal/react-native-onesignal/releases/tag/5.0.3 |
This should be part of the Migration Guide.. Otherwise people need to go through installing guide and might fail to see the change in the code. |
In this major version beta release for the OneSignal SDK, we are making a significant shift from a device-centered model to a user-centered model. A user-centered model allows for more powerful omni-channel integrations within the OneSignal platform.
For more information please see the migration guide.
🚧 Beta release. It is not recommended to use in production. 🚧
Please post any feedback related to the beta here!
The text was updated successfully, but these errors were encountered: