react-native-live-markdown icon indicating copy to clipboard operation
react-native-live-markdown copied to clipboard

Add macOS support

Open tomekzaw opened this issue 1 year ago • 6 comments

Details

Work in progress

Related Issues

GH_LINK

Manual Tests

Linked PRs

tomekzaw avatar Feb 02 '24 21:02 tomekzaw

visionOS support also coming? :)

matthargett avatar Feb 05 '24 16:02 matthargett

Any updates on this one? MacOS support would be huge!

hmbrg avatar Apr 27 '24 23:04 hmbrg

After applying changes required by macOS itself (e.g. removing UIKit.h imports and replacing UIView with RCTUIView), there's a bug that prevents the user from typing more than only one character – all subsequent keypresses behave like pressing right arrow even though here I'm only pressing a key:

https://github.com/user-attachments/assets/a1053473-eb14-47e3-a9f4-9f662d68059a

I managed to get it working by commenting out two swizzled methods in 7026df149fbddd1c3620132922bd1489bc151d6c but then the formatting is applied with a slight delay:

https://github.com/user-attachments/assets/764c3550-db4e-4af4-85d1-63d40f92532e

So the formatting is incorrect for 1 frame:

Screenshot 2024-10-10 at 20 24 09

tomekzaw avatar Oct 10 '24 18:10 tomekzaw

Hello! I would be interested if this PR was revived, though as I understand it, now this library is new architecture only? Could I get an idea of any blockers y'all were seeing in macOS if there were any?

Saadnajmi avatar Mar 10 '25 11:03 Saadnajmi

@Saadnajmi Hey, nice to hear that!

Yep, as of today @expensify/react-native-live-markdown supports only the new architecture, see explanation in https://github.com/Expensify/react-native-live-markdown/pull/634.

So one of the blockers is that we're still using method swizzling to override the default behavior when typing or updating the value from JS. There's a PR that eliminates method swizzling but there are still some details that need to be fixed: https://github.com/Expensify/react-native-live-markdown/pull/520

As far as I remember, there were no blockers caused by react-native-macos so far, only some API differences like lack of UITextRange (we'll need to use NSRange instead) or some problems with valueForKey:.

I'm curious to know about your use case, feel free to send me a DM.

tomekzaw avatar Mar 10 '25 12:03 tomekzaw

@Saadnajmi Hey, nice to hear that!

Yep, as of today @expensify/react-native-live-markdown supports only the new architecture, see explanation in https://github.com/Expensify/react-native-live-markdown/pull/634.

So one of the blockers is that we're still using method swizzling to override the default behavior when typing or updating the value from JS. There's a PR that eliminates method swizzling but there are still some details that need to be fixed: https://github.com/Expensify/react-native-live-markdown/pull/520

As far as I remember, there were no blockers caused by react-native-macos so far, only some API differences like lack of UITextRange (we'll need to use NSRange instead) or some problems with valueForKey:.

I'm curious to know about your use case, feel free to send me a DM.

The use case is mostly "it would be real great to have a proper open source richtextinput library for desktop". It feels like a common request for desktop apps specifically. We have some custom stuff internally, but it's not something that would be useful in open source IMO.

Saadnajmi avatar Mar 10 '25 12:03 Saadnajmi