OneSignal-Website-SDK icon indicating copy to clipboard operation
OneSignal-Website-SDK copied to clipboard

How use custom link button after initialize OneSignal?

Open ayozebarrera opened this issue 4 years ago • 7 comments

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:

  1. Initialize OneSignal with the custom link button on the dom
  2. Remove the custom link button of the dom
  3. Insert the custom link button again

ayozebarrera avatar Aug 05 '19 13:08 ayozebarrera

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?

rgomezp avatar Aug 05 '19 19:08 rgomezp

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

ayozebarrera avatar Aug 06 '19 08:08 ayozebarrera

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.

rgomezp avatar Aug 12 '19 21:08 rgomezp

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.

ayozebarrera avatar Aug 12 '19 22:08 ayozebarrera

I'll mark this as a feature request. Cheers!

rgomezp avatar Aug 12 '19 23:08 rgomezp

@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?

theigl avatar May 06 '20 09:05 theigl

Why is this marked as "Closed" if there is no solution given?

TimothyStulens avatar Sep 20 '22 07:09 TimothyStulens