Skip to content

Commit 8e8cc6f

Browse files
committed
docs: add badges
1 parent 970707f commit 8e8cc6f

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

README.md

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
11
# react-native-animated-observer
22

3+
[![npm][version-badge]][version]
4+
[![MIT License][license-badge]][license]
5+
36
Helpers that let you observe value of an [`Animated.Value`][animated.value] or [`SharedValue`][reanimated.sharedvalue] and convert between them using native events.
47

58
## Use case
69

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.
811

912
## Installation
1013

@@ -48,7 +51,7 @@ A component that observes changes in a given value and emits an event when the v
4851
It accepts the following props:
4952

5053
- `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.
5255

5356
Usage:
5457

@@ -67,6 +70,12 @@ const animatedValue = useRef(new Animated.Value(0)).current;
6770
/>;
6871
```
6972

73+
## How it works
74+
75+
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+
7079
## Contributing
7180

7281
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
8190

8291
[animated.value]: https://reactnative.dev/docs/animated#value
8392
[reanimated.sharedvalue]: https://docs.swmansion.com/react-native-reanimated/docs/core/useSharedValue/
93+
[version-badge]: https://img.shields.io/npm/v/react-native-animated-observer.svg?style=flat-square
94+
[license-badge]: https://img.shields.io/npm/l/react-native-animated-observer.svg?style=flat-square
95+
[version]: https://www.npmjs.com/package/react-native-animated-observer
96+
[license]: https://opensource.org/licenses/MIT

0 commit comments

Comments
 (0)