Permalink
Browse files

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 #12323

Differential Revision: D4556407

fbshipit-source-id: 0b17f331a352d03a47f1611c667433fd5a58696c
  • Loading branch information...
janicduplessis authored and facebook-github-bot committed Feb 16, 2017
1 parent c728915 commit 33817b83d6c7d6b4cf5d8c250ee88a2c401422a1
Showing with 4 additions and 4 deletions.
  1. +4 −4 Libraries/Animated/src/AnimatedImplementation.js
@@ -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) {

0 comments on commit 33817b8

Please sign in to comment.