Commit Graph

4 Commits

Author SHA1 Message Date
Tim Yung 1977dd6596 RN: Sort Pragmas in Headers (#51554)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51554

Sorts pragma directives file headers in React Native.

Changelog:
[Internal]

Reviewed By: SamChou19815

Differential Revision: D75264593

fbshipit-source-id: 9e4b253dd0fc94dc2fc469d7114b93a8aae305f4
2025-05-22 21:18:53 -07:00
riteshshukla04 f5ae157820 Added more test cases for URL (#50768)
Summary:
I forgot to add toString and protocol in test cases last time when we merged this https://github.com/facebook/react-native/pull/50043

## Changelog:

<!-- Help reviewers and the release process by writing your own changelog entry.

Pick one each for the category and type tags:

[ANDROID|GENERAL|IOS|INTERNAL] [BREAKING|ADDED|CHANGED|DEPRECATED|REMOVED|FIXED|SECURITY] - Message

For more details, see:
https://reactnative.dev/contributing/changelogs-in-pull-requests
-->
[INTERNAL][ADDED] More Test cases

Pull Request resolved: https://github.com/facebook/react-native/pull/50768

Test Plan: Tested with yarn jest

Reviewed By: rshest, cipolleschi

Differential Revision: D73169665

Pulled By: cortinico

fbshipit-source-id: 1115c0ccce52a67663fcd60ef376ce7bde502d1f
2025-04-17 03:18:13 -07:00
Ritesh Shukla af1f1e4fe5 Implementation of URLSearchParams Methods (#50043)
Summary:
This PR addresses the following issues and enhances the functionality of `URLSearchParams`:

1. Extended Initialization Parameters: Previously, only `Record<string, string>` was supported while initialising  URLSearchParams. Now supports `string`, `Record<string, string>`, and `Array<[string, string]>` (aligning with web standards).

2. Added Implementation for `delete()`, `get()`, `getAll()`, `has()`, `sort()`, and `set()`.

3. Addition of Iteration Methods: Added  `keys()`, `values()`, `entries()`, and `forEach()`  methods.  Outputs are identical to web.

4. Bug Fix: Incorrect Initialization from URL. Previously, `URLSearchParams` was initialized with an empty value when accessed via `url.searchParams`, even if the `URL` contained search parameters.

## Changelog:
[General][Added] Implementation for URLSearchParams

Pull Request resolved: https://github.com/facebook/react-native/pull/50043

Test Plan:
Can be tested by below code
```js
  const isHermes = () => !!global.HermesInternal;
  const params = new URLSearchParams("");
  console.log("Is Hermes Enabled:-",isHermes())
  console.log("Values:", Array.from(params.values())); //  ["value1", "value2"]
  console.log("Keys:", Array.from(params.keys())); //  ["key1", "key2"]
  console.log("Entries:", Array.from(params.entries())); //  [["key1", "value1"], ["key2", "value2"]]
  params.forEach((value, key) => {
      console.log(`${key}: ${value}`);
  });
  console.log("Has 'key1'", params.has("key1")); //  true
  console.log("Has 'key3'", params.has("key3")); //  false
  console.log("Get 'key1':", params.get("key1")); //  "value1"
  console.log("Get 'key3':", params.get("key3")); //  null
```

Tested on both hermes and JSC.

Hermes:-
![image](https://github.com/user-attachments/assets/9a467001-693a-4e38-b349-e8d92f961808)

JSC:-
![image](https://github.com/user-attachments/assets/e5f89375-ede4-4ea0-9c62-f98f63c67188)

Reviewed By: cipolleschi

Differential Revision: D71965101

Pulled By: huntie

fbshipit-source-id: c0a0f965ac1ff9577cdc8b3c11f0dd0ced538868
2025-03-28 10:18:59 -07:00
Ritesh Kumar Shukla 3dac90006f Implementing url Methods (#49955)
Summary:
Implemented Methods in URL which were not implemented yet
The methods output are identical to outputs of window.url .

Fixes https://github.com/facebook/react-native/issues/45030

## Changelog:

<!-- Help reviewers and the release process by writing your own changelog entry.

Pick one each for the category and type tags:

[ANDROID|GENERAL|IOS|INTERNAL] [BREAKING|ADDED|CHANGED|DEPRECATED|REMOVED|FIXED|SECURITY] - Message

For more details, see:
https://reactnative.dev/contributing/changelogs-in-pull-requests
-->
[General][Added] URL accessors for unimplemented Methods

Pull Request resolved: https://github.com/facebook/react-native/pull/49955

Test Plan:
Code:-
<img width="558" alt="image" src="https://github.com/user-attachments/assets/a75e5429-0e03-4392-9fde-138c63b96ce5" />

Tested with Hermes
![image](https://github.com/user-attachments/assets/0075826a-df3a-4eae-a8f2-bec26be42fbf)

Tested with JSC
![image](https://github.com/user-attachments/assets/bcdbd430-5ee3-48a2-873f-7d823c9072f6)

Reviewed By: rshest

Differential Revision: D71113046

Pulled By: cortinico

fbshipit-source-id: 58093c61d2e7bb732d2f1af6b19508a100c86333
2025-03-14 05:22:48 -07:00