@expensify/react-native-live-markdown 0.1.244 → 0.1.246

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (33) hide show
  1. package/README.md +2 -2
  2. package/RNLiveMarkdown.podspec +4 -6
  3. package/android/build.gradle +5 -26
  4. package/android/src/main/java/com/expensify/livemarkdown/LiveMarkdownModule.java +3 -5
  5. package/apple/LiveMarkdownModule.h +2 -10
  6. package/apple/LiveMarkdownModule.mm +0 -14
  7. package/apple/MarkdownCommitHook.h +0 -3
  8. package/apple/MarkdownCommitHook.mm +0 -4
  9. package/apple/MarkdownTextInputDecoratorComponentView.h +0 -4
  10. package/apple/MarkdownTextInputDecoratorComponentView.mm +112 -17
  11. package/apple/MarkdownTextInputDecoratorViewManager.mm +2 -23
  12. package/apple/RCTMarkdownStyle.h +0 -6
  13. package/apple/RCTMarkdownStyle.mm +0 -49
  14. package/apple/RCTTextInputComponentView+Markdown.h +0 -5
  15. package/apple/RCTTextInputComponentView+Markdown.mm +0 -5
  16. package/lib/commonjs/MarkdownTextInput.js +1 -5
  17. package/lib/commonjs/MarkdownTextInput.js.map +1 -1
  18. package/lib/module/MarkdownTextInput.js +1 -5
  19. package/lib/module/MarkdownTextInput.js.map +1 -1
  20. package/lib/typescript/src/MarkdownTextInput.d.ts.map +1 -1
  21. package/package.json +5 -2
  22. package/src/MarkdownTextInput.tsx +1 -6
  23. package/android/src/oldarch/LiveMarkdownModuleSpec.java +0 -12
  24. package/android/src/oldarch/MarkdownTextInputDecoratorViewManagerSpec.java +0 -11
  25. package/android/src/oldarch/NativeLiveMarkdownModuleSpec.java +0 -37
  26. package/android/src/oldarch/NativeProxy.java +0 -9
  27. package/apple/MarkdownTextInputDecoratorView.h +0 -14
  28. package/apple/MarkdownTextInputDecoratorView.mm +0 -139
  29. package/apple/RCTBaseTextInputView+Markdown.h +0 -18
  30. package/apple/RCTBaseTextInputView+Markdown.mm +0 -101
  31. /package/android/src/{newarch → main/java/com/expensify/livemarkdown}/LiveMarkdownModuleSpec.java +0 -0
  32. /package/android/src/{newarch → main/java/com/expensify/livemarkdown}/MarkdownTextInputDecoratorViewManagerSpec.java +0 -0
  33. /package/android/src/{newarch → main/java/com/expensify/livemarkdown}/NativeProxy.java +0 -0
package/README.md CHANGED
@@ -8,7 +8,7 @@
8
8
  - 🔧 Customizable logic
9
9
  - 🎨 Customizable styles
10
10
  - 🌐 Universal support (Android, iOS, web)
11
- - 🏗️ Supports New Architecture
11
+ - 🏗️ Supports only the New Architecture
12
12
 
13
13
  ## Installation
14
14
 
@@ -179,7 +179,7 @@ Currently, `react-native-live-markdown` supports only [ExpensiMark](https://gith
179
179
 
180
180
  ## Compatibility
181
181
 
182
- `react-native-live-markdown` supports two latest React Native minor releases.
182
+ `react-native-live-markdown` supports two latest React Native minor releases with the New Architecture enabled.
183
183
 
184
184
  | react-native | @expensify/react-native-live-markdown |
185
185
  | :----------: | :-----------------------------------: |
@@ -36,7 +36,7 @@ Pod::Spec.new do |s|
36
36
 
37
37
  install_modules_dependencies(s)
38
38
 
39
- if ENV['USE_FRAMEWORKS'] != nil && ENV['RCT_NEW_ARCH_ENABLED'] == '1'
39
+ if ENV['USE_FRAMEWORKS'] != nil
40
40
  add_dependency(s, "React-FabricComponents", :additional_framework_paths => [
41
41
  "react/renderer/textlayoutmanager/platform/ios",
42
42
  "react/renderer/components/textinput/platform/ios",
@@ -44,10 +44,8 @@ Pod::Spec.new do |s|
44
44
  add_dependency(s, "React-rendererconsistency")
45
45
  end
46
46
 
47
- if ENV['RCT_NEW_ARCH_ENABLED'] == '1'
48
- s.subspec "newarch" do |ss|
49
- ss.source_files = "cpp/**/*.{cpp,h}"
50
- ss.header_dir = "RNLiveMarkdown"
51
- end
47
+ s.subspec "newarch" do |ss|
48
+ ss.source_files = "cpp/**/*.{cpp,h}"
49
+ ss.header_dir = "RNLiveMarkdown"
52
50
  end
53
51
  end
@@ -18,15 +18,8 @@ def reactNativeArchitectures() {
18
18
  return value ? value.split(",") : ["armeabi-v7a", "x86", "x86_64", "arm64-v8a"]
19
19
  }
20
20
 
21
- def isNewArchitectureEnabled() {
22
- return rootProject.hasProperty("newArchEnabled") && rootProject.getProperty("newArchEnabled") == "true"
23
- }
24
-
25
21
  apply plugin: "com.android.library"
26
-
27
- if (isNewArchitectureEnabled()) {
28
- apply plugin: "com.facebook.react"
29
- }
22
+ apply plugin: "com.facebook.react"
30
23
 
31
24
  def getExtOrDefault(name) {
32
25
  return rootProject.ext.has(name) ? rootProject.ext.get(name) : project.properties["LiveMarkdown_" + name]
@@ -93,7 +86,6 @@ android {
93
86
  targetSdkVersion getExtOrIntegerDefault("targetSdkVersion")
94
87
 
95
88
  buildConfigField "int", "REACT_NATIVE_MINOR_VERSION", REACT_NATIVE_MINOR_VERSION.toString()
96
- buildConfigField "boolean", "IS_NEW_ARCHITECTURE_ENABLED", isNewArchitectureEnabled().toString()
97
89
 
98
90
  consumerProguardFiles "proguard-rules.pro"
99
91
 
@@ -129,15 +121,10 @@ android {
129
121
 
130
122
  sourceSets {
131
123
  main {
132
- if (isNewArchitectureEnabled()) {
133
- java.srcDirs += [
134
- "src/newarch",
135
- // This is needed to build Kotlin project with NewArch enabled
136
- "${project.buildDir}/generated/source/codegen/java"
137
- ]
138
- } else {
139
- java.srcDirs += ["src/oldarch"]
140
- }
124
+ java.srcDirs += [
125
+ // This is needed to build Kotlin project with NewArch enabled
126
+ "${project.buildDir}/generated/source/codegen/java"
127
+ ]
141
128
 
142
129
  // TextLayoutManager
143
130
  if (REACT_NATIVE_MINOR_VERSION <= 76 ) {
@@ -190,14 +177,6 @@ dependencies {
190
177
  implementation project(":react-native-reanimated")
191
178
  }
192
179
 
193
- if (isNewArchitectureEnabled()) {
194
- react {
195
- jsRootDir = file("../src/")
196
- libraryName = "LiveMarkdown"
197
- codegenJavaPackageName = "com.expensify.livemarkdown"
198
- }
199
- }
200
-
201
180
  // This fixes linking errors due to undefined symbols from libworklets.so.
202
181
  // During Gradle Sync, Android Gradle Plugin runs Prefab and treats worklets
203
182
  // like a header-only library. During build, config files are not regenerated
@@ -22,11 +22,9 @@ public class LiveMarkdownModule extends NativeLiveMarkdownModuleSpec {
22
22
 
23
23
  @Override
24
24
  public boolean install() {
25
- if (BuildConfig.IS_NEW_ARCHITECTURE_ENABLED) {
26
- FabricUIManager uiManager =
27
- (FabricUIManager) UIManagerHelper.getUIManager(getReactApplicationContext(), UIManagerType.FABRIC);
28
- mNativeProxy.createCommitHook(uiManager);
29
- }
25
+ FabricUIManager uiManager =
26
+ (FabricUIManager) UIManagerHelper.getUIManager(getReactApplicationContext(), UIManagerType.FABRIC);
27
+ mNativeProxy.createCommitHook(uiManager);
30
28
 
31
29
  long jsiRuntime = Objects.requireNonNull(getReactApplicationContext().getJavaScriptContextHolder(), "[react-native-live-markdown] JavaScriptContextHolder is null").get();
32
30
  injectJSIBindings(jsiRuntime);
@@ -1,16 +1,8 @@
1
- #ifdef RCT_NEW_ARCH_ENABLED
2
1
  #import <RNLiveMarkdownSpec/RNLiveMarkdownSpec.h>
3
- #else
4
- #import <React/RCTBridgeModule.h>
5
- #endif // RCT_NEW_ARCH_ENABLED
6
2
 
7
3
  #import <React/RCTEventEmitter.h>
8
4
 
9
5
  // Without inheriting after RCTEventEmitter we don't get access to bridge
10
- @interface LiveMarkdownModule : RCTEventEmitter
11
- #ifdef RCT_NEW_ARCH_ENABLED
12
- <NativeLiveMarkdownModuleSpec>
13
- #else
14
- <RCTBridgeModule>
15
- #endif // RCT_NEW_ARCH_ENABLED
6
+ @interface LiveMarkdownModule : RCTEventEmitter <NativeLiveMarkdownModuleSpec>
7
+
16
8
  @end
@@ -1,17 +1,11 @@
1
1
  #import "LiveMarkdownModule.h"
2
2
 
3
3
  #import <RNLiveMarkdown/RuntimeDecorator.h>
4
-
5
- #ifdef RCT_NEW_ARCH_ENABLED
6
4
  #import <RNLiveMarkdown/MarkdownCommitHook.h>
7
- #endif // RCT_NEW_ARCH_ENABLED
8
5
 
9
6
  #import <React/RCTBridge+Private.h>
10
-
11
- #ifdef RCT_NEW_ARCH_ENABLED
12
7
  #import <React/RCTScheduler.h>
13
8
  #import <React/RCTSurfacePresenter.h>
14
- #endif // RCT_NEW_ARCH_ENABLED
15
9
 
16
10
  #import <jsi/jsi.h>
17
11
 
@@ -23,10 +17,8 @@ using namespace expensify::livemarkdown;
23
17
  // actually register the hook
24
18
 
25
19
  @implementation LiveMarkdownModule {
26
- #ifdef RCT_NEW_ARCH_ENABLED
27
20
  std::shared_ptr<MarkdownCommitHook> commitHook_;
28
21
  __weak RCTSurfacePresenter *surfacePresenter_;
29
- #endif // RCT_NEW_ARCH_ENABLED
30
22
  }
31
23
 
32
24
  RCT_EXPORT_MODULE()
@@ -37,16 +29,12 @@ RCT_EXPORT_BLOCKING_SYNCHRONOUS_METHOD(install)
37
29
  jsi::Runtime &rt = *(jsi::Runtime *)cxxBridge.runtime;
38
30
  expensify::livemarkdown::injectJSIBindings(rt);
39
31
 
40
- #ifdef RCT_NEW_ARCH_ENABLED
41
32
  RCTScheduler *scheduler = [surfacePresenter_ scheduler];
42
33
  commitHook_ = std::make_shared<MarkdownCommitHook>(scheduler.uiManager);
43
- #endif // RCT_NEW_ARCH_ENABLED
44
34
 
45
35
  return @(1);
46
36
  }
47
37
 
48
- #ifdef RCT_NEW_ARCH_ENABLED
49
-
50
38
  - (void)handleJavaScriptDidLoadNotification:(NSNotification *)notification
51
39
  {
52
40
  surfacePresenter_ = self.bridge.surfacePresenter;
@@ -89,6 +77,4 @@ RCT_EXPORT_BLOCKING_SYNCHRONOUS_METHOD(install)
89
77
  [super invalidate];
90
78
  }
91
79
 
92
- #endif // RCT_NEW_ARCH_ENABLED
93
-
94
80
  @end
@@ -1,5 +1,4 @@
1
1
  #pragma once
2
- #ifdef RCT_NEW_ARCH_ENABLED
3
2
 
4
3
  #include <react/renderer/components/iostextinput/TextInputShadowNode.h>
5
4
  #include <react/renderer/uimanager/UIManager.h>
@@ -45,5 +44,3 @@ private:
45
44
 
46
45
  } // namespace livemarkdown
47
46
  } // namespace expensify
48
-
49
- #endif // RCT_NEW_ARCH_ENABLED
@@ -1,5 +1,3 @@
1
- #ifdef RCT_NEW_ARCH_ENABLED
2
-
3
1
  #include <React/RCTUtils.h>
4
2
  #include <react/renderer/core/ComponentDescriptor.h>
5
3
  #include <react/renderer/textlayoutmanager/RCTAttributedTextUtils.h>
@@ -303,5 +301,3 @@ RootShadowNode::Unshared MarkdownCommitHook::shadowTreeWillCommit(
303
301
 
304
302
  } // namespace livemarkdown
305
303
  } // namespace expensify
306
-
307
- #endif // RCT_NEW_ARCH_ENABLED
@@ -1,5 +1,3 @@
1
- // This guard prevent this file to be compiled in the old architecture.
2
- #ifdef RCT_NEW_ARCH_ENABLED
3
1
  #import <React/RCTViewComponentView.h>
4
2
 
5
3
  NS_ASSUME_NONNULL_BEGIN
@@ -8,5 +6,3 @@ NS_ASSUME_NONNULL_BEGIN
8
6
  @end
9
7
 
10
8
  NS_ASSUME_NONNULL_END
11
-
12
- #endif /* RCT_NEW_ARCH_ENABLED */
@@ -1,19 +1,29 @@
1
- // This guard prevent this file to be compiled in the old architecture.
2
- #ifdef RCT_NEW_ARCH_ENABLED
1
+ #import <react/debug/react_native_assert.h>
3
2
  #import <react/renderer/components/RNLiveMarkdownSpec/Props.h>
3
+ #import <React/RCTFabricComponentsPlugins.h>
4
+ #import <React/RCTUITextField.h>
4
5
 
6
+ #import <RNLiveMarkdown/MarkdownLayoutManager.h>
7
+ #import <RNLiveMarkdown/MarkdownShadowFamilyRegistry.h>
5
8
  #import <RNLiveMarkdown/MarkdownTextInputDecoratorComponentView.h>
6
- #import <RNLiveMarkdown/MarkdownTextInputDecoratorView.h>
9
+ #import <RNLiveMarkdown/MarkdownTextInputDecoratorViewComponentDescriptor.h>
10
+ #import <RNLiveMarkdown/RCTBackedTextFieldDelegateAdapter+Markdown.h>
7
11
  #import <RNLiveMarkdown/RCTMarkdownStyle.h>
12
+ #import <RNLiveMarkdown/RCTTextInputComponentView+Markdown.h>
13
+ #import <RNLiveMarkdown/RCTUITextView+Markdown.h>
8
14
 
9
- #import <RNLiveMarkdown/MarkdownTextInputDecoratorViewComponentDescriptor.h>
10
- #import "MarkdownShadowFamilyRegistry.h"
11
- #import "RCTFabricComponentsPlugins.h"
15
+ #import <objc/runtime.h>
12
16
 
13
17
  using namespace facebook::react;
14
18
 
15
19
  @implementation MarkdownTextInputDecoratorComponentView {
16
- MarkdownTextInputDecoratorView *_view;
20
+ RCTMarkdownUtils *_markdownUtils;
21
+ RCTMarkdownStyle *_markdownStyle;
22
+ NSNumber *_parserId;
23
+ __weak RCTTextInputComponentView *_textInput;
24
+ __weak UIView<RCTBackedTextInputViewProtocol> *_backedTextInputView;
25
+ __weak RCTBackedTextFieldDelegateAdapter *_adapter;
26
+ __weak RCTUITextView *_textView;
17
27
  ShadowNodeFamily::Shared _decoratorFamily;
18
28
  }
19
29
 
@@ -33,10 +43,6 @@ using namespace facebook::react;
33
43
  if (self = [super initWithFrame:frame]) {
34
44
  static const auto defaultProps = std::make_shared<const MarkdownTextInputDecoratorViewProps>();
35
45
  _props = defaultProps;
36
-
37
- _view = [[MarkdownTextInputDecoratorView alloc] init];
38
-
39
- self.contentView = _view;
40
46
  }
41
47
 
42
48
  return self;
@@ -45,11 +51,11 @@ using namespace facebook::react;
45
51
  - (void)updateState:(const facebook::react::State::Shared &)state oldState:(const facebook::react::State::Shared &)oldState
46
52
  {
47
53
  auto data = std::static_pointer_cast<MarkdownTextInputDecoratorShadowNode::ConcreteState const>(state)->getData();
48
-
54
+
49
55
  if (_decoratorFamily != nullptr) {
50
56
  MarkdownShadowFamilyRegistry::unregisterFamilyForUpdates(_decoratorFamily);
51
57
  }
52
-
58
+
53
59
  _decoratorFamily = data.decoratorFamily;
54
60
  MarkdownShadowFamilyRegistry::registerFamilyForUpdates(_decoratorFamily);
55
61
  }
@@ -59,30 +65,119 @@ using namespace facebook::react;
59
65
  MarkdownShadowFamilyRegistry::unregisterFamilyForUpdates(_decoratorFamily);
60
66
  _decoratorFamily = nullptr;
61
67
  }
62
-
68
+
63
69
  [super willMoveToSuperview:newSuperview];
64
70
  }
65
71
 
72
+ - (void)didMoveToWindow {
73
+ if (self.superview == nil) {
74
+ return;
75
+ }
76
+
77
+ NSArray *viewsArray = self.superview.subviews;
78
+ NSUInteger currentIndex = [viewsArray indexOfObject:self];
79
+
80
+ react_native_assert(currentIndex != 0 && currentIndex != NSNotFound && "Error while finding current component.");
81
+ UIView *view = [viewsArray objectAtIndex:currentIndex - 1];
82
+
83
+ react_native_assert([view isKindOfClass:[RCTTextInputComponentView class]] && "Previous sibling component is not an instance of RCTTextInputComponentView.");
84
+ _textInput = (RCTTextInputComponentView *)view;
85
+ _backedTextInputView = [_textInput valueForKey:@"_backedTextInputView"];
86
+
87
+ _markdownUtils = [[RCTMarkdownUtils alloc] init];
88
+ react_native_assert(_markdownStyle != nil);
89
+ [_markdownUtils setMarkdownStyle:_markdownStyle];
90
+ [_markdownUtils setParserId:_parserId];
91
+
92
+ [_textInput setMarkdownUtils:_markdownUtils];
93
+ if ([_backedTextInputView isKindOfClass:[RCTUITextField class]]) {
94
+ RCTUITextField *textField = (RCTUITextField *)_backedTextInputView;
95
+ _adapter = [textField valueForKey:@"textInputDelegateAdapter"];
96
+ [_adapter setMarkdownUtils:_markdownUtils];
97
+ } else if ([_backedTextInputView isKindOfClass:[RCTUITextView class]]) {
98
+ _textView = (RCTUITextView *)_backedTextInputView;
99
+ [_textView setMarkdownUtils:_markdownUtils];
100
+ NSLayoutManager *layoutManager = _textView.layoutManager; // switching to TextKit 1 compatibility mode
101
+
102
+ // Correct content height in TextKit 1 compatibility mode. (See https://github.com/Expensify/App/issues/41567)
103
+ // Consider removing this fix if it is no longer needed after migrating to TextKit 2.
104
+ CGSize contentSize = _textView.contentSize;
105
+ CGRect textBounds = [layoutManager usedRectForTextContainer:_textView.textContainer];
106
+ contentSize.height = textBounds.size.height + _textView.textContainerInset.top + _textView.textContainerInset.bottom;
107
+ [_textView setContentSize:contentSize];
108
+
109
+ layoutManager.allowsNonContiguousLayout = NO; // workaround for onScroll issue
110
+ object_setClass(layoutManager, [MarkdownLayoutManager class]);
111
+ [layoutManager setValue:_markdownUtils forKey:@"markdownUtils"];
112
+ } else {
113
+ react_native_assert(false && "Cannot enable Markdown for this type of TextInput.");
114
+ }
115
+ }
116
+
117
+ - (void)willMoveToWindow:(UIWindow *)newWindow
118
+ {
119
+ if (_textInput != nil) {
120
+ [_textInput setMarkdownUtils:nil];
121
+ }
122
+ if (_adapter != nil) {
123
+ [_adapter setMarkdownUtils:nil];
124
+ }
125
+ if (_textView != nil) {
126
+ [_textView setMarkdownUtils:nil];
127
+ if (_textView.layoutManager != nil && [object_getClass(_textView.layoutManager) isEqual:[MarkdownLayoutManager class]]) {
128
+ [_textView.layoutManager setValue:nil forKey:@"markdownUtils"];
129
+ object_setClass(_textView.layoutManager, [NSLayoutManager class]);
130
+ }
131
+ }
132
+ }
133
+
66
134
  - (void)updateProps:(Props::Shared const &)props oldProps:(Props::Shared const &)oldProps
67
135
  {
68
136
  const auto &oldViewProps = *std::static_pointer_cast<MarkdownTextInputDecoratorViewProps const>(_props);
69
137
  const auto &newViewProps = *std::static_pointer_cast<MarkdownTextInputDecoratorViewProps const>(props);
70
138
 
71
139
  if (oldViewProps.parserId != newViewProps.parserId) {
72
- [_view setParserId:@(newViewProps.parserId)];
140
+ [self setParserId:@(newViewProps.parserId)];
73
141
  }
74
142
 
75
143
  // TODO: if (oldViewProps.markdownStyle != newViewProps.markdownStyle)
76
144
  RCTMarkdownStyle *markdownStyle = [[RCTMarkdownStyle alloc] initWithStruct:newViewProps.markdownStyle];
77
- [_view setMarkdownStyle:markdownStyle];
145
+ [self setMarkdownStyle:markdownStyle];
78
146
 
79
147
  [super updateProps:props oldProps:oldProps];
80
148
  }
81
149
 
150
+ - (void)setMarkdownStyle:(RCTMarkdownStyle *)markdownStyle
151
+ {
152
+ // TODO: move to updateProps method
153
+ _markdownStyle = markdownStyle;
154
+ [_markdownUtils setMarkdownStyle:markdownStyle];
155
+ [self applyNewStyles];
156
+ }
157
+
158
+ - (void)setParserId:(NSNumber *)parserId
159
+ {
160
+ // TODO: move to updateProps method
161
+ _parserId = parserId;
162
+ [_markdownUtils setParserId:parserId];
163
+ [self applyNewStyles];
164
+ }
165
+
166
+ - (void)applyNewStyles
167
+ {
168
+ // TODO: call applyNewStyles only once if both markdownStyle and parserId change
169
+ if (_textView != nil) {
170
+ // We want to use `textStorage` for applying markdown when possible. Currently it's only available for UITextView
171
+ [_textView textDidChange];
172
+ } else {
173
+ // apply new styles
174
+ [_textInput _setAttributedString:_backedTextInputView.attributedText];
175
+ }
176
+ }
177
+
82
178
  Class<RCTComponentViewProtocol> MarkdownTextInputDecoratorViewCls(void)
83
179
  {
84
180
  return MarkdownTextInputDecoratorComponentView.class;
85
181
  }
86
182
 
87
183
  @end
88
- #endif
@@ -1,32 +1,11 @@
1
1
  #import <RNLiveMarkdown/MarkdownTextInputDecoratorViewManager.h>
2
- #import <RNLiveMarkdown/MarkdownTextInputDecoratorView.h>
3
2
 
4
3
  @implementation MarkdownTextInputDecoratorViewManager
5
4
 
6
5
  RCT_EXPORT_MODULE(MarkdownTextInputDecoratorView)
7
6
 
8
- - (UIView *)view
9
- {
10
- return [[MarkdownTextInputDecoratorView alloc] init];
11
- }
7
+ RCT_EXPORT_VIEW_PROPERTY(markdownStyle, NSDictionary)
12
8
 
13
- RCT_CUSTOM_VIEW_PROPERTY(markdownStyle, NSDictionary, MarkdownTextInputDecoratorView)
14
- {
15
- #ifdef RCT_NEW_ARCH_ENABLED
16
- // implemented in MarkdownTextInputDecoratorView updateProps:
17
- #else
18
- RCTMarkdownStyle *markdownStyle = [[RCTMarkdownStyle alloc] initWithDictionary:json];
19
- [view setMarkdownStyle:markdownStyle];
20
- #endif /* RCT_NEW_ARCH_ENABLED */
21
- }
22
-
23
- RCT_CUSTOM_VIEW_PROPERTY(parserId, NSNumber, MarkdownTextInputDecoratorView)
24
- {
25
- #ifdef RCT_NEW_ARCH_ENABLED
26
- // implemented in MarkdownTextInputDecoratorView updateProps:
27
- #else
28
- [view setParserId:json];
29
- #endif /* RCT_NEW_ARCH_ENABLED */
30
- }
9
+ RCT_EXPORT_VIEW_PROPERTY(parserId, NSNumber)
31
10
 
32
11
  @end
@@ -1,8 +1,6 @@
1
1
  #import <UIKit/UIKit.h>
2
2
 
3
- #ifdef RCT_NEW_ARCH_ENABLED
4
3
  #import <react/renderer/components/RNLiveMarkdownSpec/Props.h>
5
- #endif /* RCT_NEW_ARCH_ENABLED */
6
4
 
7
5
  NS_ASSUME_NONNULL_BEGIN
8
6
 
@@ -31,11 +29,7 @@ NS_ASSUME_NONNULL_BEGIN
31
29
  @property (nonatomic) UIColor *mentionReportColor;
32
30
  @property (nonatomic) UIColor *mentionReportBackgroundColor;
33
31
 
34
- #ifdef RCT_NEW_ARCH_ENABLED
35
32
  - (instancetype)initWithStruct:(const facebook::react::MarkdownTextInputDecoratorViewMarkdownStyleStruct &)style;
36
- #else
37
- - (instancetype)initWithDictionary:(NSDictionary *)json;
38
- #endif /* RCT_NEW_ARCH_ENABLED */
39
33
 
40
34
  @end
41
35
 
@@ -1,15 +1,9 @@
1
1
  #import <RNLiveMarkdown/RCTMarkdownStyle.h>
2
2
 
3
- #ifdef RCT_NEW_ARCH_ENABLED
4
3
  #import <React/RCTConversions.h>
5
- #else
6
- #import <React/RCTConvert.h>
7
- #endif /* RCT_NEW_ARCH_ENABLED */
8
4
 
9
5
  @implementation RCTMarkdownStyle
10
6
 
11
- #ifdef RCT_NEW_ARCH_ENABLED
12
-
13
7
  - (instancetype)initWithStruct:(const facebook::react::MarkdownTextInputDecoratorViewMarkdownStyleStruct &)style
14
8
  {
15
9
  if (self = [super init]) {
@@ -49,47 +43,4 @@
49
43
  return self;
50
44
  }
51
45
 
52
- #else
53
-
54
- - (instancetype)initWithDictionary:(NSDictionary *)json
55
- {
56
- if (self = [super init]) {
57
- _syntaxColor = [RCTConvert UIColor:json[@"syntax"][@"color"]];
58
-
59
- _linkColor = [RCTConvert UIColor:json[@"link"][@"color"]];
60
-
61
- _h1FontSize = [RCTConvert CGFloat:json[@"h1"][@"fontSize"]];
62
-
63
- _emojiFontSize = [RCTConvert CGFloat:json[@"emoji"][@"fontSize"]];
64
-
65
- _blockquoteBorderColor = [RCTConvert UIColor:json[@"blockquote"][@"borderColor"]];
66
- _blockquoteBorderWidth = [RCTConvert CGFloat:json[@"blockquote"][@"borderWidth"]];
67
- _blockquoteMarginLeft = [RCTConvert CGFloat:json[@"blockquote"][@"marginLeft"]];
68
- _blockquotePaddingLeft = [RCTConvert CGFloat:json[@"blockquote"][@"paddingLeft"]];
69
-
70
- _codeFontFamily = [RCTConvert NSString:json[@"code"][@"fontFamily"]];
71
- _codeFontSize = [RCTConvert CGFloat:json[@"code"][@"fontSize"]];
72
- _codeColor = [RCTConvert UIColor:json[@"code"][@"color"]];
73
- _codeBackgroundColor = [RCTConvert UIColor:json[@"code"][@"backgroundColor"]];
74
-
75
- _preFontFamily = [RCTConvert NSString:json[@"pre"][@"fontFamily"]];
76
- _preFontSize = [RCTConvert CGFloat:json[@"pre"][@"fontSize"]];
77
- _preColor = [RCTConvert UIColor:json[@"pre"][@"color"]];
78
- _preBackgroundColor = [RCTConvert UIColor:json[@"pre"][@"backgroundColor"]];
79
-
80
- _mentionHereColor = [RCTConvert UIColor:json[@"mentionHere"][@"color"]];
81
- _mentionHereBackgroundColor = [RCTConvert UIColor:json[@"mentionHere"][@"backgroundColor"]];
82
-
83
- _mentionUserColor = [RCTConvert UIColor:json[@"mentionUser"][@"color"]];
84
- _mentionUserBackgroundColor = [RCTConvert UIColor:json[@"mentionUser"][@"backgroundColor"]];
85
-
86
- _mentionReportColor = [RCTConvert UIColor:json[@"mentionReport"][@"color"]];
87
- _mentionReportBackgroundColor = [RCTConvert UIColor:json[@"mentionReport"][@"backgroundColor"]];
88
- }
89
-
90
- return self;
91
- }
92
-
93
- #endif /* RCT_NEW_ARCH_ENABLED */
94
-
95
46
  @end
@@ -1,6 +1,3 @@
1
- // This guard prevent this file to be compiled in the old architecture.
2
- #ifdef RCT_NEW_ARCH_ENABLED
3
-
4
1
  #import <React/RCTTextInputComponentView.h>
5
2
  #import <RNLiveMarkdown/RCTMarkdownUtils.h>
6
3
 
@@ -19,5 +16,3 @@ NS_ASSUME_NONNULL_BEGIN
19
16
  @end
20
17
 
21
18
  NS_ASSUME_NONNULL_END
22
-
23
- #endif /* RCT_NEW_ARCH_ENABLED */
@@ -1,6 +1,3 @@
1
- // This guard prevent this file to be compiled in the old architecture.
2
- #ifdef RCT_NEW_ARCH_ENABLED
3
-
4
1
  #import <RNLiveMarkdown/RCTTextInputComponentView+Markdown.h>
5
2
  #import <RNLiveMarkdown/RCTMarkdownUtils.h>
6
3
  #import <React/RCTUITextField.h>
@@ -93,5 +90,3 @@ using namespace expensify::livemarkdown;
93
90
  }
94
91
 
95
92
  @end
96
-
97
- #endif /* RCT_NEW_ARCH_ENABLED */
@@ -62,7 +62,6 @@ function processMarkdownStyle(input) {
62
62
  return processColorsInMarkdownStyle((0, _styleUtils.mergeMarkdownStyleWithDefault)(input));
63
63
  }
64
64
  const MarkdownTextInput = /*#__PURE__*/_react.default.forwardRef((props, ref) => {
65
- const IS_FABRIC = 'nativeFabricUIManager' in global;
66
65
  const markdownStyle = _react.default.useMemo(() => processMarkdownStyle(props.markdownStyle), [props.markdownStyle]);
67
66
  if (props.parser === undefined) {
68
67
  throw new Error('[react-native-live-markdown] `parser` is undefined');
@@ -82,15 +81,12 @@ const MarkdownTextInput = /*#__PURE__*/_react.default.forwardRef((props, ref) =>
82
81
  return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_reactNative.TextInput, _extends({}, props, {
83
82
  ref: ref
84
83
  })), /*#__PURE__*/_react.default.createElement(_MarkdownTextInputDecoratorViewNativeComponent.default, {
85
- style: IS_FABRIC ? styles.farAway : styles.displayNone,
84
+ style: styles.farAway,
86
85
  markdownStyle: markdownStyle,
87
86
  parserId: parserId
88
87
  }));
89
88
  });
90
89
  const styles = _reactNative.StyleSheet.create({
91
- displayNone: {
92
- display: 'none'
93
- },
94
90
  farAway: {
95
91
  position: 'absolute',
96
92
  top: 1e8,
@@ -1 +1 @@
1
- {"version":3,"names":["_reactNative","require","_react","_interopRequireDefault","_reactNativeReanimated","_MarkdownTextInputDecoratorViewNativeComponent","_NativeLiveMarkdownModule","_styleUtils","e","__esModule","default","_extends","Object","assign","bind","n","arguments","length","t","r","hasOwnProperty","call","apply","initialized","workletRuntime","getWorkletRuntime","undefined","Error","initializeLiveMarkdownIfNeeded","NativeLiveMarkdownModule","install","global","jsi_setMarkdownRuntime","createWorkletRuntime","registerParser","parser","shareableWorklet","makeShareableCloneRecursive","parserId","jsi_registerMarkdownWorklet","unregisterParser","jsi_unregisterMarkdownWorklet","processColorsInMarkdownStyle","input","output","JSON","parse","stringify","keys","forEach","key","obj","prop","endsWith","processColor","processMarkdownStyle","mergeMarkdownStyleWithDefault","MarkdownTextInput","React","forwardRef","props","ref","IS_FABRIC","markdownStyle","useMemo","workletHash","__workletHash","useEffect","createElement","Fragment","TextInput","style","styles","farAway","displayNone","StyleSheet","create","display","position","top","left","_default","exports"],"sourceRoot":"../../src","sources":["MarkdownTextInput.tsx"],"mappings":";;;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAC,sBAAA,CAAAF,OAAA;AAEA,IAAAG,sBAAA,GAAAH,OAAA;AAIA,IAAAI,8CAAA,GAAAF,sBAAA,CAAAF,OAAA;AAEA,IAAAK,yBAAA,GAAAH,sBAAA,CAAAF,OAAA;AACA,IAAAM,WAAA,GAAAN,OAAA;AAA2D,SAAAE,uBAAAK,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAAA,SAAAG,SAAA,WAAAA,QAAA,GAAAC,MAAA,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7B,MAAM,IAAIC,KAAK,CAAC,wDAAwD,CAAC;EAC3E;EAEA,MAAMW,QAAQ,GAAGoB,cAAK,CAACM,OAAO,CAAC,MAAM;IACnC,OAAO9B,cAAc,CAAC0B,KAAK,CAACzB,MAAM,CAAC;EACrC,CAAC,EAAE,CAACyB,KAAK,CAACzB,MAAM,CAAC,CAAC;EAElBuB,cAAK,CAACS,SAAS,CAAC,MAAM;IACpB,OAAO,MAAM3B,gBAAgB,CAACF,QAAQ,CAAC;EACzC,CAAC,EAAE,CAACA,QAAQ,CAAC,CAAC;EAEd,oBACEpC,MAAA,CAAAQ,OAAA,CAAA0D,aAAA,CAAAlE,MAAA,CAAAQ,OAAA,CAAA2D,QAAA,qBACEnE,MAAA,CAAAQ,OAAA,CAAA0D,aAAA,CAACpE,YAAA,CAAAsE,SAAS,EAAA3D,QAAA,KACJiD,KAAK;IACTC,GAAG,EAAEA;EAAI,EACV,CAAC,eACF3D,MAAA,CAAAQ,OAAA,CAAA0D,aAAA,CAAC/D,8CAAA,CAAAK,OAA6C;IAC5C6D,KAAK,EAAET,SAAS,GAAGU,MAAM,CAACC,OAAO,GAAGD,MAAM,CAACE,WAAY;IACvDX,aAAa,EAAEA,aAAc;IAC7BzB,QAAQ,EAAEA;EAAS,CACpB,CACD,CAAC;AAEP,CAAC,CAAC;AAEF,MAAMkC,MAAM,GAAGG,uBAAU,CAACC,MAAM,CAAC;EAC/BF,WAAW,EAAE;IACXG,OAAO,EAAE;EACX,CAAC;EACDJ,OAAO,EAAE;IACPK,QAAQ,EAAE,UAAU;IACpBC,GAAG,EAAE,GAAG;IACRC,IAAI,EAAE;EACR;AACF,CAAC,CAAC;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAxE,OAAA,GAIY+C,iBAAiB","ignoreList":[]}
1
+ {"version":3,"names":["_reactNative","require","_react","_interopRequireDefault","_reactNativeReanimated","_MarkdownTextInputDecoratorViewNativeComponent","_NativeLiveMarkdownModule","_styleUtils","e","__esModule","default","_extends","Object","assign","bind","n","arguments","length","t","r","hasOwnProperty","call","apply","initialized","workletRuntime","getWorkletRuntime","undefined","Error","initializeLiveMarkdownIfNeeded","NativeLiveMarkdownModule","install","global","jsi_setMarkdownRuntime","createWorkletRuntime","registerParser","parser","shareableWorklet","makeShareableCloneRecursive","parserId","jsi_registerMarkdownWorklet","unregisterParser","jsi_unregisterMarkdownWorklet","processColorsInMarkdownStyle","input","output","JSON","parse","stringify","keys","forEach","key","obj","prop","endsWith","processColor","processMarkdownStyle","mergeMarkdownStyleWithDefault","MarkdownTextInput","React","forwardRef","props","ref","markdownStyle","useMemo","workletHash","__workletHash","useEffect","createElement","Fragment","TextInput","style","styles","farAway","StyleSheet","create","position","top","left","_default","exports"],"sourceRoot":"../../src","sources":["MarkdownTextInput.tsx"],"mappings":";;;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAC,sBAAA,CAAAF,OAAA;AAEA,IAAAG,sBAAA,GAAAH,OAAA;AAIA,IAAAI,8CAAA,GAAAF,sBAAA,CAAAF,OAAA;AAEA,IAAAK,yBAAA,GAAAH,sBAAA,CAAAF,OAAA;AACA,IAAAM,WAAA,GAAAN,OAAA;AAA2D,SAAAE,uBAAAK,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAAA,SAAAG,SAAA,WAAAA,QAAA,GAAAC,MAAA,CAAAC,MAAA,GAAAD,MAAA,CAAAC,MAAA,CAAAC,IAAA,eAAAC,CAAA,aAAAP,CAAA,MAAAA,CAAA,GAAAQ,SAAA,CAAAC,MAAA,EAAAT,CAAA,UAAAU,CAAA,GAAAF,SAAA,CAAAR,CAAA,YAAAW,CAAA,IAAAD,CAAA,OAAAE,cAAA,CAAAC,IAAA,CAAAH,CAAA,EAAAC,CAAA,MAAAJ,CAAA,CAAAI,CAAA,IAAAD,CAAA,CAAAC,CAAA,aAAAJ,CAAA,KAAAJ,QAAA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AA,CAAAyD,aAAA,CAAAjE,MAAA,CAAAQ,OAAA,CAAA0D,QAAA,qBACElE,MAAA,CAAAQ,OAAA,CAAAyD,aAAA,CAACnE,YAAA,CAAAqE,SAAS,EAAA1D,QAAA,KACJiD,KAAK;IACTC,GAAG,EAAEA;EAAI,EACV,CAAC,eACF3D,MAAA,CAAAQ,OAAA,CAAAyD,aAAA,CAAC9D,8CAAA,CAAAK,OAA6C;IAC5C4D,KAAK,EAAEC,MAAM,CAACC,OAAQ;IACtBV,aAAa,EAAEA,aAAc;IAC7BxB,QAAQ,EAAEA;EAAS,CACpB,CACD,CAAC;AAEP,CAAC,CAAC;AAEF,MAAMiC,MAAM,GAAGE,uBAAU,CAACC,MAAM,CAAC;EAC/BF,OAAO,EAAE;IACPG,QAAQ,EAAE,UAAU;IACpBC,GAAG,EAAE,GAAG;IACRC,IAAI,EAAE;EACR;AACF,CAAC,CAAC;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAArE,OAAA,GAIY+C,iBAAiB","ignoreList":[]}
@@ -54,7 +54,6 @@ function processMarkdownStyle(input) {
54
54
  return processColorsInMarkdownStyle(mergeMarkdownStyleWithDefault(input));
55
55
  }
56
56
  const MarkdownTextInput = /*#__PURE__*/React.forwardRef((props, ref) => {
57
- const IS_FABRIC = 'nativeFabricUIManager' in global;
58
57
  const markdownStyle = React.useMemo(() => processMarkdownStyle(props.markdownStyle), [props.markdownStyle]);
59
58
  if (props.parser === undefined) {
60
59
  throw new Error('[react-native-live-markdown] `parser` is undefined');
@@ -74,15 +73,12 @@ const MarkdownTextInput = /*#__PURE__*/React.forwardRef((props, ref) => {
74
73
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(TextInput, _extends({}, props, {
75
74
  ref: ref
76
75
  })), /*#__PURE__*/React.createElement(MarkdownTextInputDecoratorViewNativeComponent, {
77
- style: IS_FABRIC ? styles.farAway : styles.displayNone,
76
+ style: styles.farAway,
78
77
  markdownStyle: markdownStyle,
79
78
  parserId: parserId
80
79
  }));
81
80
  });
82
81
  const styles = StyleSheet.create({
83
- displayNone: {
84
- display: 'none'
85
- },
86
82
  farAway: {
87
83
  position: 'absolute',
88
84
  top: 1e8,
@@ -1 +1 @@
1
- {"version":3,"names":["StyleSheet","TextInput","processColor","React","createWorkletRuntime","makeShareableCloneRecursive","MarkdownTextInputDecoratorViewNativeComponent","NativeLiveMarkdownModule","mergeMarkdownStyleWithDefault","initialized","workletRuntime","getWorkletRuntime","undefined","Error","initializeLiveMarkdownIfNeeded","install","global","jsi_setMarkdownRuntime","registerParser","parser","shareableWorklet","parserId","jsi_registerMarkdownWorklet","unregisterParser","jsi_unregisterMarkdownWorklet","processColorsInMarkdownStyle","input","output","JSON","parse","stringify","Object","keys","forEach","key","obj","prop","endsWith","processMarkdownStyle","MarkdownTextInput","forwardRef","props","ref","IS_FABRIC","markdownStyle","useMemo","workletHash","__workletHash","useEffect","createElement","Fragment","_extends","style","styles","farAway","displayNone","create","display","position","top","left"],"sourceRoot":"../../src","sources":["MarkdownTextInput.tsx"],"mappings":";AAAA,SAAQA,UAAU,EAAEC,SAAS,EAAEC,YAAY,QAAO,cAAc;AAChE,OAAOC,KAAK,MAAM,OAAO;AAEzB,SAAQC,oBAAoB,EAAEC,2BAA2B,QAAO,yBAAyB;AAIzF,OAAOC,6CAA6C,MAAM,iDAAiD;AAE3G,OAAOC,wBAAwB,MAAM,4BAA4B;AACjE,SAAQC,6BAA6B,QAAO,cAAc;AAa1D,IAAIC,WAAW,GAAG,KAAK;AACvB,IAAIC,cAA0C;AAE9C,SAASC,iBAAiBA,CAAA,EAAmB;EAC3C,IAAID,cAAc,KAAKE,SAAS,EAAE;IAChC,MAAM,IAAIC,KAAK,CACb,qNACF,CAAC;EACH;EACA,OAAOH,cAAc;AACvB;AAEA,SAASI,8BAA8BA,CAAA,EAAG;EACxC,IAAIL,WAAW,EAAE;IACf;EACF;EACA,IAAIF,wBAAwB,EAAE;IAC5BA,wBAAwB,CAACQ,O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ACpB,CACD,CAAC;AAEP,CAAC,CAAC;AAEF,MAAMgC,MAAM,GAAGrD,UAAU,CAACwD,MAAM,CAAC;EAC/BD,WAAW,EAAE;IACXE,OAAO,EAAE;EACX,CAAC;EACDH,OAAO,EAAE;IACPI,QAAQ,EAAE,UAAU;IACpBC,GAAG,EAAE,GAAG;IACRC,IAAI,EAAE;EACR;AACF,CAAC,CAAC;AAIF,eAAerB,iBAAiB;AAEhC,SAAQ5B,iBAAiB","ignoreList":[]}
1
+ {"version":3,"names":["StyleSheet","TextInput","processColor","React","createWorkletRuntime","makeShareableCloneRecursive","MarkdownTextInputDecoratorViewNativeComponent","NativeLiveMarkdownModule","mergeMarkdownStyleWithDefault","initialized","workletRuntime","getWorkletRuntime","undefined","Error","initializeLiveMarkdownIfNeeded","install","global","jsi_setMarkdownRuntime","registerParser","parser","shareableWorklet","parserId","jsi_registerMarkdownWorklet","unregisterParser","jsi_unregisterMarkdownWorklet","processColorsInMarkdownStyle","input","output","JSON","parse","stringify","Object","keys","forEach","key","obj","prop","endsWith","processMarkdownStyle","MarkdownTextInput","forwardRef","props","ref","markdownStyle","useMemo","workletHash","__workletHash","useEffect","createElement","Fragment","_extends","style","styles","farAway","create","position","top","left"],"sourceRoot":"../../src","sources":["MarkdownTextInput.tsx"],"mappings":";AAAA,SAAQA,UAAU,EAAEC,SAAS,EAAEC,YAAY,QAAO,cAAc;AAChE,OAAOC,KAAK,MAAM,OAAO;AAEzB,SAAQC,oBAAoB,EAAEC,2BAA2B,QAAO,yBAAyB;AAIzF,OAAOC,6CAA6C,MAAM,iDAAiD;AAE3G,OAAOC,wBAAwB,MAAM,4BAA4B;AACjE,SAAQC,6BAA6B,QAAO,cAAc;AAa1D,IAAIC,WAAW,GAAG,KAAK;AACvB,IAAIC,cAA0C;AAE9C,SAASC,iBAAiBA,CAAA,EAAmB;EAC3C,IAAID,cAAc,KAAKE,SAAS,EAAE;IAChC,MAAM,IAAIC,KAAK,CACb,qNACF,CAAC;EACH;EACA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AAC,eAAe,CAAC,CAAC,MAAM,CAAC,EAAE,aAAa,EAAE,CAAC,CAAC,KAAK,MAAM,CAAC;IAExH,IAAI,6BAA6B,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC;CAC/D;AAKD,iBAAS,iBAAiB,IAAI,cAAc,CAO3C;AA4BD,UAAU,sBAAuB,SAAQ,cAAc,EAAE,sBAAsB;IAC7E,aAAa,CAAC,EAAE,oBAAoB,CAAC;IACrC,eAAe,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,KAAK,qBAAqB,CAAC;IAC/H,MAAM,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,aAAa,EAAE,CAAC;CAC5C;AAED,KAAK,qBAAqB,GAAG;IAC3B,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;CACtB,CAAC;AAEF,KAAK,iBAAiB,GAAG,SAAS,GAAG,KAAK,CAAC,SAAS,CAAC,sBAAsB,CAAC,CAAC;AAuB7E,QAAA,MAAM,iBAAiB,kGAkCrB,CAAC;AAUH,YAAY,EAAC,oBAAoB,IAAI,aAAa,EAAE,sBAAsB,EAAC,CAAC;AAE5E,eAAe,iBAAiB,CAAC;AAEjC,OAAO,EAAC,iBAAiB,EAAC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@expensify/react-native-live-markdown",
3
- "version": "0.1.244",
3
+ "version": "0.1.246",
4
4
  "description": "Drop-in replacement for React Native's TextInput component with Markdown formatting.",
5
5
  "main": "lib/commonjs/index",
6
6
  "module": "lib/module/index",
@@ -165,6 +165,9 @@
165
165
  "codegenConfig": {
166
166
  "name": "RNLiveMarkdownSpec",
167
167
  "type": "all",
168
- "jsSrcsDir": "src"
168
+ "jsSrcsDir": "src",
169
+ "android": {
170
+ "javaPackageName": "com.expensify.livemarkdown"
171
+ }
169
172
  }
170
173
  }
@@ -94,8 +94,6 @@ function processMarkdownStyle(input: PartialMarkdownStyle | undefined): Markdown
94
94
  }
95
95
 
96
96
  const MarkdownTextInput = React.forwardRef<MarkdownTextInput, MarkdownTextInputProps>((props, ref) => {
97
- const IS_FABRIC = 'nativeFabricUIManager' in global;
98
-
99
97
  const markdownStyle = React.useMemo(() => processMarkdownStyle(props.markdownStyle), [props.markdownStyle]);
100
98
 
101
99
  if (props.parser === undefined) {
@@ -123,7 +121,7 @@ const MarkdownTextInput = React.forwardRef<MarkdownTextInput, MarkdownTextInputP
123
121
  ref={ref}
124
122
  />
125
123
  <MarkdownTextInputDecoratorViewNativeComponent
126
- style={IS_FABRIC ? styles.farAway : styles.displayNone}
124
+ style={styles.farAway}
127
125
  markdownStyle={markdownStyle}
128
126
  parserId={parserId}
129
127
  />
@@ -132,9 +130,6 @@ const MarkdownTextInput = React.forwardRef<MarkdownTextInput, MarkdownTextInputP
132
130
  });
133
131
 
134
132
  const styles = StyleSheet.create({
135
- displayNone: {
136
- display: 'none',
137
- },
138
133
  farAway: {
139
134
  position: 'absolute',
140
135
  top: 1e8,
@@ -1,12 +0,0 @@
1
- package com.expensify.livemarkdown;
2
-
3
- import com.facebook.react.bridge.ReactApplicationContext;
4
- import com.facebook.react.bridge.ReactContextBaseJavaModule;
5
-
6
- abstract class LiveMarkdownModuleSpec extends ReactContextBaseJavaModule {
7
- LiveMarkdownModuleSpec(ReactApplicationContext context) {
8
- super(context);
9
- }
10
-
11
- public abstract boolean install();
12
- }
@@ -1,11 +0,0 @@
1
- package com.expensify.livemarkdown;
2
-
3
- import android.view.View;
4
-
5
- import com.facebook.react.bridge.ReadableMap;
6
- import com.facebook.react.uimanager.SimpleViewManager;
7
-
8
- public abstract class MarkdownTextInputDecoratorViewManagerSpec<T extends View> extends SimpleViewManager<T> {
9
- public abstract void setMarkdownStyle(T view, ReadableMap value);
10
- public abstract void setParserId(T view, int value);
11
- }
@@ -1,37 +0,0 @@
1
-
2
- /**
3
- * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
4
- *
5
- * Do not edit this file as changes may cause incorrect behavior and will be lost
6
- * once the code is regenerated.
7
- *
8
- * @generated by codegen project: GenerateModuleJavaSpec.js
9
- *
10
- * @nolint
11
- */
12
-
13
- package com.expensify.livemarkdown;
14
-
15
- import com.facebook.proguard.annotations.DoNotStrip;
16
- import com.facebook.react.bridge.ReactApplicationContext;
17
- import com.facebook.react.bridge.ReactContextBaseJavaModule;
18
- import com.facebook.react.bridge.ReactMethod;
19
- import com.facebook.react.turbomodule.core.interfaces.TurboModule;
20
- import javax.annotation.Nonnull;
21
-
22
- public abstract class NativeLiveMarkdownModuleSpec extends ReactContextBaseJavaModule implements TurboModule {
23
- public static final String NAME = "LiveMarkdownModule";
24
-
25
- public NativeLiveMarkdownModuleSpec(ReactApplicationContext reactContext) {
26
- super(reactContext);
27
- }
28
-
29
- @Override
30
- public @Nonnull String getName() {
31
- return NAME;
32
- }
33
-
34
- @ReactMethod(isBlockingSynchronousMethod = true)
35
- @DoNotStrip
36
- public abstract boolean install();
37
- }
@@ -1,9 +0,0 @@
1
- package com.expensify.livemarkdown;
2
-
3
- import com.facebook.react.bridge.UIManager;
4
-
5
- public class NativeProxy {
6
- public void createCommitHook(UIManager uiManager) {
7
- // no-op on the old arch
8
- }
9
- }
@@ -1,14 +0,0 @@
1
- #import <UIKit/UIKit.h>
2
- #import <RNLiveMarkdown/RCTMarkdownStyle.h>
3
-
4
- NS_ASSUME_NONNULL_BEGIN
5
-
6
- @interface MarkdownTextInputDecoratorView : UIView
7
-
8
- - (void)setMarkdownStyle:(RCTMarkdownStyle *)markdownStyle;
9
-
10
- - (void)setParserId:(NSNumber *)parserId;
11
-
12
- @end
13
-
14
- NS_ASSUME_NONNULL_END
@@ -1,139 +0,0 @@
1
- #import <React/RCTUITextField.h>
2
- #import "react_native_assert.h"
3
-
4
- #import <RNLiveMarkdown/MarkdownLayoutManager.h>
5
- #import <RNLiveMarkdown/MarkdownTextInputDecoratorView.h>
6
- #import <RNLiveMarkdown/RCTBackedTextFieldDelegateAdapter+Markdown.h>
7
- #import <RNLiveMarkdown/RCTUITextView+Markdown.h>
8
-
9
- #ifdef RCT_NEW_ARCH_ENABLED
10
- #import <RNLiveMarkdown/RCTTextInputComponentView+Markdown.h>
11
- #else
12
- #import <RNLiveMarkdown/RCTBaseTextInputView+Markdown.h>
13
- #endif /* RCT_NEW_ARCH_ENABLED */
14
-
15
- #import <objc/runtime.h>
16
-
17
- @implementation MarkdownTextInputDecoratorView {
18
- RCTMarkdownUtils *_markdownUtils;
19
- RCTMarkdownStyle *_markdownStyle;
20
- NSNumber *_parserId;
21
- #ifdef RCT_NEW_ARCH_ENABLED
22
- __weak RCTTextInputComponentView *_textInput;
23
- #else
24
- __weak RCTBaseTextInputView *_textInput;
25
- #endif /* RCT_NEW_ARCH_ENABLED */
26
- __weak UIView<RCTBackedTextInputViewProtocol> *_backedTextInputView;
27
- __weak RCTBackedTextFieldDelegateAdapter *_adapter;
28
- __weak RCTUITextView *_textView;
29
- }
30
-
31
- - (void)didMoveToWindow {
32
- #ifdef RCT_NEW_ARCH_ENABLED
33
- if (self.superview.superview == nil) {
34
- return;
35
- }
36
- #else
37
- if (self.superview == nil) {
38
- return;
39
- }
40
- #endif /* RCT_NEW_ARCH_ENABLED */
41
-
42
- #ifdef RCT_NEW_ARCH_ENABLED
43
- NSArray *viewsArray = self.superview.superview.subviews;
44
- NSUInteger currentIndex = [viewsArray indexOfObject:self.superview];
45
- #else
46
- NSArray *viewsArray = self.superview.subviews;
47
- NSUInteger currentIndex = [viewsArray indexOfObject:self];
48
- #endif /* RCT_NEW_ARCH_ENABLED */
49
-
50
- react_native_assert(currentIndex != 0 && currentIndex != NSNotFound && "Error while finding current component.");
51
- UIView *view = [viewsArray objectAtIndex:currentIndex - 1];
52
-
53
- #ifdef RCT_NEW_ARCH_ENABLED
54
- react_native_assert([view isKindOfClass:[RCTTextInputComponentView class]] && "Previous sibling component is not an instance of RCTTextInputComponentView.");
55
- _textInput = (RCTTextInputComponentView *)view;
56
- _backedTextInputView = [_textInput valueForKey:@"_backedTextInputView"];
57
- #else
58
- react_native_assert([view isKindOfClass:[RCTBaseTextInputView class]] && "Previous sibling component is not an instance of RCTBaseTextInputView.");
59
- _textInput = (RCTBaseTextInputView *)view;
60
- _backedTextInputView = _textInput.backedTextInputView;
61
- #endif /* RCT_NEW_ARCH_ENABLED */
62
-
63
- _markdownUtils = [[RCTMarkdownUtils alloc] init];
64
- react_native_assert(_markdownStyle != nil);
65
- [_markdownUtils setMarkdownStyle:_markdownStyle];
66
- [_markdownUtils setParserId:_parserId];
67
-
68
- [_textInput setMarkdownUtils:_markdownUtils];
69
- if ([_backedTextInputView isKindOfClass:[RCTUITextField class]]) {
70
- RCTUITextField *textField = (RCTUITextField *)_backedTextInputView;
71
- _adapter = [textField valueForKey:@"textInputDelegateAdapter"];
72
- [_adapter setMarkdownUtils:_markdownUtils];
73
- } else if ([_backedTextInputView isKindOfClass:[RCTUITextView class]]) {
74
- _textView = (RCTUITextView *)_backedTextInputView;
75
- [_textView setMarkdownUtils:_markdownUtils];
76
- NSLayoutManager *layoutManager = _textView.layoutManager; // switching to TextKit 1 compatibility mode
77
-
78
- // Correct content height in TextKit 1 compatibility mode. (See https://github.com/Expensify/App/issues/41567)
79
- // Consider removing this fix if it is no longer needed after migrating to TextKit 2.
80
- CGSize contentSize = _textView.contentSize;
81
- CGRect textBounds = [layoutManager usedRectForTextContainer:_textView.textContainer];
82
- contentSize.height = textBounds.size.height + _textView.textContainerInset.top + _textView.textContainerInset.bottom;
83
- [_textView setContentSize:contentSize];
84
-
85
- layoutManager.allowsNonContiguousLayout = NO; // workaround for onScroll issue
86
- object_setClass(layoutManager, [MarkdownLayoutManager class]);
87
- [layoutManager setValue:_markdownUtils forKey:@"markdownUtils"];
88
- } else {
89
- react_native_assert(false && "Cannot enable Markdown for this type of TextInput.");
90
- }
91
- }
92
-
93
- - (void)willMoveToWindow:(UIWindow *)newWindow
94
- {
95
- if (_textInput != nil) {
96
- [_textInput setMarkdownUtils:nil];
97
- }
98
- if (_adapter != nil) {
99
- [_adapter setMarkdownUtils:nil];
100
- }
101
- if (_textView != nil) {
102
- [_textView setMarkdownUtils:nil];
103
- if (_textView.layoutManager != nil && [object_getClass(_textView.layoutManager) isEqual:[MarkdownLayoutManager class]]) {
104
- [_textView.layoutManager setValue:nil forKey:@"markdownUtils"];
105
- object_setClass(_textView.layoutManager, [NSLayoutManager class]);
106
- }
107
- }
108
- }
109
-
110
- - (void)setMarkdownStyle:(RCTMarkdownStyle *)markdownStyle
111
- {
112
- _markdownStyle = markdownStyle;
113
- [_markdownUtils setMarkdownStyle:markdownStyle];
114
- [self applyNewStyles];
115
- }
116
-
117
- - (void)setParserId:(NSNumber *)parserId
118
- {
119
- _parserId = parserId;
120
- [_markdownUtils setParserId:parserId];
121
- [self applyNewStyles];
122
- }
123
-
124
- - (void)applyNewStyles
125
- {
126
- if (_textView != nil) {
127
- // We want to use `textStorage` for applying markdown when possible. Currently it's only available for UITextView
128
- [_textView textDidChange];
129
- } else {
130
- // apply new styles
131
- #ifdef RCT_NEW_ARCH_ENABLED
132
- [_textInput _setAttributedString:_backedTextInputView.attributedText];
133
- #else
134
- [_textInput setAttributedText:_textInput.attributedText];
135
- #endif /* RCT_NEW_ARCH_ENABLED */
136
- }
137
- }
138
-
139
- @end
@@ -1,18 +0,0 @@
1
- #import <React/RCTBaseTextInputView.h>
2
- #import <RNLiveMarkdown/RCTMarkdownUtils.h>
3
-
4
- NS_ASSUME_NONNULL_BEGIN
5
-
6
- @interface RCTBaseTextInputView (Markdown)
7
-
8
- @property(nonatomic, nullable, getter=getMarkdownUtils) RCTMarkdownUtils *markdownUtils;
9
-
10
- - (void)markdown_setAttributedText:(NSAttributedString *)attributedText;
11
-
12
- - (BOOL)markdown_textOf:(NSAttributedString *)newText equals:(NSAttributedString *)oldText;
13
-
14
- - (void)markdown_updateLocalData;
15
-
16
- @end
17
-
18
- NS_ASSUME_NONNULL_END
@@ -1,101 +0,0 @@
1
- #import <RNLiveMarkdown/RCTBaseTextInputView+Markdown.h>
2
- #import <RNLiveMarkdown/RCTMarkdownUtils.h>
3
- #import <objc/message.h>
4
-
5
- @implementation RCTBaseTextInputView (Markdown)
6
-
7
- - (void)setMarkdownUtils:(RCTMarkdownUtils *)markdownUtils {
8
- objc_setAssociatedObject(self, @selector(getMarkdownUtils), markdownUtils, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
9
- }
10
-
11
- - (RCTMarkdownUtils *)getMarkdownUtils {
12
- return objc_getAssociatedObject(self, @selector(getMarkdownUtils));
13
- }
14
-
15
- - (void)markdown_setAttributedText:(NSAttributedString *)attributedText
16
- {
17
- RCTMarkdownUtils *markdownUtils = [self getMarkdownUtils];
18
- if (markdownUtils != nil) {
19
- attributedText = [markdownUtils parseMarkdown:attributedText withDefaultTextAttributes:self.backedTextInputView.defaultTextAttributes];
20
- }
21
-
22
- // Call the original method
23
- [self markdown_setAttributedText:attributedText];
24
- }
25
-
26
- - (BOOL)markdown_textOf:(NSAttributedString *)newText equals:(NSAttributedString *)oldText
27
- {
28
- RCTMarkdownUtils *markdownUtils = [self getMarkdownUtils];
29
- if (markdownUtils != nil) {
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];
38
- }
39
-
40
- return [self markdown_textOf:newText equals:oldText];
41
- }
42
-
43
- - (void)markdown_updateLocalData
44
- {
45
- RCTMarkdownUtils *markdownUtils = [self getMarkdownUtils];
46
- if (markdownUtils != nil) {
47
- id<RCTBackedTextInputViewProtocol> backedTextInputView = self.backedTextInputView;
48
- NSAttributedString *oldAttributedText = backedTextInputView.attributedText;
49
- NSAttributedString *newAttributedText = [markdownUtils parseMarkdown:oldAttributedText withDefaultTextAttributes:backedTextInputView.defaultTextAttributes];
50
- UITextRange *range = backedTextInputView.selectedTextRange;
51
-
52
- // update attributed text without emitting onSelectionChange event
53
- id<RCTBackedTextInputDelegate> delegate = backedTextInputView.textInputDelegate;
54
- backedTextInputView.textInputDelegate = nil;
55
- [backedTextInputView setAttributedText:newAttributedText];
56
- backedTextInputView.textInputDelegate = delegate;
57
-
58
- // restore original selection and emit onSelectionChange event
59
- [backedTextInputView setSelectedTextRange:range notifyDelegate:YES];
60
- }
61
-
62
- // Call the original method
63
- [self markdown_updateLocalData];
64
- }
65
-
66
- + (void)load
67
- {
68
- static dispatch_once_t onceToken;
69
- dispatch_once(&onceToken, ^{
70
- Class cls = [self class];
71
-
72
- {
73
- // swizzle setAttributedText
74
- SEL originalSelector = @selector(setAttributedText:);
75
- SEL swizzledSelector = @selector(markdown_setAttributedText:);
76
- Method originalMethod = class_getInstanceMethod(cls, originalSelector);
77
- Method swizzledMethod = class_getInstanceMethod(cls, swizzledSelector);
78
- method_exchangeImplementations(originalMethod, swizzledMethod);
79
- }
80
-
81
- {
82
- // swizzle updateLocalData
83
- SEL originalSelector = @selector(updateLocalData);
84
- SEL swizzledSelector = @selector(markdown_updateLocalData);
85
- Method originalMethod = class_getInstanceMethod(cls, originalSelector);
86
- Method swizzledMethod = class_getInstanceMethod(cls, swizzledSelector);
87
- method_exchangeImplementations(originalMethod, swizzledMethod);
88
- }
89
-
90
- {
91
- // swizzle textOf
92
- SEL originalSelector = @selector(textOf:equals:);
93
- SEL swizzledSelector = @selector(markdown_textOf:equals:);
94
- Method originalMethod = class_getInstanceMethod(cls, originalSelector);
95
- Method swizzledMethod = class_getInstanceMethod(cls, swizzledSelector);
96
- method_exchangeImplementations(originalMethod, swizzledMethod);
97
- }
98
- });
99
- }
100
-
101
- @end