jordanbyron / react-native-quick-actions

A react-native interface for Touch 3D home screen quick actions
MIT License
1.05k stars 94 forks source link

Provide full flow support and addListener without calling DeviceEventEmitter #6

Open jordanbyron opened 8 years ago

jordanbyron commented 8 years ago

Support for:

var QuickActions = require('react-native-quick-actions');

QuickActions.addListener(function(data) {
  // Do some cool stuff
});

It would be cool if registered listener callbacks are also processed when the app is launched via the new popInitialGesture method.

grabbou commented 8 years ago

It would be cool if registered listener callbacks are also processed when the app is launched via the new popInitialGesture method.

I am not sure if handlers should be called as far as compliance with PushNotifications is considered.

As per Flow support, I can give it a go as well while implementing #7 if you don't mind ;)

PS. Thanks for converting my todos from my PR to issues!

jordanbyron commented 8 years ago

I am not sure if handlers should be called as far as compliance with PushNotifications is considered.

You're probably right that we shouldn't deviate too much from existing conventions. I just know from my personal usage of this component I thought it felt a bit clunky having to register the handler twice. Once for normal events and another for initial actions.

As per Flow support, I can give it a go as well while implementing #7 if you don't mind ;)

Go for it! I appreciate the help :smile:

grabbou commented 8 years ago

Yeah, but on the other hand, that's how LinkingIOS and PushNotificationsIOS all work, so I have them all in one place, which is really nice. Up to you, but I would've stayed with that approach. Otherwise, if one have handler for initial action and for event emitter - handler may get invoked twice resulting in e.g. same view presented twice etc.