0.64 stable -> 0.62 stable#34197
Conversation
…0121) Summary: This PR changes ReadableNativeMap.getNullableValue to return null if key not found, instead of throwing exception. This matches method signature and nullable annotation. ## Changelog [Android] [Changed] - fix ReadableNativeMap.getNullableValue to match signature Pull Request resolved: facebook#30121 Test Plan: RNTester app builds and runs as expected, and getNullableValue will return null instead of throwing exception. Reviewed By: JoshuaGross Differential Revision: D24164302 Pulled By: fkgozali fbshipit-source-id: 572c1d4ae5fd493aa0018c2df1dfc7fc91cb4b6b
Summary: According to Node's documentation: https://nodejs.org/api/util.html#util_util_inspect_object_showhidden_depth_colors > The util.inspect() method returns a string representation of object that is intended for debugging. **The output of util.inspect may change at any time and should not be depended upon programmatically.** Therefore, this diff switches over our RN Codegen snapshot tests to use a `JSON.stringify` call, followed by a replace of `"` with `'`. This gets the job done without compromising readability. **Question:** Why do we not use `"`? A: Jest escapes all `"` in the snapshots, which makes reading the snapshots/using them in the console harder. Changelog: [Internal] Reviewed By: hramos Differential Revision: D24157056 fbshipit-source-id: 2f1aa2df28ac3ed4aa17bcdbcd23846ddbf804cf
Summary: dispatchDraw, dispatchGetDisplayList, updateDisplayListIfDirty, recreateChildDisplayList, etc, can all crash internally for a variety of reasons and it can be very tricky to track down the root cause. This isn't a fix, this just adds extra logging to hopefully make debugging easier. Changelog: [Internal] Reviewed By: shergin Differential Revision: D24166149 fbshipit-source-id: 1bbaf34a92a9bcac5a594a25522c66e6e0cc80ca
… ReactRootView.onLayout Summary: In D23640968 (facebook@78b42d7) I introduced a mechanism to update offsetX/offsetY whenever onMeasure/onLayout were called, to ensure that `measureInWindow` had the correct metrics and would work properly. However, now `uiManager.updateRootLayoutSpecs` gets spammed and is called too often. For example, whenever a TextInput is focused/blurred, `uiManager.updateRootLayoutSpecs` may be called 5+ times even though the measure specs/offsets may only change once. Thus, we just compare with previous values before calling into the UIManager. This should give us a very small perf improvement. Changelog: [Internal] Reviewed By: shergin Differential Revision: D24176867 fbshipit-source-id: f0dcc816e651a843607e9e5d40d8f3489894d4ba
Summary: This PR removes unused `qs` package (query string parser) from the main `package.json` file. I was not able to find any explicit usage of this package in the repository. Looking at the commit which introduced this package it is not clear why it has been added, query string is not processed in any way. I have also run ` yarn update-lock` to clean up lock after latest dependencies bumps. There are no `qs` package entry removal in yarn lock, because it is already required by `request` package. Refs: facebook@b4785e5 ## Changelog <!-- Help reviewers and the release process by writing your own changelog entry. For an example, see: https://github.com/facebook/react-native/wiki/Changelog --> [Internal] [Removed] - remove unused `qs` dependency Pull Request resolved: facebook#30125 Test Plan: This change should not affect the code base. Reviewed By: appden Differential Revision: D24184372 Pulled By: cpojer fbshipit-source-id: 4f159f3c554c48ed21839370c8370848df181046
Summary: This is a revert of D22488870 (facebook@521b167). (facebook#29177) We have to revert it because we realized that it's a breaking change without a very good reason. We have to figure out a better way to unify platform behaviors. Changelog: [iOS][Fixed] - Reverted recent change in TextInput (facebook#29177) Reviewed By: fkgozali Differential Revision: D24200517 fbshipit-source-id: af0e561a6b8d9ade487be6b197a5d79d326442b6
Summary: Use the ObjC++ native modules files generated by `react-native-codegen` for the FBReactNativeSpec library. People working with the core native modules may now re-generate these ObjC++ files using `USE_CODEGEN=1 pod install` or `scripts/generate-native-modules-specs.sh`. Changelog: [Internal] Reviewed By: RSNara Differential Revision: D22249978 fbshipit-source-id: a12db23defacdba36099a24ce0b8475c8973bd6d
…d ID Summary: There are cases under investigation where unmountReactApplication is called before the ReactRootView gets an ID; in some or all of those cases, UIManagerBinding.stopSurface cannot get the ReactFabric JSI module and crashes there. It's still unclear why `unmountReactApplication` is being called in these circumstances - maybe another crash causing React Native teardown? Changelog: [Internal] Reviewed By: sammy-SC Differential Revision: D24214712 fbshipit-source-id: 796594653f4ff6d87088c4841b89f06cc873b46f
Summary: Types First and the various esproposal flags are on by default as of 0.135 Clean up flowconfigs that have to be in sync with the main one Changelog: [Internal] Reviewed By: jimmy623 Differential Revision: D24221995 fbshipit-source-id: 5da2867e2f013ad729a436ada192ecab690cb413
Summary: Just helpful for debugging sessions. Changelog: [Internal] Reviewed By: sammy-SC Differential Revision: D24207622 fbshipit-source-id: 904cbaa4512c03581d6a5c3efd69ebfca7972d42
Summary: We're planning a fix in Flow (D24112595) that uncovers some existing errors that were previously suppressed. Adding these annotations prevents them from surfacing during the deploy of the fix. Changelog: [Internal] Reviewed By: dsainati1 Differential Revision: D24147994 fbshipit-source-id: fef59a9427da6db79d4824e39768dd5ad0a8d1a3
Summary: Changelog: [internal] RCTViewComponent view should have multipleTouchEnabled set to YES. Paper has it enabled by default as well. Reviewed By: JoshuaGross, yungsters Differential Revision: D24219076 fbshipit-source-id: 74c18632457147b944a8abbacdbecb57e57f62ef
…just immediate and delayed mutation indices at the same time Summary: Index adjustment is tricky. Seems more reliable to adjust each immediate mutation, and then immediately adjust delayed mutations based on it, rinse and repeat. Previously it was possible to construct examples where the UI would get into a weird state because index adjustment caused items to be inserted in the wrong location. Changelog: [Internal] Reviewed By: kacieb Differential Revision: D24232926 fbshipit-source-id: f8c445213528c2d2aedacf3e0c73c5bbeb62bc3d
Summary: Changelog: [Internal][Changed] - export types of performance logger Reviewed By: rubennorte Differential Revision: D24099293 fbshipit-source-id: 023459baa3754fb8bfaf6bf7a9061873af5756f9
Summary: ## Previously - When TurboModules system was on, we'd only log events from the TurboModules system. - When TurboModules system was off, we'd only log events from the NativeModule system. This ultimately gives us less data to analyze both systems in production. ## Changes in This Diff When perf. logging is on, we'll log events from both systems. Each QPL event now include an annotation of which system the event is coming from. Concretely, this will allow us to see how much of the NativeModule system is being exercised in the TurboModule test group. Changelog: [Internal] Reviewed By: hramos Differential Revision: D24232594 fbshipit-source-id: 7dff57bd74fc7ef744d3e06ff174304f25790456
… inspector Summary: When taking a heap timeline, Hermes wasn't showing any data until the timeline was written to disk and then reloaded. Turns out we were missing support for two events: * `HeapProfiler.lastSeenObjectId`: This event reports the most recently allocated object ID. Used to know when objects were allocated in the timeline. * `HeapProfiler.heapStatsUpdate`: Report how many objects and bytes exist for a "time fragment", represented by a fragment index. Later updates to the same index can decrease the amount of live memory, which show up as grey spikes instead of blue spikes Previously, we only supported these by writing out to a file, and they didn't work with a "live" profiling view. To fix this, I changed the periodic sampling thread to instead be a periodic flush of a sample every few allocations. The performance impact is tucked away only when profiling is turned on, and it's very non-invasive to the rest of the GC. The flush calls a callback with the relevant information if the inspector is on, and the inspector sends a message back to the browser. Changelog: [Internal] Fix for Hermes heap timeline profiling Reviewed By: neildhar Differential Revision: D23993363 fbshipit-source-id: 8e0b571130cbb7e839dfb009b04f584f5179085d
Summary: This makes a few change to the template xcodeproj - Update to recommended settings for Xcode 12 - Remove the main.jsbundle file that doesn't exists, this file is included automatically in the app bundle and doesn't need to be in xcode (it won't even be at that path). - Add -e to the bundle images script. It seems like Xcode doesn't fail the build on script errors anymore so this makes it so the build stop. If it doesn't stop the app will launch and crash because the bundle doesn't exist (note this is only if running the app in release mode since in debug we don't generate the bundle). ## Changelog [iOS] [Added] - Update template to xcode 12 Pull Request resolved: facebook#30150 Test Plan: Made the same changes in an app and made sure it ran well. Reviewed By: cpojer Differential Revision: D24237481 Pulled By: sammy-SC fbshipit-source-id: 2b06a24c510c423eb45a1a840ea365b64506321b
Summary: This PR attempts to fix issue facebook#28278 and facebook#29525 On Crashlytics, the following error occurs in file `RCTWebSocketModule.m` at method `-[RCTWebSocketModule webSocket:didFailWithError:]` when a nil value is inserted into a dictionary as a value. ``` Fatal Exception: NSInvalidArgumentException *** -[__NSPlaceholderDictionary initWithObjects:forKeys:count:]: attempt to insert nil object from objects[0] ``` This PR is following the suggestion of this: facebook#28278 (comment) and it replaces the values of any property if it is nil. In detail: - it converts `error` to empty NSString if the original value is nil - it converts `socketID` to a NSNumber object, which stores `-1` if the original value is nil ## Changelog [iOS] [Fixed] - A crash in WebSocket module Pull Request resolved: facebook#30066 Test Plan: We were not able to reproduce the crash, but the report itself provided enough information to find a solution for this issue. Reviewed By: shergin Differential Revision: D24241147 Pulled By: sammy-SC fbshipit-source-id: d5d632b49ca77b5d8be8b9c32358bef68f17d30a
Summary: Changelog: [Internal] If `uiTouch.view` isn't managed by Fabric, go up the view hierarchy to find first view that is. This is important for host views wrapped by <Touchable>, otherwise touches are not delivered to the component. Reviewed By: yungsters Differential Revision: D24219223 fbshipit-source-id: 17b4e3460735371553ee0d30b41776a977f8eafb
Summary: This small PR adds missing [`clearColor`](https://developer.apple.com/documentation/uikit/uicolor/1621945-clearcolor?language=objc) to the avaiable PlatformColors on iOS. **Please let me know** if you would like to see ["Fixed colors"](https://developer.apple.com/documentation/uikit/uicolor/standard_colors?language=objc) added to the `PlatformColors`. I can address this within this PR or create a separate one. ## Changelog <!-- Help reviewers and the release process by writing your own changelog entry. For an example, see: https://github.com/facebook/react-native/wiki/Changelog --> [iOS] [Added] - PlatformColors: add missing `clearColor` Pull Request resolved: facebook#30054 Test Plan: [(I had to disable the Dark Mode to fix the RNTester readability problems)](https://user-images.githubusercontent.com/719641/94453196-b35cb000-01b0-11eb-8d7d-73d48ceecf53.PNG) Transparent/clear color has been added to the RNTester PlatformColors API example:  Reviewed By: shergin Differential Revision: D24241160 Pulled By: sammy-SC fbshipit-source-id: 41fb51677329cc3b3f915d5d08694c07b4ef2cf3
Summary: shergin added a new assert to dimensions calculations in D24038911 (facebook@e853722). This crashes in bridgeless mode b/c no bridge. This diff uses `turboModuleRegistry` as a bridge workaround. The registry is a [weak property](https://www.fburl.com/diffusion/sunv3bx9) so retain cycles shouldn't be an issue here, let me know if that's incorrect. As a nice bonus, this fixes dynamic font sizing in bridgeless mode. It was broken before since it relied on the bridge. Changelog: [Internal] Reviewed By: ejanzer Differential Revision: D24256338 fbshipit-source-id: 141d36239ac6a6e9e87ca96eea7aeec56729095d
Summary: RNTester has some imports left over that operate on directory traversal, assuming it is contained within react-native sources. This change makes these imports relative to react-native, enabling usage outside of the RN repo. Relates to microsoft/react-native-windows#6210 ## Changelog [Internal] [Fixed] - Avoid File Structure Assumptions in RNTester Imports Pull Request resolved: facebook#30141 Test Plan: Validated we can bundle and flow-check both iOS + Android Reviewed By: cpojer Differential Revision: D24259628 Pulled By: appden fbshipit-source-id: 0c21b5d354b01785d8402599da3b0a5be81b4c6d
…up races with NativeAnimatedModule setup Summary: When switching between non-Fabric and Fabric screens, I believe that `initializeEventListenerForUIManagerType` is not always being called on the NativeAnimatedNodesManager if `NativeAnimatedModule.initializeLifecycleEventListenersForViewTag` is being called before the NativeAnimatedNodesManager ivar has been set. This should occur very infrequently, but logs indicate that it /does/ happen in some marginal cases. Protecting against these cases should be trivial, by using the `getNodesManager` method which is responsible for returning a nodes manager or creating a new one. The existing uses of the `NativeAnimatedNodesManager` ivar also occur on different threads and we were not protecting against this, so I'm changing it to an atomic. It's very likely that the inconsistency issues in the past were caused not by ordering errors, but thread races. Changelog: [Internal] Reviewed By: fkgozali Differential Revision: D24267118 fbshipit-source-id: 68abbff7ef3d0b2ecc9aa9977165663ad9447ab8
Summary: This is a starting point for the handwritten Fabric Picker component. It is incomplete, and needs to be landed with the rest of the stack above it. In general, this creates a new `ComponentView`, `ComponentDescriptor`, `ShadowNode`, `Props` and a few other boilerplate classes for Picker. A bunch of the logic in `ComponentView` was copied over from the Paper `RCTPicker` and `RCTPickerManager`. What works in this diff: - A `<Picker>` with items can be created in JS, and a corresponding `UIPicker` is created in native with placeholder text, default styling and the correct amount of items What doesn't work yet (implemented in later diffs): - Parsing items to use correct text and styling in native - Events/commands Reviewed By: sammy-SC Differential Revision: D23941821 fbshipit-source-id: e049ca6004757fbd1361985644d5dbb8f53e1ce6
Summary: This builds on previous diff to properly parse `<Picker.Item/>` into a cpp struct. This fixes the dummy text and text color TODOs. Changelog: [iOS][Fabric] Fabric Picker support Reviewed By: sammy-SC Differential Revision: D23964557 fbshipit-source-id: f42c6c9cf410bfc5e66ff078645b6378548481de
Summary: Implements `onChange` prop for `<Picker/>`. Changelog: [iOS][Fabric] Fabric Picker support Reviewed By: sammy-SC Differential Revision: D23975689 fbshipit-source-id: 7aa81c203d420a8971e4309911a41ecfd377a318
Summary:
This adds support for `<Picker style={}/>` prop for text styling. It reuses most of conversion logic from BaseText. This means that it actually supports more styles than Paper Picker supported. (Paper picker only supported ~4 styles, this supports everything that Text supports, so 10+ styles).
The only tricky thing is that Picker supports multiple ways of setting text color. Both
<Picker
itemStyle={{color: '#008BD0'}} >
<Picker.Item label="Java" value="java" />
<Picker.Item label="JavaScript" value="js" />
</Picker>
and
<Picker>
<Picker.Item label="Java" value="java" color={'#008BD0'} />
<Picker.Item label="JavaScript" value="js" />
</Picker>
technically work in Paper. I've decided to maintain this behaviour (since there's lots of product code callsites to both options).
Changelog: [iOS][Fabric] Fabric Picker support
Reviewed By: sammy-SC
Differential Revision: D23980319
fbshipit-source-id: e469a837e28af0ad97cf0e171df26ee19adff3ab
Summary: This adds support for a controlled `<Picker/>` component . Changelog: [iOS][Fabric] Fabric Picker support Reviewed By: sammy-SC Differential Revision: D24005475 fbshipit-source-id: c50e9918f74f6ef5cdfbfe67cb6c132c12d64916
Summary: Flow type unions don't play well with Fabric components. This diff removes a union in `Picker.js` and fixes all the flow errors. Before this diff, all these surfaces would crash with the new Fabric Picker impl, because the impl asserts that this field is a string. Reviewed By: sammy-SC Differential Revision: D24236317 fbshipit-source-id: 6e646c84fcd16658aaabe5e93507f5f33b346a65
Summary: This builds on the last diff to remove type a type union from Picker. This diff focuses on Picker internals. Changelog: [JS] Remove type union in PickeriOS/PickerNativeComponent Reviewed By: sammy-SC Differential Revision: D24254615 fbshipit-source-id: f788a2e123135c1e8b9909870c40f53b2dea0227
Summary: Updating the regex to avoid a potential regular expression denial-of-service vulnerability. Changelog: Update validateBaseUrl to use a more robust regular expression. Fixes CVE-2020-1920, GHSL-2020-293 Reviewed By: lunaleaps Differential Revision: D25507604 fbshipit-source-id: c36a03c456881bc655c861e1a2c5cd41a7127c9d
…ebook#30164) Summary: This pr fixes: facebook#30123 . When secureTextEntry is true, setInputType will set the inputType of textInput to password type. Password type default font-family will be monospace font, so we need to setTypeface after the setInputType. ## Changelog [Android] [Fixed] - Font family is not apply when secureTextEntry is true. Pull Request resolved: facebook#30164 Test Plan: Before this pr:  After this pr:  Please initiated a new project and replaced the App.js with the following code: ``` iimport React from 'react'; import {SafeAreaView, TextInput} from 'react-native'; const App = () => { return ( <SafeAreaView> <TextInput id={'email'} placeholder={'Email'} secureTextEntry={false} style={{fontFamily: 'Helvetica', fontSize: 14, fontWeight: '400'}} /> <TextInput id={'password'} placeholder={'Password'} secureTextEntry={true} style={{fontFamily: 'Helvetica', fontSize: 14, fontWeight: '400'}} /> </SafeAreaView> ); }; export default App; ``` Thanks you so much for your code review! Reviewed By: cpojer Differential Revision: D24686222 Pulled By: hramos fbshipit-source-id: 863ebe1dba36cac7d91b2735fe6e914ac839ed44
Summary: Currently the dimensions are created once, and then cached. This change will reload the dimensions when the device orientation changes to insure that dimension update events follow orientation changed events. this should help address the following issues, that I know of: facebook#29105 facebook#29451 facebook#29323 ## Changelog <!-- Help reviewers and the release process by writing your own changelog entry. For an example, see: https://github.com/facebook/react-native/wiki/Changelog --> [Android] [Fixed] - Dimension update events are now properly sent following orientation change Pull Request resolved: facebook#30324 Test Plan: Open up RNTester app. Select the Dimensions API list item. Rotate the device and verify that the dimensions are correct based on orientation. Reviewed By: fkgozali Differential Revision: D24874733 Pulled By: ejanzer fbshipit-source-id: 867681ecb009d368a2ae7b67d94d6355e67dea7b
Summary: Hermes has a way to set up a callback that is invoked when a fatal error such as Out of Memory occurs. It is a static API that should be called at most once, so it uses `std::call_once` to achieve that. The fatal error handler is simple, it just uses glog to log an error message to logcat, then aborts (using `__android_log_assert`). The reason is typically very helpful for understanding why `hermes_fatal` was called. Changelog: [Android][Internal] - Print a logcat message when Hermes has a fatal error Reviewed By: mhorowitz Differential Revision: D25792805 fbshipit-source-id: 45de70d71e9bd8eaa880526d8835b4e32aab8fe3
…UIManager registered Summary: This diff refactors the UIManagerHelper.getUIManager method to return null when there's no UIManager registered for the uiManagerType received as a parameter. This is necessary to workaround: facebook#31245 changelog: [changed] UIManagerHelper.getUIManager now returns null when there's no UIManager registered for the uiManagerType received as a parameter Reviewed By: fkgozali Differential Revision: D28242592 fbshipit-source-id: c3a4979bcf6e547d0f0060737e41bbf19860a984
Summary: When there are multiple sticky headers, ScrollViewStickyHeader should push up the header above it when it gets to the top. This behavior was accidentally changed in D21948830 (facebook@fa5d3fb) when this component was fixed to work in Fabric. This diff added a new variable `_shouldRecreateTranslateY`, which determines whether the `translateY` value should be recreated on render. `_shouldRecreateTranslateY` was not being set to true during `setNextHeaderY`, so the next header's Y value was never accounted for at render. Changelog: [General][Fixed] Fix ScrollViewStickyHeader to push up header above it Reviewed By: lunaleaps Differential Revision: D27277829 fbshipit-source-id: 83c9aacd454be178649bf8d060d1a5c750f4060f
Summary: Homebrew on M1 installs executable binaries in **/opt/homebrew/bin** (See https://brew.sh/2021/02/05/homebrew-3.0.0/), and FBReactNativeSpec.build is failing because it couldn't find node. This PR changes find-node.sh script to add /opt/homebrew/bin into $PATH. The way **react.gradle** trying to execute node is not using user environment variables, but system defaults, so it couldn't find it. I removed node execution, and hard coded cli path in parity with iOS https://github.com/facebook/react-native/blob/d1ab03235cb4b93304150878d2b9057ab45bba77/scripts/react-native-xcode.sh#L106 Fixes facebook#31621 facebook#31592 ## Changelog [General] [Changed] - find-node.sh supports Homebrew on M1 Pull Request resolved: facebook#31622 Test Plan: On M1, create a RN project and it'll fail to build iOS app. Apply the patch, and build will succeed. Reviewed By: ShikaSD Differential Revision: D28808206 Pulled By: hramos fbshipit-source-id: 8b313b6685462a15e67d99c61a0202d17fece1ec # Conflicts: # scripts/find-node.sh
…acebook#29106) Summary: This PR fixes a few issues with the Appearance API (as noted here facebook#28823). 1. For the Appearance API to work correctly on Android you need to call `AppearanceModule.onConfigurationChanged` when the current Activity goes through a configuration change. This was being called in the RNTester app but not in `ReactActivity` so it meant the Appearance API wouldn't work for Android in newly generated RN projects (or ones upgraded to the latest version of RN). 2. The Appearance API wasn't working correctly for brownfield scenarios on Android. It's possible to force an app light or dark natively on Android by calling `AppCompatDelegate.setDefaultNightMode()`. The Appearance API wasn't picking up changes from this function because it was using the Application context instead of the current Activity context. 3. The Appearance API wasn't working correctly for brownfield scenarios on iOS. Just like on Android its possible to force an app light or dark natively by setting `window.overrideUserInterfaceStyle`. The Appearance API didn't work with this override because we were overwriting `_currentColorScheme` back to default as soon as we set it. ## Changelog <!-- Help reviewers and the release process by writing your own changelog entry. For an example, see: https://github.com/facebook/react-native/wiki/Changelog --> ### Fixed facebook#28823 * [Android] [Fixed] - Appearance API now works on Android * [Android] [Fixed] - Appearance API now works correctly when calling `AppCompatDelegate.setDefaultNightMode()` * [iOS] [Fixed] - Appearance API now works correctly when setting `window.overrideUserInterfaceStyle` Pull Request resolved: facebook#29106 Test Plan: Ran RNTester on iOS and Android and verified the Appearance examples still worked [correctly.](url) Reviewed By: hramos Differential Revision: D31284331 Pulled By: sota000 fbshipit-source-id: 45bbe33983e506eb177d596d33ddf15f846708fd
|
Hi @hushizhi! Thank you for your pull request and welcome to our community. Action RequiredIn order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you. ProcessIn order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA. Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with If you have received this in error or have any questions, please contact us at cla@fb.com. Thanks! |
|
Summary
Changelog
[CATEGORY] [TYPE] - Message
Test Plan