From f88f9a3dcd6d288f78ec83ea48560fe99cbfddd1 Mon Sep 17 00:00:00 2001 From: Patrick Wehbe Date: Sat, 20 Jun 2026 14:06:50 +0300 Subject: [PATCH] fix: declare react and react-native as peer dependencies The package only listed react and react-native under devDependencies and had no peerDependencies field. In pnpm monorepos with strict (default) node-linker, a package only resolves the dependencies it declares, so the slider would not link the host app's react/react-native. That results in a second copy of React being loaded and the classic 'Invalid hook call. Hooks can only be called inside of the body of a function component' runtime error. Declaring react and react-native as peers lets the package manager deduplicate them against the host app's installed versions. Wide '*' ranges follow the convention used by other callstack React Native libraries such as react-native-paper, since the slider supports a broad range of React Native versions. The pinned dev versions are kept for the example app and tests. Fixes #769 --- package/package.json | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/package/package.json b/package/package.json index 63179687..08e7084e 100644 --- a/package/package.json +++ b/package/package.json @@ -53,6 +53,10 @@ "react-test-renderer": "^19.2.0", "typescript": "^5.0.4" }, + "peerDependencies": { + "react": "*", + "react-native": "*" + }, "repository": { "type": "git", "url": "https://github.com/callstack/react-native-slider.git"