Skip to content

Commit 4ac3ec1

Browse files
committed
refactor: update comments with workarounds for native driver
1 parent 917cbba commit 4ac3ec1

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

android/src/main/java/com/animatedobserver/AnimatedObserverViewManager.kt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,11 @@ class AnimatedObserverViewManager : SimpleViewManager<View>(),
8787

8888
companion object {
8989
const val NAME = "AnimatedObserverView"
90+
91+
/**
92+
* On Android, it's necessary to use `top` prefix for event names
93+
* Otherwise it doesn't work with `Animated.event` using `useNativeDriver: true`
94+
*/
9095
const val EVENT_ON_CHANGE = "topValueChange"
9196
}
9297
}

ios/AnimatedObserverView.mm

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,9 @@ - (instancetype)initWithFrame:(CGRect)frame
4747
});
4848
}
4949

50-
// This is temporary workaround to allow animations based on onPageScroll event
51-
// until Fabric implements proper NativeAnimationDriver,
52-
// see: https://github.com/facebook/react-native/blob/44f431b471c243c92284aa042d3807ba4d04af65/packages/react-native/React/Fabric/Mounting/ComponentViews/ScrollView/RCTScrollViewComponentView.mm#L59
50+
// FIXME:
51+
// Workaround to make `onValueChange` work with `Animated.event` using `useNativeDriver: true`
52+
// See: https://github.com/facebook/react-native/blob/44f431b471c243c92284aa042d3807ba4d04af65/packages/react-native/React/Fabric/Mounting/ComponentViews/ScrollView/RCTScrollViewComponentView.mm#L59
5353
ValueChangeEvent *event = [[ValueChangeEvent alloc] initWithReactTag:@(self.tag)
5454
value:value];
5555
NSDictionary *userInfo = @{@"event": event};

0 commit comments

Comments
 (0)