react-native-macos icon indicating copy to clipboard operation
react-native-macos copied to clipboard

selectable property has no effect on Text

Open bbqsrc opened this issue 7 years ago • 1 comments

https://facebook.github.io/react-native/docs/text.html#selectable

I've had a look at the implementation of RCTText, and it seems to be a full reimplementation using an NSView, so I'm not sure I can help extend it as my knowledge of Cocoa at that depth is weak.

In the interim, are there any workarounds?

bbqsrc avatar Apr 15 '17 16:04 bbqsrc

I would say it's not a full reimplementation, some critical things were copied directly from RN, and that's one of the main reason why it's harder to enable it on macOS than iOS, the latter just emulates selecting by providing longPress handler https://github.com/facebook/react-native/blob/e1577df1fd70049ce7f288f91f6e2b18d512ff4d/Libraries/Text/RCTText.m#L67. On macOS you'd expect different and much more complicated behaviour. The best way right now would be to use native NSTextView, you can try TextInput with multiple={true} property, it depends on your formatting requirements and styles. Unfortunately, TextInput also have some bugs and incomplete API. Please let me know. I'd like to improve it.

ptmt avatar Apr 15 '17 19:04 ptmt