-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
feat: react-native-reanimated as peer dependency #4912
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 6 commits
08343f3
bef730d
a4cfceb
f912d81
27250d0
3b7b371
4f137ce
0136f95
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,4 @@ | ||
| module.exports = { | ||
| presets: ['module:@react-native/babel-preset'], | ||
| plugins: ['react-native-worklets/plugin'], | ||
| }; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -18,6 +18,14 @@ npm install react-native-paper | |
| npm install react-native-safe-area-context | ||
| ``` | ||
|
|
||
| - You also need to install [react-native-reanimated](https://docs.swmansion.com/react-native-reanimated/) and [react-native-worklets](https://docs.swmansion.com/react-native-worklets/) for animations. | ||
|
|
||
| ```bash npm2yarn | ||
| npm install react-native-reanimated react-native-worklets | ||
| ``` | ||
|
|
||
| - Follow the [React Native Reanimated installation guide](https://docs.swmansion.com/react-native-reanimated/docs/fundamentals/getting-started/) for your toolchain (Expo vs React Native Community CLI). **Community CLI** setups must add `'react-native-worklets/plugin'` **last** in your `babel.config.js` `plugins` array. **Expo** setups follow that guide’s Expo steps (install packages and rebuild native code); starter templates [since Expo SDK 50](https://expo.dev/changelog/2024/01-18-sdk-50) usually include the Worklets Babel plugin already—add it only if your `babel.config.js` does not. Paper declares **minimum** supported versions for `react-native-reanimated` and `react-native-worklets` under `peerDependencies` in [`package.json`](https://github.com/callstack/react-native-paper/blob/main/package.json) (`>=` ranges, not pinned versions). When troubleshooting animation or native build problems, confirm your installed packages meet those minimums. | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Avoid wall of text, make this bullet points so it's readable. After adding tabs as per previous comment, move relevant part to it's own tab so there is less to read.
We don't need to say we declare peer deps. User will get the warning/error if they don't match it from package manager. " Minimum requirements:
- `react-native` [version]
- `expo` [version]
- `react-native-safe-area-context` [version]
- etc. |
||
|
|
||
| Additionaly for `iOS` platform there is a requirement to link the native parts of the library: | ||
|
|
||
| ```bash | ||
|
|
@@ -40,7 +48,7 @@ If you use Expo, you don't need to install vector icons - those are the part of | |
|
|
||
| :::info | ||
| If you don't want to install vector icons, you can use [babel-plugin-optional-require](https://github.com/satya164/babel-plugin-optional-require) to opt-out. | ||
| :::note | ||
| ::: | ||
|
|
||
| ### Bundle size optimization | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| import { setUpTests } from 'react-native-reanimated'; | ||
|
|
||
| setUpTests(); |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -96,7 +96,9 @@ | |
| "react-dom": "18.3.1", | ||
| "react-native": "0.82.1", | ||
| "react-native-builder-bob": "^0.21.3", | ||
| "react-native-reanimated": "^4.3.0", | ||
| "react-native-safe-area-context": "5.5.2", | ||
| "react-native-worklets": "^0.8.1", | ||
| "react-test-renderer": "19.1.1", | ||
| "release-it": "^13.4.0", | ||
| "rimraf": "^3.0.2", | ||
|
|
@@ -105,7 +107,9 @@ | |
| "peerDependencies": { | ||
| "react": "*", | ||
| "react-native": "*", | ||
| "react-native-safe-area-context": "*" | ||
| "react-native-reanimated": ">=4.3.0", | ||
| "react-native-safe-area-context": "*", | ||
| "react-native-worklets": ">=0.8.1" | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just a comment, not necessarily requesting changes as I'm not sure about best practices for
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not quite sure here as well. I think Paper should only states minimums; Reanimated’s own peerDependencies and the app’s lockfile are where compatible worklets / Reanimated pairings are enforced.
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm fine having the minimums for peer dependencies, we just need to make sure this is described on documentation for user troubleshooting purposes. |
||
| }, | ||
| "husky": { | ||
| "hooks": { | ||
|
|
@@ -119,6 +123,7 @@ | |
| "<rootDir>/testSetup.js" | ||
| ], | ||
| "setupFilesAfterEnv": [ | ||
| "<rootDir>/jestSetupAfterEnv.js", | ||
| "@testing-library/jest-native/extend-expect" | ||
| ], | ||
| "cacheDirectory": "./cache/jest", | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need to make installation multiple steps. There should be a single installation step that installs both safe area context and reanimated + worklets.
We should also mention the installation steps for Expo. Example:
Then under the description we have 2 tabs, Expo and Community CLI and have commands that shows how to install (Expo willl use
expo install).The previous "From v5" wording also seems unncessary, this documentation refers to the latest version so there is no need to mention this.