Skip to content

Add macOS support #149

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

Draft
wants to merge 19 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
- ⚡ Fully native experience (selection, spellcheck, autocomplete)
- 🔧 Customizable logic
- 🎨 Customizable styles
- 🌐 Universal support (Android, iOS, web)
- 🌐 Universal support (Android, iOS, macOS, web)
- 🏗️ Supports only the New Architecture

## Installation
Expand Down
2 changes: 1 addition & 1 deletion RNLiveMarkdown.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ Pod::Spec.new do |s|
s.license = package["license"]
s.authors = package["author"]

s.platforms = { :ios => "11.0", :visionos => "1.0" }
s.platforms = { :ios => "11.0", :visionos => "1.0", :osx => "10.15" }
s.source = { :git => "https://github.com/expensify/react-native-live-markdown.git", :tag => "#{s.version}" }

s.source_files = "apple/**/*.{h,m,mm}", "cpp/**/*.{h,cpp}"
Expand Down
1 change: 0 additions & 1 deletion apple/MarkdownLayoutManager.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#import <UIKit/UIKit.h>
#import <RNLiveMarkdown/RCTMarkdownUtils.h>
#import <RNLiveMarkdown/MarkdownFormatter.h>

Expand Down
1 change: 1 addition & 0 deletions apple/MarkdownLayoutManager.mm
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#import <RNLiveMarkdown/MarkdownLayoutManager.h>
#import <objc/runtime.h>

@implementation MarkdownLayoutManager

Expand Down
28 changes: 14 additions & 14 deletions apple/RCTMarkdownStyle.h
Original file line number Diff line number Diff line change
@@ -1,34 +1,34 @@
#import <UIKit/UIKit.h>
#import <React/RCTUIKit.h>

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I’ve put uses of RCTUIKit inside an ifdef for other libraries, because I don’t think iOS would compile since React Native Core doesn’t have it

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll add #ifdefs later on, now I'm just trying to make it compile on macOS.

#import <react/renderer/components/RNLiveMarkdownSpec/Props.h>

NS_ASSUME_NONNULL_BEGIN

@interface RCTMarkdownStyle : NSObject

@property (nonatomic) UIColor *syntaxColor;
@property (nonatomic) UIColor *linkColor;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think React Native macOS #defines UIColor to NSColor if that helps?

@property (nonatomic) RCTUIColor *syntaxColor;
@property (nonatomic) RCTUIColor *linkColor;
@property (nonatomic) CGFloat h1FontSize;
@property (nonatomic) CGFloat emojiFontSize;
@property (nonatomic) NSString *emojiFontFamily;
@property (nonatomic) UIColor *blockquoteBorderColor;
@property (nonatomic) RCTUIColor *blockquoteBorderColor;
@property (nonatomic) CGFloat blockquoteBorderWidth;
@property (nonatomic) CGFloat blockquoteMarginLeft;
@property (nonatomic) CGFloat blockquotePaddingLeft;
@property (nonatomic) NSString *codeFontFamily;
@property (nonatomic) CGFloat codeFontSize;
@property (nonatomic) UIColor *codeColor;
@property (nonatomic) UIColor *codeBackgroundColor;
@property (nonatomic) RCTUIColor *codeColor;
@property (nonatomic) RCTUIColor *codeBackgroundColor;
@property (nonatomic) NSString *preFontFamily;
@property (nonatomic) CGFloat preFontSize;
@property (nonatomic) UIColor *preColor;
@property (nonatomic) UIColor *preBackgroundColor;
@property (nonatomic) UIColor *mentionHereColor;
@property (nonatomic) UIColor *mentionHereBackgroundColor;
@property (nonatomic) UIColor *mentionUserColor;
@property (nonatomic) UIColor *mentionUserBackgroundColor;
@property (nonatomic) UIColor *mentionReportColor;
@property (nonatomic) UIColor *mentionReportBackgroundColor;
@property (nonatomic) RCTUIColor *preColor;
@property (nonatomic) RCTUIColor *preBackgroundColor;
@property (nonatomic) RCTUIColor *mentionHereColor;
@property (nonatomic) RCTUIColor *mentionHereBackgroundColor;
@property (nonatomic) RCTUIColor *mentionUserColor;
@property (nonatomic) RCTUIColor *mentionUserBackgroundColor;
@property (nonatomic) RCTUIColor *mentionReportColor;
@property (nonatomic) RCTUIColor *mentionReportBackgroundColor;

- (instancetype)initWithStruct:(const facebook::react::MarkdownTextInputDecoratorViewMarkdownStyleStruct &)style;

Expand Down
1 change: 1 addition & 0 deletions src/styleUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ type PartialMarkdownStyle = Partial<{

const FONT_FAMILY_MONOSPACE = Platform.select({
ios: 'Courier',
macos: 'Menlo',
default: 'monospace',
});

Expand Down
Loading