Allow listener for native Animated.event

Summary:
We used to not send events to JS when there was a native Animated.event but we do now so we can easily enable the listener property.

**Test plan**
Tested that the listener gets called when using native Animated.event.
Closes https://github.com/facebook/react-native/pull/12323

Differential Revision: D4556407

fbshipit-source-id: 0b17f331a352d03a47f1611c667433fd5a58696c
This commit is contained in:
Janic Duplessis 2017-02-16 00:18:33 -08:00 committed by Facebook Github Bot
parent c728915944
commit 33817b83d6
1 changed files with 4 additions and 4 deletions

View File

@ -2162,10 +2162,6 @@ class AnimatedEvent {
this._listener = config.listener;
this.__isNative = shouldUseNativeDriver(config);
if (this.__isNative) {
invariant(!this._listener, 'Listener is not supported for native driven events.');
}
if (__DEV__) {
this._validateMapping();
}
@ -2215,6 +2211,10 @@ class AnimatedEvent {
}
__getHandler() {
if (this.__isNative) {
return this._listener;
}
return (...args) => {
const traverse = (recMapping, recEvt, key) => {
if (typeof recEvt === 'number' && recMapping instanceof AnimatedValue) {