Repository navigation
Reset removed shadow, editable and persistentScrollbar props to their defaults - #59125
Closed
YevheniiKotyrlo wants to merge 3 commits into
Closed
YevheniiKotyrlo wants to merge 3 commits into
YevheniiKotyrlo wants to merge 3 commits into
Conversation
A Fantom case removes persistentScrollbar from a ScrollView, and gtests parse a removed shadowRadius, shadowOffset and editable, each expected to equal the value of a component that never set the prop.
… defaults A removed prop reaches the C++ props as null, and convertRawProp returns its fallback argument for it. shadowRadius, shadowOffset, editable, persistentScrollbar, sendMomentumEvents and nestedScrollEnabled passed a fallback other than their declared default, so a component that dropped the prop kept a value that a component which never set it does not have. Each fallback is now the declared default, which setProp already uses.
The target compiles every source below its path, so the gtest in textinput/tests needs the same exclusion the other targets give theirs.
Contributor
Author
Contributor
Author
|
The red iOS jobs come from one download: |
YevheniiKotyrlo
marked this pull request as ready for review
October 16, 2026 08:08
|
@javache has imported this pull request. If you are a Meta employee, you can view this in D125706127. |
Collaborator
|
This pull request was successfully merged by @YevheniiKotyrlo in 86695d8 When will my fix make it into a release? | How to file a pick request? |
usama-liaqat
pushed a commit
to usama-liaqat/react-native
that referenced
this pull request
Nov 14, 2026
… defaults (react#59125) Summary: A prop removed from a component reaches the C++ props as `null`, and `convertRawProp` then returns its fallback argument. For these props the fallback differs from the field's declared default, so a component that had the prop and lost it is left with a value that a component which never had it does not have: | Prop | Declared default | After removal | | --- | --- | --- | | `shadowRadius` | `3` | `0` | | `shadowOffset` | `{width: 0, height: -3}` | `{width: 0, height: 0}` | | `editable` (TextInput) | `true` | `false` | | `persistentScrollbar` (ScrollView) | `false` | `true` | | `sendMomentumEvents`, `nestedScrollEnabled` (Android ScrollView) | `false` | `true` | On iOS, `RCTViewComponentView` applies the shadow values to the layer, so a view that sets `shadowRadius` or `shadowOffset` conditionally (a raised card, a pressed state) gets `layer.shadowRadius = 0` and `layer.shadowOffset = {0, 0}` once they are removed, instead of the defaults it started with. On Android, the props diff of `enablePropsUpdateReconciliationAndroid` reads the same values, so a `TextInput` that drops `editable={false}` stays read-only and a `ScrollView` that drops `persistentScrollbar` keeps it. `ScrollView` always passes `sendMomentumEvents` and `nestedScrollEnabled`, so those two only reach a direct user of the native component. Each fallback is now the declared default, the value `setProp` (`enableCppPropsIteratorSetter`) already resets these props to. ## Changelog: [GENERAL] [FIXED] - Reset a removed `shadowRadius`, `shadowOffset`, `editable` or `persistentScrollbar` prop to its default Pull Request resolved: react#59125 Test Plan: - `ViewPropsTest` and `BaseTextInputPropsTest` parse a prop, then its removal, and compare the result with a default-constructed props object. On `main` they fail with `removed.shadowRadius` 0 against 3, `removed.shadowOffset.height` 0 against -3, and `removed.editable` false against true. `BaseTextInputProps` had no tests, so `textinput/tests/` is new: the SwiftPM target excludes it as the other targets exclude theirs, and the internal BUCK file now defines and links a `:tests` target. The view test target also declares the direct dependencies used by the new regression tests. - A Fantom case in `ScrollView-itest.js` renders `persistentScrollbar={true}` and then no prop; on `main` the second render still carries `persistentScrollbar="true"`. - I ran these in the `reactnativecommunity/react-native-android` image, linking the gtests against the Fantom runner's ReactCommon build: the new tests fail on `main` and pass with this change, and the whole Fantom suite passes with it. clang-format 21.1.2, Prettier, ESLint and Flow pass. - RNTester release builds of `main` and of this change on an iPad (iOS 27.0.1): a view that loses `shadowRadius` and `shadowOffset` draws no shadow on `main` and the default one with this change ([before and after](react#59125 (comment))). - Internal validation after the BUCK updates: `buck2 test -j 16 fbsource//xplat/js/react-native-github/packages/react-native/ReactCommon/react/renderer/components/textinput:tests fbsource//xplat/js/react-native-github/packages/react-native/ReactCommon/react/renderer/components/view:tests -- --timeout=300` passed all 96 tests, including the new editable and shadow prop-removal regressions ([test run](https://www.internalfb.com/intern/testinfra/testrun/30680772508413679)). `arc f` and `arc lint -a` passed. - Apple follow-up validation: reproduced both `testsApple` analysis failures with `buck2 build --flagfile fbsource//fbobjc/mode/buck2/ios-tests -c cxx.default_platform=iphonesimulator-arm64` before this update ([failure](https://www.internalfb.com/intern/sandcastle/instance/22518001181223006/)). The direct `core` dependencies caused Buck to import private core headers because the test target basename matches the core test registration. Removing those redundant dependencies avoids the basename `conversions.h` collisions while preserving access to the exported core headers through the component dependencies. Both Apple targets now build successfully ([build](https://www.internalfb.com/buck2/0e4dea76-a9d8-4bec-8fc9-9f74701bfd96)). Running the same two targets with `buck2 test` in the iOS-tests mode passes all 100 tests ([Apple test run](https://www.internalfb.com/intern/testinfra/testrun/11821949232723115)); the Linux targets on the updated base pass all 98 tests ([Linux test run](https://www.internalfb.com/intern/testinfra/testrun/3659175102648737)). `arc f` and focused `arc lint -a` on both BUCK files pass. - Current cross-platform BUCK validation: the Android linker failure in `textinput:testsAndroid` reproduces locally using the exact CI command, `buck2 build --flagfile fbsource//fbandroid/mode/integration-tests-allowed-abi-x86` ([before](https://www.internalfb.com/buck2/f06f5508-6e4c-477e-ab58-9ec31f031e47)). A `test-deps` library now exports the core, view and attributed-string dependencies, matching the existing core test-dependency pattern. This links the symbols used by inline/default props constructors on Android without giving the Apple test direct access to conflicting private headers. The exact Android build now passes ([after](https://www.internalfb.com/buck2/856b54eb-3183-40e9-8237-60eae8a49158)). Both textinput and view test packages build for x86/x86_64 and armeabi-v7a/arm64-v8a, including the 32-bit target variants ([ARM build](https://www.internalfb.com/buck2/95780495-d6f6-47e8-98bc-f90275fc524a)). On the same Linux checkout, the iOS-tests-mode Buck run passes 100/100 tests ([Apple](https://www.internalfb.com/intern/testinfra/testrun/1688850268234094)) and the Linux run passes 98/98 tests ([Linux](https://www.internalfb.com/intern/testinfra/testrun/27303072800788143)). Android `buck2 test` successfully built the packages but reported `NO TESTS RAN`, so no Android runtime test pass is claimed. `arc f` and focused `arc lint -a` pass. Reviewed By: christophpurrer Differential Revision: D125706127 Pulled By: javache fbshipit-source-id: c94b7a1d2e96cc59a958b34bc3242e2fc71d1fcd
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


Summary:
A prop removed from a component reaches the C++ props as
null, andconvertRawPropthen returns its fallback argument. For these props the fallback differs from the field's declared default, so a component that had the prop and lost it is left with a value that a component which never had it does not have:shadowRadius30shadowOffset{width: 0, height: -3}{width: 0, height: 0}editable(TextInput)truefalsepersistentScrollbar(ScrollView)falsetruesendMomentumEvents,nestedScrollEnabled(Android ScrollView)falsetrueOn iOS,
RCTViewComponentViewapplies the shadow values to the layer, so a view that setsshadowRadiusorshadowOffsetconditionally (a raised card, a pressed state) getslayer.shadowRadius = 0andlayer.shadowOffset = {0, 0}once they are removed, instead of the defaults it started with. On Android, the props diff ofenablePropsUpdateReconciliationAndroidreads the same values, so aTextInputthat dropseditable={false}stays read-only and aScrollViewthat dropspersistentScrollbarkeeps it.ScrollViewalways passessendMomentumEventsandnestedScrollEnabled, so those two only reach a direct user of the native component.Each fallback is now the declared default, the value
setProp(enableCppPropsIteratorSetter) already resets these props to.Changelog:
[GENERAL] [FIXED] - Reset a removed
shadowRadius,shadowOffset,editableorpersistentScrollbarprop to its defaultTest Plan:
ViewPropsTestandBaseTextInputPropsTestparse a prop, then its removal, and compare the result with a default-constructed props object. Onmainthey fail withremoved.shadowRadius0 against 3,removed.shadowOffset.height0 against -3, andremoved.editablefalse against true.BaseTextInputPropshad no tests, sotextinput/tests/is new: the SwiftPM target excludes it as the other targets exclude theirs, and it needs a test target in the internal build.ScrollView-itest.jsrenderspersistentScrollbar={true}and then no prop; onmainthe second render still carriespersistentScrollbar="true".reactnativecommunity/react-native-androidimage, linking the gtests against the Fantom runner's ReactCommon build: the new tests fail onmainand pass with this change, and the whole Fantom suite passes with it. clang-format 21.1.2, Prettier, ESLint and Flow pass.mainand of this change on an iPad (iOS 27.0.1): a view that losesshadowRadiusandshadowOffsetdraws no shadow onmainand the default one with this change (before and after).