react-native-jet-markdown 0.2.0-beta.7 → 0.2.1

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.
package/README.md CHANGED
@@ -162,6 +162,9 @@ You may notice styles ship natively as one `stylesJson` string instead of a stru
162
162
 
163
163
  ## Editor
164
164
 
165
+ > [!WARNING]
166
+ > The editor is not ready for production use yet. The viewer (`JetMarkdownView`) is stable; `JetMarkdownEditor` still has known issues and its API may change. Track progress in the issue tracker before shipping it.
167
+
165
168
  `JetMarkdownEditor` is a WYSIWYG editor with markdown as the interchange format: no visible syntax while editing, `onChangeMarkdown` fires with serialized markdown on every edit, and `setValue`/`defaultValue`/paste parse markdown into styled content.
166
169
 
167
170
  ```tsx
@@ -34,6 +34,7 @@ using namespace facebook::react;
34
34
 
35
35
  static void JMDSetNeedsDisplayDeep(UIView *view);
36
36
  static CGRect JMDScreenFrameOfView(UIView *view);
37
+ static BOOL JMDIsScrollInProgress(UIView *view);
37
38
 
38
39
  @implementation JetMarkdownView {
39
40
  NSString *_markdown;
@@ -166,10 +167,17 @@ static CGRect JMDScreenFrameOfView(UIView *view);
166
167
  }
167
168
 
168
169
  // Touches that do not start on an interactive range are never tracked, so
169
- // they cannot interfere with an ancestor scroll view's pan.
170
+ // they cannot interfere with an ancestor scroll view's pan. A touch that
171
+ // lands mid-scroll is a scroll-stopper, not a press (Pressable semantics) —
172
+ // checked from the deepest content view so nested code/table scrollers and
173
+ // the outer list both count.
170
174
  - (BOOL)gestureRecognizer:(UIGestureRecognizer *)recognizer
171
175
  shouldReceiveTouch:(UITouch *)touch {
172
- return [self jmdIsInteractiveAtPoint:[touch locationInView:self]];
176
+ const CGPoint point = [touch locationInView:self];
177
+ if (![self jmdIsInteractiveAtPoint:point]) {
178
+ return NO;
179
+ }
180
+ return !JMDIsScrollInProgress([self jmdContentViewAtPoint:point inView:self]);
173
181
  }
174
182
 
175
183
  // Non-interactive points fall through to ancestors so a wrapping pressable
@@ -182,9 +190,32 @@ static CGRect JMDScreenFrameOfView(UIView *view);
182
190
  if (result == self && ![self jmdIsInteractiveAtPoint:point]) {
183
191
  return nil;
184
192
  }
193
+ // Mid-scroll, an interactive point is not claimed either: hit-testing runs
194
+ // before the touch is delivered, so isDecelerating is still reliable here
195
+ // (by shouldReceiveTouch: time the same touch may have already stopped the
196
+ // scroll). Falling through lets the ancestor scroll view take the touch
197
+ // and stop, exactly like tapping a Pressable during momentum.
198
+ if (result == self && JMDIsScrollInProgress(self)) {
199
+ return nil;
200
+ }
185
201
  return result;
186
202
  }
187
203
 
204
+ // YES when any scroll view on the path from `view` up through the window is
205
+ // being dragged or is decelerating — a press landing then must only stop
206
+ // the scroll, never fire.
207
+ static BOOL JMDIsScrollInProgress(UIView *view) {
208
+ for (UIView *ancestor = view; ancestor != nil; ancestor = ancestor.superview) {
209
+ if ([ancestor isKindOfClass:UIScrollView.class]) {
210
+ UIScrollView *scroll = (UIScrollView *)ancestor;
211
+ if (scroll.isDecelerating || scroll.isDragging) {
212
+ return YES;
213
+ }
214
+ }
215
+ }
216
+ return NO;
217
+ }
218
+
188
219
  // Scrolling always wins: a drag that begins on a link still pans the list
189
220
  // (the tap/long-press simply fail on movement).
190
221
  - (BOOL)gestureRecognizer:(UIGestureRecognizer *)recognizer
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-jet-markdown",
3
- "version": "0.2.0-beta.7",
3
+ "version": "0.2.1",
4
4
  "description": "High-performance native Markdown renderer and editor for React Native",
5
5
  "keywords": [
6
6
  "react-native",