@dongsuo/react-native-uitextview 1.0.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 (102) hide show
  1. package/LICENSE +20 -0
  2. package/README.md +225 -0
  3. package/android/generated/jni/CMakeLists.txt +36 -0
  4. package/android/generated/jni/RNUITextViewSpec-generated.cpp +22 -0
  5. package/android/generated/jni/RNUITextViewSpec.h +24 -0
  6. package/android/generated/jni/react/renderer/components/RNUITextViewSpec/ComponentDescriptors.cpp +23 -0
  7. package/android/generated/jni/react/renderer/components/RNUITextViewSpec/ComponentDescriptors.h +25 -0
  8. package/android/generated/jni/react/renderer/components/RNUITextViewSpec/EventEmitters.cpp +61 -0
  9. package/android/generated/jni/react/renderer/components/RNUITextViewSpec/EventEmitters.h +49 -0
  10. package/android/generated/jni/react/renderer/components/RNUITextViewSpec/Props.cpp +47 -0
  11. package/android/generated/jni/react/renderer/components/RNUITextViewSpec/Props.h +182 -0
  12. package/android/generated/jni/react/renderer/components/RNUITextViewSpec/RNUITextViewSpecJSI-generated.cpp +17 -0
  13. package/android/generated/jni/react/renderer/components/RNUITextViewSpec/RNUITextViewSpecJSI.h +19 -0
  14. package/android/generated/jni/react/renderer/components/RNUITextViewSpec/ShadowNodes.cpp +18 -0
  15. package/android/generated/jni/react/renderer/components/RNUITextViewSpec/ShadowNodes.h +43 -0
  16. package/android/generated/jni/react/renderer/components/RNUITextViewSpec/States.cpp +16 -0
  17. package/android/generated/jni/react/renderer/components/RNUITextViewSpec/States.h +41 -0
  18. package/ios/RNUITextView.h +23 -0
  19. package/ios/RNUITextView.mm +474 -0
  20. package/ios/RNUITextViewChild.h +24 -0
  21. package/ios/RNUITextViewChild.mm +76 -0
  22. package/ios/RNUITextViewChildComponentDescriptor.h +13 -0
  23. package/ios/RNUITextViewChildShadowNode.cpp +6 -0
  24. package/ios/RNUITextViewChildShadowNode.h +16 -0
  25. package/ios/RNUITextViewComponentDescriptor.h +13 -0
  26. package/ios/RNUITextViewEventEmitter.h +26 -0
  27. package/ios/RNUITextViewManager.mm +36 -0
  28. package/ios/RNUITextViewShadowNode.cpp +127 -0
  29. package/ios/RNUITextViewShadowNode.h +48 -0
  30. package/ios/RNUITextViewSpecJSI-generated.cpp +17 -0
  31. package/ios/RNUITextViewSpecJSI.h +19 -0
  32. package/ios/generated/RNUITextViewSpec/ComponentDescriptors.cpp +23 -0
  33. package/ios/generated/RNUITextViewSpec/ComponentDescriptors.h +25 -0
  34. package/ios/generated/RNUITextViewSpec/EventEmitters.cpp +61 -0
  35. package/ios/generated/RNUITextViewSpec/EventEmitters.h +49 -0
  36. package/ios/generated/RNUITextViewSpec/Props.cpp +47 -0
  37. package/ios/generated/RNUITextViewSpec/Props.h +182 -0
  38. package/ios/generated/RNUITextViewSpec/RCTComponentViewHelpers.h +24 -0
  39. package/ios/generated/RNUITextViewSpec/RNUITextViewSpec-generated.mm +16 -0
  40. package/ios/generated/RNUITextViewSpec/RNUITextViewSpec.h +38 -0
  41. package/ios/generated/RNUITextViewSpec/ShadowNodes.cpp +18 -0
  42. package/ios/generated/RNUITextViewSpec/ShadowNodes.h +43 -0
  43. package/ios/generated/RNUITextViewSpec/States.cpp +16 -0
  44. package/ios/generated/RNUITextViewSpec/States.h +41 -0
  45. package/ios/generated/RNUITextViewSpecJSI-generated.cpp +17 -0
  46. package/ios/generated/RNUITextViewSpecJSI.h +19 -0
  47. package/lib/commonjs/RNUITextViewChildNativeComponent.ts +48 -0
  48. package/lib/commonjs/RNUITextViewNativeComponent.ts +47 -0
  49. package/lib/commonjs/Text.js +140 -0
  50. package/lib/commonjs/Text.js.map +1 -0
  51. package/lib/commonjs/index.js +17 -0
  52. package/lib/commonjs/index.js.map +1 -0
  53. package/lib/commonjs/package.json +1 -0
  54. package/lib/commonjs/util.js +64 -0
  55. package/lib/commonjs/util.js.map +1 -0
  56. package/lib/module/RNUITextViewChildNativeComponent.ts +48 -0
  57. package/lib/module/RNUITextViewNativeComponent.ts +47 -0
  58. package/lib/module/Text.js +136 -0
  59. package/lib/module/Text.js.map +1 -0
  60. package/lib/module/index.js +4 -0
  61. package/lib/module/index.js.map +1 -0
  62. package/lib/module/package.json +1 -0
  63. package/lib/module/util.js +60 -0
  64. package/lib/module/util.js.map +1 -0
  65. package/lib/typescript/commonjs/example/src/App.d.ts +2 -0
  66. package/lib/typescript/commonjs/example/src/App.d.ts.map +1 -0
  67. package/lib/typescript/commonjs/example/src/CustomMenuExample.d.ts +3 -0
  68. package/lib/typescript/commonjs/example/src/CustomMenuExample.d.ts.map +1 -0
  69. package/lib/typescript/commonjs/package.json +1 -0
  70. package/lib/typescript/commonjs/src/RNUITextViewChildNativeComponent.d.ts +28 -0
  71. package/lib/typescript/commonjs/src/RNUITextViewChildNativeComponent.d.ts.map +1 -0
  72. package/lib/typescript/commonjs/src/RNUITextViewNativeComponent.d.ts +29 -0
  73. package/lib/typescript/commonjs/src/RNUITextViewNativeComponent.d.ts.map +1 -0
  74. package/lib/typescript/commonjs/src/Text.d.ts +17 -0
  75. package/lib/typescript/commonjs/src/Text.d.ts.map +1 -0
  76. package/lib/typescript/commonjs/src/index.d.ts +2 -0
  77. package/lib/typescript/commonjs/src/index.d.ts.map +1 -0
  78. package/lib/typescript/commonjs/src/util.d.ts +160 -0
  79. package/lib/typescript/commonjs/src/util.d.ts.map +1 -0
  80. package/lib/typescript/module/example/src/App.d.ts +2 -0
  81. package/lib/typescript/module/example/src/App.d.ts.map +1 -0
  82. package/lib/typescript/module/example/src/CustomMenuExample.d.ts +3 -0
  83. package/lib/typescript/module/example/src/CustomMenuExample.d.ts.map +1 -0
  84. package/lib/typescript/module/package.json +1 -0
  85. package/lib/typescript/module/src/RNUITextViewChildNativeComponent.d.ts +28 -0
  86. package/lib/typescript/module/src/RNUITextViewChildNativeComponent.d.ts.map +1 -0
  87. package/lib/typescript/module/src/RNUITextViewNativeComponent.d.ts +29 -0
  88. package/lib/typescript/module/src/RNUITextViewNativeComponent.d.ts.map +1 -0
  89. package/lib/typescript/module/src/Text.d.ts +17 -0
  90. package/lib/typescript/module/src/Text.d.ts.map +1 -0
  91. package/lib/typescript/module/src/index.d.ts +2 -0
  92. package/lib/typescript/module/src/index.d.ts.map +1 -0
  93. package/lib/typescript/module/src/util.d.ts +160 -0
  94. package/lib/typescript/module/src/util.d.ts.map +1 -0
  95. package/package.json +187 -0
  96. package/react-native-uitextview.podspec +21 -0
  97. package/react-native.config.js +28 -0
  98. package/src/RNUITextViewChildNativeComponent.ts +48 -0
  99. package/src/RNUITextViewNativeComponent.ts +47 -0
  100. package/src/Text.tsx +148 -0
  101. package/src/index.tsx +1 -0
  102. package/src/util.ts +65 -0
@@ -0,0 +1,182 @@
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: GeneratePropsH.js
9
+ */
10
+ #pragma once
11
+
12
+ #include <react/renderer/components/view/ViewProps.h>
13
+ #include <react/renderer/core/PropsParserContext.h>
14
+ #include <react/renderer/core/propsConversions.h>
15
+ #include <react/renderer/graphics/Color.h>
16
+ #include <vector>
17
+
18
+ namespace facebook::react {
19
+
20
+ enum class RNUITextViewChildFontStyle { Normal, Italic };
21
+
22
+ static inline void fromRawValue(const PropsParserContext& context, const RawValue &value, RNUITextViewChildFontStyle &result) {
23
+ auto string = (std::string)value;
24
+ if (string == "normal") { result = RNUITextViewChildFontStyle::Normal; return; }
25
+ if (string == "italic") { result = RNUITextViewChildFontStyle::Italic; return; }
26
+ abort();
27
+ }
28
+
29
+ static inline std::string toString(const RNUITextViewChildFontStyle &value) {
30
+ switch (value) {
31
+ case RNUITextViewChildFontStyle::Normal: return "normal";
32
+ case RNUITextViewChildFontStyle::Italic: return "italic";
33
+ }
34
+ }
35
+ enum class RNUITextViewChildFontWeight { Normal, Bold, UltraLight, Light, Medium, Semibold, Heavy };
36
+
37
+ static inline void fromRawValue(const PropsParserContext& context, const RawValue &value, RNUITextViewChildFontWeight &result) {
38
+ auto string = (std::string)value;
39
+ if (string == "normal") { result = RNUITextViewChildFontWeight::Normal; return; }
40
+ if (string == "bold") { result = RNUITextViewChildFontWeight::Bold; return; }
41
+ if (string == "ultraLight") { result = RNUITextViewChildFontWeight::UltraLight; return; }
42
+ if (string == "light") { result = RNUITextViewChildFontWeight::Light; return; }
43
+ if (string == "medium") { result = RNUITextViewChildFontWeight::Medium; return; }
44
+ if (string == "semibold") { result = RNUITextViewChildFontWeight::Semibold; return; }
45
+ if (string == "heavy") { result = RNUITextViewChildFontWeight::Heavy; return; }
46
+ abort();
47
+ }
48
+
49
+ static inline std::string toString(const RNUITextViewChildFontWeight &value) {
50
+ switch (value) {
51
+ case RNUITextViewChildFontWeight::Normal: return "normal";
52
+ case RNUITextViewChildFontWeight::Bold: return "bold";
53
+ case RNUITextViewChildFontWeight::UltraLight: return "ultraLight";
54
+ case RNUITextViewChildFontWeight::Light: return "light";
55
+ case RNUITextViewChildFontWeight::Medium: return "medium";
56
+ case RNUITextViewChildFontWeight::Semibold: return "semibold";
57
+ case RNUITextViewChildFontWeight::Heavy: return "heavy";
58
+ }
59
+ }
60
+ enum class RNUITextViewChildTextDecorationLine { None, Underline, LineThrough };
61
+
62
+ static inline void fromRawValue(const PropsParserContext& context, const RawValue &value, RNUITextViewChildTextDecorationLine &result) {
63
+ auto string = (std::string)value;
64
+ if (string == "none") { result = RNUITextViewChildTextDecorationLine::None; return; }
65
+ if (string == "underline") { result = RNUITextViewChildTextDecorationLine::Underline; return; }
66
+ if (string == "line-through") { result = RNUITextViewChildTextDecorationLine::LineThrough; return; }
67
+ abort();
68
+ }
69
+
70
+ static inline std::string toString(const RNUITextViewChildTextDecorationLine &value) {
71
+ switch (value) {
72
+ case RNUITextViewChildTextDecorationLine::None: return "none";
73
+ case RNUITextViewChildTextDecorationLine::Underline: return "underline";
74
+ case RNUITextViewChildTextDecorationLine::LineThrough: return "line-through";
75
+ }
76
+ }
77
+ enum class RNUITextViewChildTextDecorationStyle { Solid, Double, Dotted, Dashed };
78
+
79
+ static inline void fromRawValue(const PropsParserContext& context, const RawValue &value, RNUITextViewChildTextDecorationStyle &result) {
80
+ auto string = (std::string)value;
81
+ if (string == "solid") { result = RNUITextViewChildTextDecorationStyle::Solid; return; }
82
+ if (string == "double") { result = RNUITextViewChildTextDecorationStyle::Double; return; }
83
+ if (string == "dotted") { result = RNUITextViewChildTextDecorationStyle::Dotted; return; }
84
+ if (string == "dashed") { result = RNUITextViewChildTextDecorationStyle::Dashed; return; }
85
+ abort();
86
+ }
87
+
88
+ static inline std::string toString(const RNUITextViewChildTextDecorationStyle &value) {
89
+ switch (value) {
90
+ case RNUITextViewChildTextDecorationStyle::Solid: return "solid";
91
+ case RNUITextViewChildTextDecorationStyle::Double: return "double";
92
+ case RNUITextViewChildTextDecorationStyle::Dotted: return "dotted";
93
+ case RNUITextViewChildTextDecorationStyle::Dashed: return "dashed";
94
+ }
95
+ }
96
+
97
+ class RNUITextViewChildProps final : public ViewProps {
98
+ public:
99
+ RNUITextViewChildProps() = default;
100
+ RNUITextViewChildProps(const PropsParserContext& context, const RNUITextViewChildProps &sourceProps, const RawProps &rawProps);
101
+
102
+ #pragma mark - Props
103
+
104
+ std::string text{};
105
+ SharedColor color{};
106
+ Float fontSize{0.0};
107
+ RNUITextViewChildFontStyle fontStyle{RNUITextViewChildFontStyle::Normal};
108
+ RNUITextViewChildFontWeight fontWeight{RNUITextViewChildFontWeight::Normal};
109
+ std::string fontFamily{};
110
+ Float letterSpacing{0.0};
111
+ Float lineHeight{0.0};
112
+ RNUITextViewChildTextDecorationLine textDecorationLine{RNUITextViewChildTextDecorationLine::None};
113
+ RNUITextViewChildTextDecorationStyle textDecorationStyle{RNUITextViewChildTextDecorationStyle::Solid};
114
+ SharedColor textDecorationColor{};
115
+ Float shadowRadius{0.0};
116
+ };
117
+
118
+ enum class RNUITextViewEllipsizeMode { Head, Middle, Tail, Clip };
119
+
120
+ static inline void fromRawValue(const PropsParserContext& context, const RawValue &value, RNUITextViewEllipsizeMode &result) {
121
+ auto string = (std::string)value;
122
+ if (string == "head") { result = RNUITextViewEllipsizeMode::Head; return; }
123
+ if (string == "middle") { result = RNUITextViewEllipsizeMode::Middle; return; }
124
+ if (string == "tail") { result = RNUITextViewEllipsizeMode::Tail; return; }
125
+ if (string == "clip") { result = RNUITextViewEllipsizeMode::Clip; return; }
126
+ abort();
127
+ }
128
+
129
+ static inline std::string toString(const RNUITextViewEllipsizeMode &value) {
130
+ switch (value) {
131
+ case RNUITextViewEllipsizeMode::Head: return "head";
132
+ case RNUITextViewEllipsizeMode::Middle: return "middle";
133
+ case RNUITextViewEllipsizeMode::Tail: return "tail";
134
+ case RNUITextViewEllipsizeMode::Clip: return "clip";
135
+ }
136
+ }
137
+ struct RNUITextViewCustomMenuItemsStruct {
138
+ std::string title{};
139
+ std::string actionId{};
140
+ };
141
+
142
+ static inline void fromRawValue(const PropsParserContext& context, const RawValue &value, RNUITextViewCustomMenuItemsStruct &result) {
143
+ auto map = (std::unordered_map<std::string, RawValue>)value;
144
+
145
+ auto tmp_title = map.find("title");
146
+ if (tmp_title != map.end()) {
147
+ fromRawValue(context, tmp_title->second, result.title);
148
+ }
149
+ auto tmp_actionId = map.find("actionId");
150
+ if (tmp_actionId != map.end()) {
151
+ fromRawValue(context, tmp_actionId->second, result.actionId);
152
+ }
153
+ }
154
+
155
+ static inline std::string toString(const RNUITextViewCustomMenuItemsStruct &value) {
156
+ return "[Object RNUITextViewCustomMenuItemsStruct]";
157
+ }
158
+
159
+ static inline void fromRawValue(const PropsParserContext& context, const RawValue &value, std::vector<RNUITextViewCustomMenuItemsStruct> &result) {
160
+ auto items = (std::vector<RawValue>)value;
161
+ for (const auto &item : items) {
162
+ RNUITextViewCustomMenuItemsStruct newItem;
163
+ fromRawValue(context, item, newItem);
164
+ result.emplace_back(newItem);
165
+ }
166
+ }
167
+
168
+ class RNUITextViewProps final : public ViewProps {
169
+ public:
170
+ RNUITextViewProps() = default;
171
+ RNUITextViewProps(const PropsParserContext& context, const RNUITextViewProps &sourceProps, const RawProps &rawProps);
172
+
173
+ #pragma mark - Props
174
+
175
+ int numberOfLines{0};
176
+ bool allowsFontScaling{false};
177
+ RNUITextViewEllipsizeMode ellipsizeMode{RNUITextViewEllipsizeMode::Tail};
178
+ bool selectable{false};
179
+ std::vector<RNUITextViewCustomMenuItemsStruct> customMenuItems{};
180
+ };
181
+
182
+ } // namespace facebook::react
@@ -0,0 +1,17 @@
1
+ /**
2
+ * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
3
+ *
4
+ * Do not edit this file as changes may cause incorrect behavior and will be lost
5
+ * once the code is regenerated.
6
+ *
7
+ * @generated by codegen project: GenerateModuleCpp.js
8
+ */
9
+
10
+ #include "RNUITextViewSpecJSI.h"
11
+
12
+ namespace facebook::react {
13
+
14
+
15
+
16
+
17
+ } // namespace facebook::react
@@ -0,0 +1,19 @@
1
+ /**
2
+ * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
3
+ *
4
+ * Do not edit this file as changes may cause incorrect behavior and will be lost
5
+ * once the code is regenerated.
6
+ *
7
+ * @generated by codegen project: GenerateModuleH.js
8
+ */
9
+
10
+ #pragma once
11
+
12
+ #include <ReactCommon/TurboModule.h>
13
+ #include <react/bridging/Bridging.h>
14
+
15
+ namespace facebook::react {
16
+
17
+
18
+
19
+ } // namespace facebook::react
@@ -0,0 +1,18 @@
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: GenerateShadowNodeCpp.js
9
+ */
10
+
11
+ #include "ShadowNodes.h"
12
+
13
+ namespace facebook::react {
14
+
15
+ extern const char RNUITextViewChildComponentName[] = "RNUITextViewChild";
16
+ extern const char RNUITextViewComponentName[] = "RNUITextView";
17
+
18
+ } // namespace facebook::react
@@ -0,0 +1,43 @@
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: GenerateShadowNodeH.js
9
+ */
10
+
11
+ #pragma once
12
+
13
+ #include "EventEmitters.h"
14
+ #include "Props.h"
15
+ #include "States.h"
16
+ #include <react/renderer/components/view/ConcreteViewShadowNode.h>
17
+ #include <jsi/jsi.h>
18
+
19
+ namespace facebook::react {
20
+
21
+ JSI_EXPORT extern const char RNUITextViewChildComponentName[];
22
+
23
+ /*
24
+ * `ShadowNode` for <RNUITextViewChild> component.
25
+ */
26
+ using RNUITextViewChildShadowNode = ConcreteViewShadowNode<
27
+ RNUITextViewChildComponentName,
28
+ RNUITextViewChildProps,
29
+ RNUITextViewChildEventEmitter,
30
+ RNUITextViewChildState>;
31
+
32
+ JSI_EXPORT extern const char RNUITextViewComponentName[];
33
+
34
+ /*
35
+ * `ShadowNode` for <RNUITextView> component.
36
+ */
37
+ using RNUITextViewShadowNode = ConcreteViewShadowNode<
38
+ RNUITextViewComponentName,
39
+ RNUITextViewProps,
40
+ RNUITextViewEventEmitter,
41
+ RNUITextViewState>;
42
+
43
+ } // namespace facebook::react
@@ -0,0 +1,16 @@
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: GenerateStateCpp.js
9
+ */
10
+ #include "States.h"
11
+
12
+ namespace facebook::react {
13
+
14
+
15
+
16
+ } // namespace facebook::react
@@ -0,0 +1,41 @@
1
+ /**
2
+ * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
3
+ *
4
+ * Do not edit this file as changes may cause incorrect behavior and will be lost
5
+ * once the code is regenerated.
6
+ *
7
+ * @generated by codegen project: GenerateStateH.js
8
+ */
9
+ #pragma once
10
+
11
+ #ifdef ANDROID
12
+ #include <folly/dynamic.h>
13
+ #endif
14
+
15
+ namespace facebook::react {
16
+
17
+ class RNUITextViewChildState {
18
+ public:
19
+ RNUITextViewChildState() = default;
20
+
21
+ #ifdef ANDROID
22
+ RNUITextViewChildState(RNUITextViewChildState const &previousState, folly::dynamic data){};
23
+ folly::dynamic getDynamic() const {
24
+ return {};
25
+ };
26
+ #endif
27
+ };
28
+
29
+ class RNUITextViewState {
30
+ public:
31
+ RNUITextViewState() = default;
32
+
33
+ #ifdef ANDROID
34
+ RNUITextViewState(RNUITextViewState const &previousState, folly::dynamic data){};
35
+ folly::dynamic getDynamic() const {
36
+ return {};
37
+ };
38
+ #endif
39
+ };
40
+
41
+ } // namespace facebook::react
@@ -0,0 +1,23 @@
1
+ #import <React/RCTViewComponentView.h>
2
+ #import <UIKit/UIKit.h>
3
+
4
+ #ifndef RNUITextViewNativeComponent_h
5
+ #define RNUITextViewNativeComponent_h
6
+
7
+ // 自定义菜单项结构
8
+ typedef struct {
9
+ NSString *title;
10
+ NSString *actionId;
11
+ } RNUITextViewMenuItem;
12
+
13
+ NS_ASSUME_NONNULL_BEGIN
14
+ @interface RNUITextView : RCTViewComponentView <UITextViewDelegate>
15
+
16
+ // 自定义菜单项属性
17
+ @property (nonatomic, strong, nullable) NSArray<NSDictionary *> *customMenuItems;
18
+
19
+ @end
20
+
21
+ NS_ASSUME_NONNULL_END
22
+
23
+ #endif /* UitextviewViewNativeComponent_h */