Skip to content

Commit

Permalink
fix: polyfill url
Browse files Browse the repository at this point in the history
  • Loading branch information
dannyhw committed Sep 15, 2024
1 parent b262923 commit 3e43b40
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 0 deletions.
1 change: 1 addition & 0 deletions packages/react-native/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
"glob": "^7.1.7",
"prettier": "^2.4.1",
"react-native-swipe-gestures": "^1.0.5",
"react-native-url-polyfill": "^2.0.0",
"type-fest": "~2.19",
"util": "^0.12.4",
"ws": "^8.18.0"
Expand Down
9 changes: 9 additions & 0 deletions packages/react-native/src/Start.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
// @ts-ignore
if (!URLSearchParams.get) {
// We polyfill URLSearchParams for React Native since URLSearchParams.get is not implemented yet is used in storybook
// with expo this would never run because its already polyfilled
const { setupURLPolyfill } = require('react-native-url-polyfill');

setupURLPolyfill();
}

import { toId, storyNameFromExport, isExportStory } from '@storybook/csf';
import {
addons as previewAddons,
Expand Down
12 changes: 12 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4508,6 +4508,7 @@ __metadata:
jotai: "npm:^2.6.2"
prettier: "npm:^2.4.1"
react-native-swipe-gestures: "npm:^1.0.5"
react-native-url-polyfill: "npm:^2.0.0"
react-test-renderer: "npm:18.2.0"
tsup: "npm:^7.2.0"
type-fest: "npm:~2.19"
Expand Down Expand Up @@ -15746,6 +15747,17 @@ __metadata:
languageName: node
linkType: hard

"react-native-url-polyfill@npm:^2.0.0":
version: 2.0.0
resolution: "react-native-url-polyfill@npm:2.0.0"
dependencies:
whatwg-url-without-unicode: "npm:8.0.0-3"
peerDependencies:
react-native: "*"
checksum: 10/6a8d605eeb1b0ee9b0f47f1866acc2edfa2131a4a8fb1ea3839ceb507e225b894ed66f49a3bd826fc964f2c8005b3678c9d3b65d07eb0a3b979be830cb618686
languageName: node
linkType: hard

"react-native-web@npm:~0.19.10":
version: 0.19.12
resolution: "react-native-web@npm:0.19.12"
Expand Down

0 comments on commit 3e43b40

Please sign in to comment.