1

I'm using Redux saga and OneSignal in my React Native app. In my saga I have the following generator function:

function* getOneSignalIDs() {
    try {
        OneSignal.init(appID)
        OneSignal.addEventListener('ids', (device) => {
            yield put(OneSignalActionCreators.getOneSignalIDsSuccess(device.pushToken, device.userId));
        });
    } catch(error) {}
}

The problem with this code is that yield put has to be inside a generator function, but my event listener isn't a generator.

Does anyone know how I can approach this?

gkeenley
  • 2,920
  • 1
  • 18
  • 45
  • Does this answer your question? [How to tie emitted events events into redux-saga?](https://stackoverflow.com/questions/35277682/how-to-tie-emitted-events-events-into-redux-saga) – ArchNoob May 03 '20 at 00:24
  • Did you solve this problem? – Shawn Sep 13 '20 at 13:11

0 Answers0