Sam Zhou
|
41f525ccae
|
Pre-suppress unsafe string key access errors in xplat/js (#44221)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44221
This diff pre-suppresses errors of the following pattern, to prepare for the next Flow release.
```
declare const obj: {foo: string};
declare const key: string;
obj[key]; // error: invalid-computed-prop
```
Changelog: [Internal]
Reviewed By: alexmckenley
Differential Revision: D56477899
fbshipit-source-id: 5676b8685bd3157a519fe433cfce0fa28e003502
|
2024-04-23 11:36:14 -07:00 |
|
Pranav Yadav
|
8a49754cda
|
Refactor: JS substr() is deprecated, using slice() instead (#37136)
Summary:
Fixes: https://github.com/facebook/react-native/issues/37135
- `substr()` is not part of the core JS since ~2018
- No wonder why no one noticed this :)
- Though its supported by modern browsers, its deprecated
- Reference: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/substr
### Why `slice()` and not `substring()`?
> Beacuse I like pizza ;) jk
The reason, that I'm not using the most obvious alternative `substring()` is;
- It _swaps the args_ passed, when; `startIndex > endIndex` —which I think is not a property of _good_ fn
and also does not reflects the same in it's name.
- It _doesn't support negative args_, which I think reduces flexibility to work with it.
- It could lead to more bugs in most of the cases.
### Refecrences:
- Ref: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/substring#differences_between_substring_and_slice
- Ref. for `slice()`: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/slice
- Ref. for `substring()`: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/substring
## Changelog:
[GENERAL][FIXED] - Refactor: `substr()` is deprecated, using `slice()` instead across RN codebase
Pull Request resolved: https://github.com/facebook/react-native/pull/37136
Test Plan: - `yarn lint && yarn flow && yarn test-ci` --> _should be green_
Reviewed By: christophpurrer
Differential Revision: D45477910
Pulled By: jacdebug
fbshipit-source-id: 96a80893477599b9a549918924157627b9b0c3f4
|
2023-05-02 11:28:56 -07:00 |
|
Andres Suarez
|
8bd3edec88
|
Update copyright headers from Facebook to Meta
Reviewed By: aaronabramov
Differential Revision: D33367752
fbshipit-source-id: 4ce94d184485e5ee0a62cf67ad2d3ba16e285c8f
|
2021-12-30 15:11:21 -08:00 |
|
Moti Zilberman
|
cb610ddca7
|
Assume *.ktx assets are packaged as Android drawables
Summary:
Updates React Native's asset runtime to look for `*.ktx` assets under `drawable-*` on Android.
This by itself does **not**:
1. Add runtime support for loading KTX images.
2. Update the OSS packager to actually package KTX files as drawables. (This will need to happen [here](https://github.com/react-native-community/cli/blob/cddb0c3fb06ef949ea689221c6167147af40e37f/packages/cli-plugin-metro/src/commands/bundle/assetPathUtils.ts#L39-L46).)
Changelog:
[Android][Changed] Assume *.ktx assets are packaged as Android drawables
Reviewed By: javache
Differential Revision: D32597214
fbshipit-source-id: 25007c1e0eba769ce9e484fa20da5f26890eb38d
|
2021-11-22 13:56:53 -08:00 |
|
Moti Zilberman
|
f22e6033d9
|
Support nonstandard pixel densities for Android drawables
Summary:
Adds functionality to RN's built-in version of the `getAndroidAssetSuffix` function. Open source uses a [fork of this code](https://github.com/react-native-community/cli/blob/df55a78f2d27e3443f15b15b87459b54a78e2c47/packages/cli/src/commands/bundle/assetPathUtils.ts#L19-L36) as part of the RN CLI and is therefore unaffected.
Specifically, we can now package drawable assets for Android with nonstandard pixel densities by placing them in [`drawable-<nnn>dpi`](https://developer.android.com/guide/topics/resources/providing-resources#:~:text=nnndpi), where `nnn` is a number representing a pixel density. Previously using nonstandard scale factors like `1.25x` would be a build-time error when building for Android.
We could send a corresponding PR to the RN CLI, but [Gradle doesn't support this convention](https://issuetracker.google.com/issues/72884435) (although it is documented and supported by Android) so it may not be of much use in OSS right away.
Changelog: [Internal]
Reviewed By: cortinico
Differential Revision: D30784087
fbshipit-source-id: ea82f924d14a316702cabba759722cf26f69eb21
|
2021-09-09 08:19:42 -07:00 |
|
Christoph Nakazawa
|
63377fa66b
|
Add @react-native/assets package for Asset Registry related code
Summary: Changelog: [Internal]
Reviewed By: GijsWeterings
Differential Revision: D22628865
fbshipit-source-id: 66ff311b2dab4e0c42f906d5a2642997b1570ae4
|
2020-07-23 05:07:40 -07:00 |
|