OneSignal-Website-SDK
OneSignal-Website-SDK copied to clipboard
How use custom link button after initialize OneSignal?
Description:
Hi, I'm using a React app and I have a component called Settings that initialize OneSignal and renders the custom link button. And It works perfect! But If I use another component, the button will be "destroyed", and If I try to load Settings again, the custom link button won't appear... how can I achieve this?
Thanks for the help
Steps to Reproduce Issue:
- Initialize OneSignal with the custom link button on the dom
- Remove the custom link button of the dom
- Insert the custom link button again
But If I use another component, the button will be "destroyed", and If I try to load Settings again, the custom link button won't appear... how can I achieve this?
What do you mean here? What other component are you using?
Oh, I mean that if the button is unloaded from the dom, and then loaded again, the button won't work because OneSignal was already initialized
I see. If you add the css class "onesignal-customlink-container"
the button should work. Instead of unmounting the component, you could try toggling its visibility.
I see... I can’t do that, don’t worry then but thanks for the reply!
By the way, could be great if OneSignal could have a method that “fills” any div with the css class like... OneSignal.activeCustomLink() 😜
El 12 ago 2019, a las 22:58, Rodrigo Gomez Palacio [email protected] escribió:
I see. If you add the css class "onesignal-customlink-container" the button should work. Instead of unmounting the component, you could try toggling its visibility.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.
I'll mark this as a feature request. Cheers!
@rgomezp: I'm very interested in this feature as well.
Is there currently any way to achieve this? Or is it somehow possible to completely destroy the OneSignal SDK and re-initialize it after the the element is re-added to the DOM?
Why is this marked as "Closed" if there is no solution given?