Skip to content

Commit 1c84548

Browse files
authored
Merge branch 'main' into fix/web-onchange-history-evenst
2 parents b9ed2f3 + 3127736 commit 1c84548

File tree

3 files changed

+17
-3
lines changed

3 files changed

+17
-3
lines changed

ios/RCTBaseTextInputView+Markdown.mm

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,14 @@ - (BOOL)markdown_textOf:(NSAttributedString *)newText equals:(NSAttributedString
2727
{
2828
RCTMarkdownUtils *markdownUtils = [self getMarkdownUtils];
2929
if (markdownUtils != nil) {
30-
return [newText isEqualToAttributedString:oldText];
30+
// Emoji characters are automatically assigned an AppleColorEmoji NSFont and the original font is moved to NSOriginalFont
31+
// We need to remove these attributes before comparison
32+
NSMutableAttributedString *newTextCopy = [newText mutableCopy];
33+
NSMutableAttributedString *oldTextCopy = [oldText mutableCopy];
34+
[newTextCopy removeAttribute:@"NSFont" range:NSMakeRange(0, newTextCopy.length)];
35+
[oldTextCopy removeAttribute:@"NSFont" range:NSMakeRange(0, oldTextCopy.length)];
36+
[oldTextCopy removeAttribute:@"NSOriginalFont" range:NSMakeRange(0, oldTextCopy.length)];
37+
return [newTextCopy isEqualToAttributedString:oldTextCopy];
3138
}
3239

3340
return [self markdown_textOf:newText equals:oldText];

ios/RCTTextInputComponentView+Markdown.mm

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,14 @@ - (BOOL)markdown__textOf:(NSAttributedString *)newText equals:(NSAttributedStrin
5151
{
5252
RCTMarkdownUtils *markdownUtils = [self getMarkdownUtils];
5353
if (markdownUtils != nil) {
54-
return [newText isEqualToAttributedString:oldText];
54+
// Emoji characters are automatically assigned an AppleColorEmoji NSFont and the original font is moved to NSOriginalFont
55+
// We need to remove these attributes before comparison
56+
NSMutableAttributedString *newTextCopy = [newText mutableCopy];
57+
NSMutableAttributedString *oldTextCopy = [oldText mutableCopy];
58+
[newTextCopy removeAttribute:@"NSFont" range:NSMakeRange(0, newTextCopy.length)];
59+
[oldTextCopy removeAttribute:@"NSFont" range:NSMakeRange(0, oldTextCopy.length)];
60+
[oldTextCopy removeAttribute:@"NSOriginalFont" range:NSMakeRange(0, oldTextCopy.length)];
61+
return [newTextCopy isEqualToAttributedString:oldTextCopy];
5562
}
5663

5764
return [self markdown__textOf:newText equals:oldText];

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@expensify/react-native-live-markdown",
3-
"version": "0.1.105",
3+
"version": "0.1.107",
44
"description": "Drop-in replacement for React Native's TextInput component with Markdown formatting.",
55
"main": "lib/commonjs/index",
66
"module": "lib/module/index",

0 commit comments

Comments
 (0)