Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: add missing
submitBehavior
prop type and mark blurOnSubmit
p…
…rop as deprecated in typescript declaration file of TextInput (#45588) Summary: Hi, I just found out that #33653 adds a new prop in `TextInput` that enables multiline `TextInput` be able to submit without blurring. It does that by adding a new prop called `submitBehavior` which accepts `'submit' | 'blurAndSubmit' | 'newline'`: https://github.com/facebook/react-native/blob/700b403e06fdcbcde2a4ade9570eb572431487ea/packages/react-native/Libraries/Components/TextInput/TextInput.js#L195 https://github.com/facebook/react-native/blob/700b403e06fdcbcde2a4ade9570eb572431487ea/packages/react-native/Libraries/Components/TextInput/TextInput.js#L910-L928 It also marks `blurOnSubmit` prop as deprecated since it can now be handled from `submitBehavior`: https://github.com/facebook/react-native/blob/700b403e06fdcbcde2a4ade9570eb572431487ea/packages/react-native/Libraries/Components/TextInput/TextInput.js#L896-L908 However, that PR doesn't update `TextInput.d.ts` file which results Typescript to complain that the type doesn't exist: <img width="760" alt="text_input_error" src="https://github.com/user-attachments/assets/2235cb36-1e4e-4ec9-a8b0-c09728a3336f"> So this PR adds and updates the types in declaration file to support them in Typescript <img width="520" alt="fixed" src="https://github.com/user-attachments/assets/a7a3a0c4-9f3e-4644-bfac-ae60ac21d0f7"> ## Changelog: [GENERAL] [FIXED] - add missing `submitBehavior` prop and mark `blurOnSubmit` prop as deprecated in Typescript declaration file of `TextInput` Pull Request resolved: #45588 Test Plan: Before: <img width="295" alt="before" src="https://github.com/user-attachments/assets/90ed0cd1-c127-4667-bf72-6b5317ea4dd6"> After: <img width="589" alt="after1" src="https://github.com/user-attachments/assets/826002a4-45dc-4f97-882d-7622238ac766"> <img width="833" alt="after2" src="https://github.com/user-attachments/assets/467eeecd-4b0b-4740-ac78-253e3c7aa901"> Reviewed By: christophpurrer Differential Revision: D60107516 Pulled By: dmytrorykun fbshipit-source-id: ce79e41aefc1ef39dc1d44179405cf6a8d5e12de
- Loading branch information