react-native-typerich 1.0.0 → 2.2.0

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 (41) hide show
  1. package/README.md +251 -10
  2. package/ReactNativeTypeRich.podspec +41 -0
  3. package/android/src/main/java/com/typerich/TypeRichTextInputView.kt +37 -10
  4. package/android/src/main/java/com/typerich/TypeRichTextInputViewManager.kt +5 -0
  5. package/ios/TypeRichTextInputView.h +27 -7
  6. package/ios/TypeRichTextInputView.mm +809 -26
  7. package/ios/cpp/TypeRichTextInputViewComponentDescriptor.h +19 -0
  8. package/ios/cpp/TypeRichTextInputViewShadowNode.h +44 -0
  9. package/ios/cpp/TypeRichTextInputViewShadowNode.mm +110 -0
  10. package/ios/cpp/TypeRichTextInputViewState.cpp +10 -0
  11. package/ios/cpp/TypeRichTextInputViewState.h +22 -0
  12. package/ios/inputTextView/TypeRichUITextView.h +14 -0
  13. package/ios/inputTextView/TypeRichUITextView.mm +100 -0
  14. package/ios/modules/commands/TypeRichTextInputCommands.h +24 -0
  15. package/ios/modules/commands/TypeRichTextInputCommands.mm +392 -0
  16. package/ios/utils/StringUtils.h +19 -0
  17. package/ios/utils/StringUtils.mm +15 -0
  18. package/ios/utils/TextInputUtils.h +26 -0
  19. package/ios/utils/TextInputUtils.mm +58 -0
  20. package/lib/module/TypeRichTextInput.js +13 -36
  21. package/lib/module/TypeRichTextInput.js.map +1 -1
  22. package/lib/module/TypeRichTextInputNativeComponent.ts +266 -52
  23. package/lib/module/index.js +1 -0
  24. package/lib/module/index.js.map +1 -1
  25. package/lib/module/types/TypeRichTextInput.js +4 -0
  26. package/lib/module/types/TypeRichTextInput.js.map +1 -0
  27. package/lib/typescript/src/TypeRichTextInput.d.ts +2 -22
  28. package/lib/typescript/src/TypeRichTextInput.d.ts.map +1 -1
  29. package/lib/typescript/src/TypeRichTextInputNativeComponent.d.ts +200 -14
  30. package/lib/typescript/src/TypeRichTextInputNativeComponent.d.ts.map +1 -1
  31. package/lib/typescript/src/index.d.ts +1 -1
  32. package/lib/typescript/src/index.d.ts.map +1 -1
  33. package/lib/typescript/src/types/TypeRichTextInput.d.ts +95 -0
  34. package/lib/typescript/src/types/TypeRichTextInput.d.ts.map +1 -0
  35. package/package.json +1 -1
  36. package/src/TypeRichTextInput.tsx +20 -70
  37. package/src/TypeRichTextInputNativeComponent.ts +266 -52
  38. package/src/index.tsx +1 -5
  39. package/src/types/TypeRichTextInput.tsx +116 -0
  40. package/TypeRichTextInput.podspec +0 -20
  41. package/ios/TypeRichTextInputViewManager.mm +0 -27
@@ -0,0 +1,116 @@
1
+ import type { TypeRichTextInputNativeProps } from '../TypeRichTextInputNativeComponent';
2
+ import type { onPasteImageEventData } from '../TypeRichTextInputNativeComponent';
3
+
4
+ // normalised events
5
+ /**
6
+ * JavaScript-level props for `TypeRichTextInput`.
7
+ *
8
+ * These props normalize native events into ergonomic,
9
+ * idiomatic JavaScript callbacks.
10
+ */
11
+ export interface TypeRichTextInputProps
12
+ extends Omit<
13
+ TypeRichTextInputNativeProps,
14
+ | 'onChangeText'
15
+ | 'onChangeSelection'
16
+ | 'onInputFocus'
17
+ | 'onInputBlur'
18
+ | 'onPasteImage'
19
+ > {
20
+ /**
21
+ * Called when the input receives focus.
22
+ */
23
+ onFocus?: () => void;
24
+
25
+ /**
26
+ * Called when the input loses focus.
27
+ */
28
+ onBlur?: () => void;
29
+
30
+ /**
31
+ * Called whenever the text content changes.
32
+ *
33
+ * This callback is **informational only** and should not
34
+ * be used to drive controlled input behavior.
35
+ *
36
+ * Use imperative commands (`setText`, `insertTextAt`)
37
+ * to update the text.
38
+ */
39
+ onChangeText?: (value: string) => void;
40
+
41
+ /**
42
+ * Called when the text selection or cursor position changes.
43
+ */
44
+ onChangeSelection?: (event: {
45
+ /**
46
+ * Start index of the selection (inclusive).
47
+ */
48
+ start: number;
49
+
50
+ /**
51
+ * End index of the selection (exclusive).
52
+ */
53
+ end: number;
54
+
55
+ /**
56
+ * Full text content at the time of the selection change.
57
+ */
58
+ text: string;
59
+ }) => void;
60
+
61
+ /**
62
+ * Called when an image is pasted into the input.
63
+ *
64
+ * The payload conforms to {@link onPasteImageEventData}.
65
+ */
66
+ onPasteImageData?: (data: onPasteImageEventData) => void;
67
+ }
68
+
69
+ /**
70
+ * Imperative handle exposed via `ref`.
71
+ *
72
+ * This component is **imperative-first**.
73
+ * Text mutations must be performed using these methods.
74
+ */
75
+ export interface TypeRichTextInputRef {
76
+ /**
77
+ * Focuses the input programmatically.
78
+ */
79
+ focus: () => void;
80
+
81
+ /**
82
+ * Removes focus from the input.
83
+ */
84
+ blur: () => void;
85
+
86
+ /**
87
+ * Replaces the entire text content of the input.
88
+ *
89
+ * This is the primary and recommended way to update text.
90
+ * does not updates selection
91
+ */
92
+ setText: (text: string) => void;
93
+
94
+ /**
95
+ * Inserts text at the specified range.
96
+ *
97
+ * Replaces the text between `start` and `end` with `text`.
98
+ *
99
+ * it updates selection automatically
100
+ */
101
+ insertTextAt: (start: number, end: number, text: string) => void;
102
+
103
+ /**
104
+ * Updates the current text selection.
105
+ *
106
+ * must be called after setText()
107
+ */
108
+ setSelection: (start: number, end: number) => void;
109
+
110
+ /**
111
+ * Returns the underlying native view reference, if available.
112
+ *
113
+ * Intended for advanced or debugging use cases only.
114
+ */
115
+ getNativeRef: () => any | null;
116
+ }
@@ -1,20 +0,0 @@
1
- require "json"
2
-
3
- package = JSON.parse(File.read(File.join(__dir__, "package.json")))
4
-
5
- Pod::Spec.new do |s|
6
- s.name = "TypeRichTextInput"
7
- s.version = package["version"]
8
- s.summary = package["description"]
9
- s.homepage = package["homepage"]
10
- s.license = package["license"]
11
- s.authors = package["author"]
12
-
13
- s.platforms = { :ios => min_ios_version_supported }
14
- s.source = { :git => "https://github.com/divyanshu-patil/react-native-typerich.git", :tag => "#{s.version}" }
15
-
16
- # s.source_files = "ios/**/*.{h,m,mm,swift,cpp}"
17
- s.source_files = "ios/**/*.{h,m,mm,cpp}"
18
-
19
- install_modules_dependencies(s)
20
- end
@@ -1,27 +0,0 @@
1
- #import <React/RCTViewManager.h>
2
- #import <React/RCTUIManager.h>
3
- #import "RCTFabricComponentsPlugins.h"
4
-
5
- @interface TypeRichTextInputViewManager : RCTViewManager
6
- @end
7
-
8
- @implementation TypeRichTextInputViewManager
9
-
10
- RCT_EXPORT_MODULE(TypeRichTextInputView)
11
-
12
- + (BOOL)requiresMainQueueSetup
13
- {
14
- return NO;
15
- }
16
-
17
- - (UIView *)view
18
- {
19
- // For Paper (old architecture) - return a simple UIView
20
- UIView *view = [[UIView alloc] init];
21
- view.backgroundColor = [UIColor lightGrayColor];
22
- return view;
23
- }
24
-
25
- @end
26
-
27
- Class<RCTComponentViewProtocol> TypeRichTextInputViewCls(void);