You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+15-2Lines changed: 15 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,10 +1,13 @@
1
1
# react-native-animated-observer
2
2
3
+
[![npm][version-badge]][version]
4
+
[![MIT License][license-badge]][license]
5
+
3
6
Helpers that let you observe value of an [`Animated.Value`][animated.value] or [`SharedValue`][reanimated.sharedvalue] and convert between them using native events.
4
7
5
8
## Use case
6
9
7
-
You use a component that uses [`Animated`](https://reactnative.dev/docs/animated), but you use [`Reanimated`](https://docs.swmansion.com/react-native-reanimated/docs/) for your animations, or vice versa. With this library, you can convert your value to work with the component.
10
+
If you use a component that uses [`Animated`](https://reactnative.dev/docs/animated) and accepts animated values or styles, but you use [`Reanimated`](https://docs.swmansion.com/react-native-reanimated/docs/) for your app's animations, or vice versa. You can convert your values with this library to work with the component.
8
11
9
12
## Installation
10
13
@@ -48,7 +51,7 @@ A component that observes changes in a given value and emits an event when the v
48
51
It accepts the following props:
49
52
50
53
-`value`: The value to observe. It can be a `number`, [`Animated.Value`][animated.value], or [`SharedValue`][reanimated.sharedvalue].
51
-
-`onValueChange`: A callback function that is called when the observed value changes. This function can integrate with [`Animated.event`](https://reactnative.dev/docs/animated#event) or [`useEvent`](https://docs.swmansion.com/react-native-reanimated/docs/advanced/useEvent).
54
+
-`onValueChange`: A callback function that is called when the observed value changes.
The library uses the native event system to observe changes in the values of [`Animated.Value`][animated.value] and [`SharedValue`][reanimated.sharedvalue]. When a value changes, the library emits an event that can be listened to by the components.
76
+
77
+
This event is then used with [`Animated.event`](https://reactnative.dev/docs/animated#event) (with native driver) or [`useEvent`](https://docs.swmansion.com/react-native-reanimated/docs/advanced/useEvent) to update [`Animated.Value`][animated.value] or [`SharedValue`][reanimated.sharedvalue] respectively depending on the usage.
78
+
70
79
## Contributing
71
80
72
81
See the [contributing guide](CONTRIBUTING.md) to learn how to contribute to the repository and the development workflow.
@@ -81,3 +90,7 @@ Made with [create-react-native-library](https://github.com/callstack/react-nativ
0 commit comments