-
Notifications
You must be signed in to change notification settings - Fork 24.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add onPaste to TextInput #45425
base: main
Are you sure you want to change the base?
Add onPaste to TextInput #45425
Conversation
PR for docs update: facebook/react-native-website#4161 |
Base commit: fcd526d |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @s77rt, thanks for this contributions.
I see that there are some failures in CI for the JS side. This is happening because there is a new method in the spec and this is changing the public API of the component. We have a check that warn us about API changes.
In this case is a safe change, but can you update the test case? The failure is here.
Also, to set expectation, this kind of changes, that touches at the same time JS and native code, can take a little more to be merged and we might have to split the JS part from the Native part to land them properly.
@cipolleschi Updated! Thanks! |
@cipolleschi has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
.../ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactTextInputPasteEvent.java
Outdated
Show resolved
Hide resolved
Hi @s77rt, we were evaluating the PR internally and we figured a couple of things:
Thank you so much for your patience. |
@cipolleschi Thanks for your quick actions on this.
The new arch is already supported and tested with RNTester. Can you please elaborate if I'm missing something here?
|
Making this a draft until we land on an approved proposal react-native-community/discussions-and-proposals#804 |
This reverts commit 5baad1a.
will there be any new progress? 😳 |
@huhuanming Code-wise this is ready. You can port this as a patch for your needs. Feedback is much appreciated. For now this is still marked as draft because there is no approval on the proposal yet (and code could change) |
NSString *fileName = [NSString stringWithFormat:@"%@.%@", [[NSUUID UUID] UUIDString], fileExtension]; | ||
NSString *filePath = [NSTemporaryDirectory() stringByAppendingPathComponent:fileName]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Replace with RCTTempFilePath
NSString *fileName = [NSString stringWithFormat:@"%@.%@", [[NSUUID UUID] UUIDString], fileExtension]; | ||
NSString *filePath = [NSTemporaryDirectory() stringByAppendingPathComponent:fileName]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same ^
Summary:
Detect
Paste
event. In our use case this is needed to unlock the possibility to support image pasting.Changelog:
[GENERAL] [ADDED] - Add onPaste prop to TextInput component
Test Plan:
onPaste
is logged beforeonChange
Screen.Recording.2024-07-13.at.7.08.40.PM.mov
Screen.Recording.2024-07-21.at.3.40.31.PM.mov
Screen.Recording.2024-07-25.at.6.16.22.PM.mov
Screen.Recording.2024-07-25.at.6.28.29.PM.mov