Skip to content

URL and URLSearchParams is not working #38656

Open
@natanfeitosa

Description

@natanfeitosa

Description

I was working with React Native and I needed to parse a URL to get a parameter, for that I used the URL class and got the serialized searchParams, but in every attempt it gave all kinds of errors.

const url = new URL('https://somesite.com/?search=param')

console.log(url.searchParams.get('search')) //  Throw 'URLSearchParams.get is not implemented'
console.log(url.searchParams.toString()) // ''

React Native Version

0.72.3

Output of npx react-native info

info Fetching system and libraries information...
System:
OS: Linux 5.4 Linux Mint 20 (Ulyana)
CPU: (2) x64 Intel(R) Core(TM)2 CPU 6400 @ 2.13GHz
Memory: 304.14 MB / 1.92 GB
Shell:
version: "5.8"
path: /usr/bin/zsh
Binaries:
Node:
version: 18.12.1
path: /usr/local/bin/node
Yarn:
version: 1.22.19
path: ~/.yarn/bin/yarn
npm:
version: 8.19.2
path: /usr/local/bin/npm
Watchman: Not Found
SDKs:
Android SDK: Not Found
IDEs:
Android Studio: Not Found
Languages:
Java:
version: 11.0.19
path: /usr/bin/javac
Ruby: Not Found
npmPackages:
"@react-native-community/cli": Not Found
react:
installed: 18.2.0
wanted: 18.2.0
react-native:
installed: 0.72.3
wanted: 0.72.3
npmGlobalPackages:
"react-native": Not Found
Android:
hermesEnabled: Not found
newArchEnabled: Not found
iOS:
hermesEnabled: Not found
newArchEnabled: Not found

Steps to reproduce

1 - Clone the repo
2 - Install its dependecies
3 - Run the project using your favorite platform
4 - Try to input some url

Snack, screenshot, or link to a repository

https://github.com/natanfeitosa/RNUrlBugReport

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions