[No QA] Add NumberForm root with SymbolInput and TextInput primitives - #98967
Draft
jmgraa wants to merge 20 commits into
Draft
[No QA] Add NumberForm root with SymbolInput and TextInput primitives#98967jmgraa wants to merge 20 commits into
jmgraa wants to merge 20 commits into
Conversation
…etFormattedNumber behavior
|
Hey! I see that you made changes to our Form component. Make sure to update the docs in FORMS.md accordingly. Cheers! |
Codecov Report✅ Changes either increased or maintained existing code coverage, great job!
|
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.
Explanation of Change
This PR introduces the new composable
NumberFormfoundation and extracts numeric input behavior from the monolithicNumberWithSymbolFormimplementation.NumberFormnow provides shared controlled state, external value synchronization, error handling, callbacks, and the imperative ref API through context. It exposes two specialized primitives:NumberForm.SymbolInputfor inputs usingTextInputWithSymbolNumberForm.TextInputfor standard text inputsBoth primitives use the shared
useNumberFormInputLogichook, which centralizes:clearSelection,updateNumber, andgetNumberimperative methodsThis differs from
NumberWithSymbolFormin that the legacy component combines the form state, numeric input logic, rendering branches, number pad, symbol/currency controls, flip controls, and layout composition in a single component. It also maintains separate setter paths for the symbol input and the standard text-input mode. The new implementation separates the shared numeric behavior from the visual input primitives, allowing future features such as currency buttons and number-pad composition to be added independently.Normalization is now performed by
NumberFormitself.TextInputWithSymbolsupports an opt-out flag so that the new component does not normalize the value twice, while the legacyNumberWithSymbolFormbehavior remains unchanged.The new component is introduced as the foundation for subsequent migration work. Dedicated tests cover root state management, both input variants, formatting, validation, ref behavior, external updates, and native selection-event guards.
Fixed Issues
$ #98169
PROPOSAL: #97970
Tests
Offline tests
N/A
QA Steps
N/A
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectionAvatar, I verified the components usingAvatarare working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))npm run compress-svg)Avataris modified, I verified thatAvataris working as expected in all cases)Designlabel and/or tagged@Expensify/designso the design team can review the changes.mainbranch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTeststeps.