Skip to content

Commit

Permalink
Annotate regions as nonnullable on iOS (#127)
Browse files Browse the repository at this point in the history
  • Loading branch information
tomekzaw authored Jan 16, 2024
1 parent 84f5b7e commit 45bd891
Show file tree
Hide file tree
Showing 7 changed files with 35 additions and 16 deletions.
4 changes: 4 additions & 0 deletions ios/MarkdownLayoutManager.h
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
#import <UIKit/UIKit.h>
#import <react-native-live-markdown/RCTMarkdownUtils.h>

NS_ASSUME_NONNULL_BEGIN

@interface MarkdownLayoutManager : NSLayoutManager

@property(nonatomic) RCTMarkdownUtils *markdownUtils;

@end

NS_ASSUME_NONNULL_END
6 changes: 5 additions & 1 deletion ios/MarkdownTextInputDecoratorView.h
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
#import <UIKit/UIKit.h>
#import <react-native-live-markdown/RCTMarkdownStyle.h>

NS_ASSUME_NONNULL_BEGIN

@interface MarkdownTextInputDecoratorView : UIView

- (void)setMarkdownStyle:(nonnull RCTMarkdownStyle *)markdownStyle;
- (void)setMarkdownStyle:(RCTMarkdownStyle *)markdownStyle;

@end

NS_ASSUME_NONNULL_END
2 changes: 1 addition & 1 deletion ios/MarkdownTextInputDecoratorView.mm
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ - (void)willMoveToWindow:(UIWindow *)newWindow
}
}

- (void)setMarkdownStyle:(nonnull RCTMarkdownStyle *)markdownStyle
- (void)setMarkdownStyle:(RCTMarkdownStyle *)markdownStyle
{
_markdownStyle = markdownStyle;
[_markdownUtils setMarkdownStyle:markdownStyle];
Expand Down
5 changes: 4 additions & 1 deletion ios/MarkdownTextInputDecoratorViewManager.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
#import <React/RCTViewManager.h>

@interface MarkdownTextInputDecoratorViewManager : RCTViewManager
NS_ASSUME_NONNULL_BEGIN

@interface MarkdownTextInputDecoratorViewManager : RCTViewManager
@end

NS_ASSUME_NONNULL_END
26 changes: 15 additions & 11 deletions ios/RCTMarkdownStyle.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,25 @@
#import <react/renderer/components/RNLiveMarkdownSpec/Props.h>
#endif /* RCT_NEW_ARCH_ENABLED */

NS_ASSUME_NONNULL_BEGIN

@interface RCTMarkdownStyle : NSObject

@property (nonatomic, nonnull) UIColor *syntaxColor;
@property (nonatomic, nonnull) UIColor *linkColor;
@property (nonatomic) UIColor *syntaxColor;
@property (nonatomic) UIColor *linkColor;
@property (nonatomic) CGFloat h1FontSize;
@property (nonatomic, nonnull) UIColor *blockquoteBorderColor;
@property (nonatomic) UIColor *blockquoteBorderColor;
@property (nonatomic) CGFloat blockquoteBorderWidth;
@property (nonatomic) CGFloat blockquoteMarginLeft;
@property (nonatomic) CGFloat blockquotePaddingLeft;
@property (nonatomic, nonnull) NSString *codeFontFamily;
@property (nonatomic, nonnull) UIColor *codeColor;
@property (nonatomic, nonnull) UIColor *codeBackgroundColor;
@property (nonatomic, nonnull) NSString *preFontFamily;
@property (nonatomic, nonnull) UIColor *preColor;
@property (nonatomic, nonnull) UIColor *preBackgroundColor;
@property (nonatomic, nonnull) UIColor *mentionHereBackgroundColor;
@property (nonatomic, nonnull) UIColor *mentionUserBackgroundColor;
@property (nonatomic) NSString *codeFontFamily;
@property (nonatomic) UIColor *codeColor;
@property (nonatomic) UIColor *codeBackgroundColor;
@property (nonatomic) NSString *preFontFamily;
@property (nonatomic) UIColor *preColor;
@property (nonatomic) UIColor *preBackgroundColor;
@property (nonatomic) UIColor *mentionHereBackgroundColor;
@property (nonatomic) UIColor *mentionUserBackgroundColor;

#ifdef RCT_NEW_ARCH_ENABLED
- (instancetype)initWithStruct:(const facebook::react::MarkdownTextInputDecoratorViewMarkdownStyleStruct &)style;
Expand All @@ -27,3 +29,5 @@
#endif /* RCT_NEW_ARCH_ENABLED */

@end

NS_ASSUME_NONNULL_END
2 changes: 1 addition & 1 deletion ios/RCTMarkdownStyle.mm
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ - (instancetype)initWithStruct:(const facebook::react::MarkdownTextInputDecorato

#else

- (instancetype)initWithDictionary:(nonnull NSDictionary *)json
- (instancetype)initWithDictionary:(NSDictionary *)json
{
if (self = [super init]) {
_syntaxColor = [RCTConvert UIColor:json[@"syntax"][@"color"]];
Expand Down
6 changes: 5 additions & 1 deletion ios/RCTMarkdownUtils.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#import <React/RCTBackedTextInputViewProtocol.h>
#import <react-native-live-markdown/RCTMarkdownStyle.h>

NS_ASSUME_NONNULL_BEGIN

@interface RCTMarkdownUtils : NSObject

@property (nonatomic) RCTMarkdownStyle *markdownStyle;
Expand All @@ -9,6 +11,8 @@

- (instancetype)initWithBackedTextInputView:(UIView<RCTBackedTextInputViewProtocol> *)backedTextInputView;

- (NSAttributedString *)parseMarkdown:(NSAttributedString *)input;
- (NSAttributedString *)parseMarkdown:(nullable NSAttributedString *)input;

@end

NS_ASSUME_NONNULL_END

0 comments on commit 45bd891

Please sign in to comment.