react / react/react-native

URL and URLSearchParams is not working

オープン
#38,656 コメント 5 件 リアクション 4 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

Issue: Author Provided Repro Needs: Triage :mag:
主要言語
C++
スター
127k
フォーク
25.3k
平均マージ
1日 23時間
マージ済み PR(30日)
4

説明

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

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

github.com/natanfeitosa/RNUrlBugReport にある React Native 0.72.3 の再現リポジトリで報告されている URL と URLSearchParams の挙動から始めてください。例を実行し、searchParams.get('search') と searchParams.toString() の両方を確認してください。これらの呼び出しがエラーなしで期待されるクエリ値とシリアライズされたパラメーターを返せば完了です。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
javascript, react-native
領域
mobile-dev
issue の種類
バグ
難易度
4/5
見積もり時間
3〜5日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
35/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。