-
Notifications
You must be signed in to change notification settings - Fork 126
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
Keyboard shortcuts (copy, paste, select) not working in TextInput #2075
Comments
I highly doubt your AppDelegate has anything to do with it. I wonder if there's an Info.plist value you need to allow copy/paste? (I also doubt that...). Without a way to repro it, I'm not sure I can help further though :( Can you put breakpoints inside classes like |
I sadly don't really know where to put the breakpoints inside the Objective-C files 😅 The repo in question is this one. It has a branch called |
There is a macOS specific react-native-macos/packages/react-native/Libraries/Components/TextInput/RCTTextInputViewConfig.js Line 178 in 3d54a1a
Maybe to start, this method? I can't keep track of all the TextInput native classes, that's one of the most complex controls. I'm more curious the code is even getting hit. react-native-macos/packages/react-native/Libraries/Text/TextInput/RCTBaseTextInputView.mm Line 769 in 3d54a1a
|
This still does not work for me. I see the
This on the other hand did "successfully not work". I tested this using NSLog as seen it the screenshots below. "Backspace" as well as "handle key event" was logged (on those actions), but "Paste" and "handle paste" wasn't. |
I found the issue! It is my fault and it is a stupid error as well 😅 I removed unnecessary items from the main menu, including the edit menu, not knowing that this actually defines the shortcuts and does not just offer another way to use them. After copying the menu back in from the other default project everything was working as expected. |
That is... quite the find. I had no idea it worked that way 😅 |
Environment
Steps to reproduce the bug
<TextInput>
componentExpected Behavior
The regular keyboard shortcuts of macOS should work in the input field.
Actual Behavior
I only hear an error sound, besides that nothing happens. See the video below:
screencap.mp4
Reproducible Demo
No response
Additional context
I found a few posts about issues with this in React Native in general and unsuccessfully tried the workarounds there.
After seeing this PR with a video of the copy/paste working, I tried the same within the default
App.tsx
of a newly generated project (same versions as mine) and it is working there. That sameApp.tsx
in my project had the issue again though. So this has to be related to my project setup.The only thing that I can think of right now is that there is something wrong with my
AppDelegate.swift
(linked below) since I'm not using the default Objective-C setup and my Objective-C and Swift knowledge is quite limited.So I'm not sure if this is even related to react-native-macos and you can just close this issue if you think that the root cause definitely lies somewhere else. I'm happy for any hints or feedback though. I can also add you to the private repo of the app if you are willing to go that deep (maybe in exchange for a coffee or something like that 😅).
AppDelegate.swift
:The text was updated successfully, but these errors were encountered: