@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,127 @@
1
+ #include "RNUITextViewShadowNode.h"
2
+ #include "RNUITextViewChildShadowNode.h"
3
+ #include <react/renderer/components/view/ViewShadowNode.h>
4
+
5
+ #include <cmath>
6
+
7
+ namespace facebook::react {
8
+
9
+ extern const char RNUITextViewComponentName[] = "RNUITextView";
10
+
11
+ RNUITextViewShadowNode::RNUITextViewShadowNode(
12
+ const ShadowNode& sourceShadowNode,
13
+ const ShadowNodeFragment& fragment
14
+ ) : ConcreteViewShadowNode(sourceShadowNode, fragment) {
15
+ };
16
+
17
+ AttributedString _attributedString = AttributedString{};
18
+
19
+ Size RNUITextViewShadowNode::measureContent(
20
+ const LayoutContext& layoutContext,
21
+ const LayoutConstraints& layoutConstraints) const {
22
+ const auto &baseProps = getConcreteProps();
23
+ auto paragraphAttributes = ParagraphAttributes{};
24
+ paragraphAttributes.maximumNumberOfLines = baseProps.numberOfLines;
25
+ if (baseProps.ellipsizeMode == RNUITextViewEllipsizeMode::Head) {
26
+ paragraphAttributes.ellipsizeMode = EllipsizeMode::Head;
27
+ } else if (baseProps.ellipsizeMode == RNUITextViewEllipsizeMode::Middle) {
28
+ paragraphAttributes.ellipsizeMode = EllipsizeMode::Middle;
29
+ } else if (baseProps.ellipsizeMode == RNUITextViewEllipsizeMode::Tail) {
30
+ paragraphAttributes.ellipsizeMode = EllipsizeMode::Tail;
31
+ } else if (baseProps.ellipsizeMode == RNUITextViewEllipsizeMode::Clip) {
32
+ paragraphAttributes.ellipsizeMode = EllipsizeMode::Clip;
33
+ }
34
+
35
+ auto baseTextAttributes = TextAttributes::defaultTextAttributes();
36
+ baseTextAttributes.backgroundColor = baseProps.backgroundColor;
37
+
38
+ auto baseAttributedString = AttributedString{};
39
+ const auto &children = getChildren();
40
+ for (size_t i = 0; i < children.size(); i++) {
41
+ const auto child = children[i].get();
42
+ if (auto textViewChild = dynamic_cast<const RNUITextViewChildShadowNode *>(child)) {
43
+ auto &props = textViewChild->getConcreteProps();
44
+ auto fragment = AttributedString::Fragment{};
45
+ auto textAttributes = TextAttributes::defaultTextAttributes();
46
+
47
+ textAttributes.backgroundColor = props.backgroundColor;
48
+ textAttributes.fontSize = props.fontSize;
49
+ textAttributes.lineHeight = props.lineHeight;
50
+ textAttributes.foregroundColor = props.color;
51
+ textAttributes.textShadowColor = props.shadowColor;
52
+ textAttributes.textShadowOffset = props.shadowOffset;
53
+ textAttributes.textShadowRadius = props.shadowRadius;
54
+ textAttributes.letterSpacing = props.letterSpacing;
55
+ textAttributes.textDecorationColor = props.textDecorationColor;
56
+ textAttributes.fontFamily = props.fontFamily;
57
+
58
+ if (props.fontStyle == RNUITextViewChildFontStyle::Italic) {
59
+ textAttributes.fontStyle = FontStyle::Italic;
60
+ } else {
61
+ textAttributes.fontStyle = FontStyle::Normal;
62
+ }
63
+
64
+ if (props.fontWeight == RNUITextViewChildFontWeight::Bold) {
65
+ textAttributes.fontWeight = FontWeight::Bold;
66
+ } else if (props.fontWeight == RNUITextViewChildFontWeight::UltraLight) {
67
+ textAttributes.fontWeight = FontWeight::UltraLight;
68
+ } else if (props.fontWeight == RNUITextViewChildFontWeight::Light) {
69
+ textAttributes.fontWeight = FontWeight::Light;
70
+ } else if (props.fontWeight == RNUITextViewChildFontWeight::Medium) {
71
+ textAttributes.fontWeight = FontWeight::Medium;
72
+ } else if (props.fontWeight == RNUITextViewChildFontWeight::Semibold) {
73
+ textAttributes.fontWeight = FontWeight::Semibold;
74
+ } else if (props.fontWeight == RNUITextViewChildFontWeight::Heavy) {
75
+ textAttributes.fontWeight = FontWeight::Heavy;
76
+ } else {
77
+ textAttributes.fontWeight = FontWeight::Regular;
78
+ }
79
+
80
+ if (props.textDecorationLine == RNUITextViewChildTextDecorationLine::LineThrough) {
81
+ textAttributes.textDecorationLineType = TextDecorationLineType::Strikethrough;
82
+ } else if (props.textDecorationLine == RNUITextViewChildTextDecorationLine::Underline) {
83
+ textAttributes.textDecorationLineType = TextDecorationLineType::Underline;
84
+ } else {
85
+ textAttributes.textDecorationLineType = TextDecorationLineType::None;
86
+ }
87
+
88
+ if (props.textDecorationStyle == RNUITextViewChildTextDecorationStyle::Solid) {
89
+ textAttributes.textDecorationStyle = TextDecorationStyle::Solid;
90
+ } else if (props.textDecorationStyle == RNUITextViewChildTextDecorationStyle::Dotted) {
91
+ textAttributes.textDecorationStyle = TextDecorationStyle::Dotted;
92
+ } else if (props.textDecorationStyle == RNUITextViewChildTextDecorationStyle::Dashed) {
93
+ textAttributes.textDecorationStyle = TextDecorationStyle::Dashed;
94
+ } else if (props.textDecorationStyle == RNUITextViewChildTextDecorationStyle::Dotted) {
95
+ textAttributes.textDecorationStyle = TextDecorationStyle::Double;
96
+ }
97
+
98
+ textAttributes.backgroundColor = props.backgroundColor;
99
+
100
+ fragment.string = props.text;
101
+ fragment.textAttributes = textAttributes;
102
+
103
+ baseAttributedString.appendFragment(std::move(fragment));
104
+ }
105
+ }
106
+
107
+ _attributedString = baseAttributedString;
108
+
109
+ TextLayoutContext textLayoutContext{};
110
+ textLayoutContext.pointScaleFactor = layoutContext.pointScaleFactor;
111
+ const auto textLayoutManager = std::make_shared<const TextLayoutManager>(getContextContainer());
112
+
113
+ return textLayoutManager->measure(
114
+ AttributedStringBox{baseAttributedString},
115
+ paragraphAttributes,
116
+ textLayoutContext,
117
+ layoutConstraints
118
+ ).size;
119
+ }
120
+
121
+ void RNUITextViewShadowNode::layout(LayoutContext layoutContext) {
122
+ ensureUnsealed();
123
+ setStateData(RNUITextViewStateReal{
124
+ _attributedString
125
+ });
126
+ }
127
+ }
@@ -0,0 +1,48 @@
1
+ #pragma once
2
+
3
+ #include <react-native-uitextview/EventEmitters.h>
4
+ #include <react-native-uitextview/Props.h>
5
+ #include <react/renderer/components/view/ConcreteViewShadowNode.h>
6
+ #include <react/renderer/textlayoutmanager/TextLayoutManager.h>
7
+ #include <react/renderer/core/LayoutContext.h>
8
+ #include <react/renderer/core/ShadowNode.h>
9
+
10
+ namespace facebook::react {
11
+
12
+ extern const char RNUITextViewComponentName[];
13
+
14
+ class RNUITextViewStateReal final {
15
+ public:
16
+ AttributedString attributedString;
17
+ };
18
+
19
+ class RNUITextViewShadowNode final : public ConcreteViewShadowNode<
20
+ RNUITextViewComponentName,
21
+ RNUITextViewProps,
22
+ RNUITextViewEventEmitter,
23
+ RNUITextViewStateReal> {
24
+ public:
25
+ using ConcreteViewShadowNode::ConcreteViewShadowNode;
26
+
27
+ RNUITextViewShadowNode(
28
+ const ShadowNode& sourceShadowNode,
29
+ const ShadowNodeFragment& fragment
30
+ );
31
+
32
+ static ShadowNodeTraits BaseTraits() {
33
+ auto traits = ConcreteViewShadowNode::BaseTraits();
34
+ traits.set(ShadowNodeTraits::Trait::LeafYogaNode);
35
+ traits.set(ShadowNodeTraits::Trait::MeasurableYogaNode);
36
+ return traits;
37
+ }
38
+
39
+ void layout(LayoutContext layoutContext) override;
40
+
41
+ Size measureContent(
42
+ const LayoutContext& layoutContext,
43
+ const LayoutConstraints& layoutConstraints) const override;
44
+
45
+ private:
46
+ mutable AttributedString _attributedString;
47
+ };
48
+ } // 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,23 @@
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: GenerateComponentDescriptorCpp.js
9
+ */
10
+
11
+ #include "ComponentDescriptors.h"
12
+ #include <react/renderer/core/ConcreteComponentDescriptor.h>
13
+ #include <react/renderer/componentregistry/ComponentDescriptorProviderRegistry.h>
14
+
15
+ namespace facebook::react {
16
+
17
+ void RNUITextViewSpec_registerComponentDescriptorsFromCodegen(
18
+ std::shared_ptr<const ComponentDescriptorProviderRegistry> registry) {
19
+ registry->add(concreteComponentDescriptorProvider<RNUITextViewChildComponentDescriptor>());
20
+ registry->add(concreteComponentDescriptorProvider<RNUITextViewComponentDescriptor>());
21
+ }
22
+
23
+ } // namespace facebook::react
@@ -0,0 +1,25 @@
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: GenerateComponentDescriptorH.js
9
+ */
10
+
11
+ #pragma once
12
+
13
+ #include "ShadowNodes.h"
14
+ #include <react/renderer/core/ConcreteComponentDescriptor.h>
15
+ #include <react/renderer/componentregistry/ComponentDescriptorProviderRegistry.h>
16
+
17
+ namespace facebook::react {
18
+
19
+ using RNUITextViewChildComponentDescriptor = ConcreteComponentDescriptor<RNUITextViewChildShadowNode>;
20
+ using RNUITextViewComponentDescriptor = ConcreteComponentDescriptor<RNUITextViewShadowNode>;
21
+
22
+ void RNUITextViewSpec_registerComponentDescriptorsFromCodegen(
23
+ std::shared_ptr<const ComponentDescriptorProviderRegistry> registry);
24
+
25
+ } // namespace facebook::react
@@ -0,0 +1,61 @@
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: GenerateEventEmitterCpp.js
9
+ */
10
+
11
+ #include "EventEmitters.h"
12
+
13
+
14
+ namespace facebook::react {
15
+
16
+ void RNUITextViewChildEventEmitter::onPress(OnPress $event) const {
17
+ dispatchEvent("press", [$event=std::move($event)](jsi::Runtime &runtime) {
18
+ auto $payload = jsi::Object(runtime);
19
+ $payload.setProperty(runtime, "target", $event.target);
20
+ return $payload;
21
+ });
22
+ }
23
+
24
+
25
+ void RNUITextViewChildEventEmitter::onLongPress(OnLongPress $event) const {
26
+ dispatchEvent("longPress", [$event=std::move($event)](jsi::Runtime &runtime) {
27
+ auto $payload = jsi::Object(runtime);
28
+ $payload.setProperty(runtime, "target", $event.target);
29
+ return $payload;
30
+ });
31
+ }
32
+
33
+
34
+ void RNUITextViewEventEmitter::onTextLayout(OnTextLayout $event) const {
35
+ dispatchEvent("textLayout", [$event=std::move($event)](jsi::Runtime &runtime) {
36
+ auto $payload = jsi::Object(runtime);
37
+ $payload.setProperty(runtime, "target", $event.target);
38
+
39
+ auto lines = jsi::Array(runtime, $event.lines.size());
40
+ size_t linesIndex = 0;
41
+ for (auto linesValue : $event.lines) {
42
+ lines.setValueAtIndex(runtime, linesIndex++, linesValue);
43
+ }
44
+ $payload.setProperty(runtime, "lines", lines);
45
+
46
+ return $payload;
47
+ });
48
+ }
49
+
50
+
51
+ void RNUITextViewEventEmitter::onCustomMenuAction(OnCustomMenuAction $event) const {
52
+ dispatchEvent("customMenuAction", [$event=std::move($event)](jsi::Runtime &runtime) {
53
+ auto $payload = jsi::Object(runtime);
54
+ $payload.setProperty(runtime, "target", $event.target);
55
+ $payload.setProperty(runtime, "actionId", $event.actionId);
56
+ $payload.setProperty(runtime, "selectedText", $event.selectedText);
57
+ return $payload;
58
+ });
59
+ }
60
+
61
+ } // namespace facebook::react
@@ -0,0 +1,49 @@
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: GenerateEventEmitterH.js
9
+ */
10
+ #pragma once
11
+
12
+ #include <react/renderer/components/view/ViewEventEmitter.h>
13
+
14
+
15
+ namespace facebook::react {
16
+ class RNUITextViewChildEventEmitter : public ViewEventEmitter {
17
+ public:
18
+ using ViewEventEmitter::ViewEventEmitter;
19
+
20
+ struct OnPress {
21
+ int target;
22
+ };
23
+
24
+ struct OnLongPress {
25
+ int target;
26
+ };
27
+ void onPress(OnPress value) const;
28
+
29
+ void onLongPress(OnLongPress value) const;
30
+ };
31
+ class RNUITextViewEventEmitter : public ViewEventEmitter {
32
+ public:
33
+ using ViewEventEmitter::ViewEventEmitter;
34
+
35
+ struct OnTextLayout {
36
+ int target;
37
+ std::vector<std::string> lines;
38
+ };
39
+
40
+ struct OnCustomMenuAction {
41
+ int target;
42
+ std::string actionId;
43
+ std::string selectedText;
44
+ };
45
+ void onTextLayout(OnTextLayout value) const;
46
+
47
+ void onCustomMenuAction(OnCustomMenuAction value) const;
48
+ };
49
+ } // namespace facebook::react
@@ -0,0 +1,47 @@
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: GeneratePropsCpp.js
9
+ */
10
+
11
+ #include "Props.h"
12
+ #include <react/renderer/core/PropsParserContext.h>
13
+ #include <react/renderer/core/propsConversions.h>
14
+
15
+ namespace facebook::react {
16
+
17
+ RNUITextViewChildProps::RNUITextViewChildProps(
18
+ const PropsParserContext &context,
19
+ const RNUITextViewChildProps &sourceProps,
20
+ const RawProps &rawProps): ViewProps(context, sourceProps, rawProps),
21
+
22
+ text(convertRawProp(context, rawProps, "text", sourceProps.text, {})),
23
+ color(convertRawProp(context, rawProps, "color", sourceProps.color, {})),
24
+ fontSize(convertRawProp(context, rawProps, "fontSize", sourceProps.fontSize, {0.0})),
25
+ fontStyle(convertRawProp(context, rawProps, "fontStyle", sourceProps.fontStyle, {RNUITextViewChildFontStyle::Normal})),
26
+ fontWeight(convertRawProp(context, rawProps, "fontWeight", sourceProps.fontWeight, {RNUITextViewChildFontWeight::Normal})),
27
+ fontFamily(convertRawProp(context, rawProps, "fontFamily", sourceProps.fontFamily, {})),
28
+ letterSpacing(convertRawProp(context, rawProps, "letterSpacing", sourceProps.letterSpacing, {0.0})),
29
+ lineHeight(convertRawProp(context, rawProps, "lineHeight", sourceProps.lineHeight, {0.0})),
30
+ textDecorationLine(convertRawProp(context, rawProps, "textDecorationLine", sourceProps.textDecorationLine, {RNUITextViewChildTextDecorationLine::None})),
31
+ textDecorationStyle(convertRawProp(context, rawProps, "textDecorationStyle", sourceProps.textDecorationStyle, {RNUITextViewChildTextDecorationStyle::Solid})),
32
+ textDecorationColor(convertRawProp(context, rawProps, "textDecorationColor", sourceProps.textDecorationColor, {})),
33
+ shadowRadius(convertRawProp(context, rawProps, "shadowRadius", sourceProps.shadowRadius, {0.0}))
34
+ {}
35
+ RNUITextViewProps::RNUITextViewProps(
36
+ const PropsParserContext &context,
37
+ const RNUITextViewProps &sourceProps,
38
+ const RawProps &rawProps): ViewProps(context, sourceProps, rawProps),
39
+
40
+ numberOfLines(convertRawProp(context, rawProps, "numberOfLines", sourceProps.numberOfLines, {0})),
41
+ allowsFontScaling(convertRawProp(context, rawProps, "allowsFontScaling", sourceProps.allowsFontScaling, {false})),
42
+ ellipsizeMode(convertRawProp(context, rawProps, "ellipsizeMode", sourceProps.ellipsizeMode, {RNUITextViewEllipsizeMode::Tail})),
43
+ selectable(convertRawProp(context, rawProps, "selectable", sourceProps.selectable, {false})),
44
+ customMenuItems(convertRawProp(context, rawProps, "customMenuItems", sourceProps.customMenuItems, {}))
45
+ {}
46
+
47
+ } // namespace facebook::react
@@ -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,24 @@
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: GenerateComponentHObjCpp.js
8
+ */
9
+
10
+ #import <Foundation/Foundation.h>
11
+ #import <React/RCTDefines.h>
12
+ #import <React/RCTLog.h>
13
+
14
+ NS_ASSUME_NONNULL_BEGIN
15
+
16
+ @protocol RCTRNUITextViewChildViewProtocol <NSObject>
17
+
18
+ @end
19
+
20
+ @protocol RCTRNUITextViewViewProtocol <NSObject>
21
+
22
+ @end
23
+
24
+ NS_ASSUME_NONNULL_END
@@ -0,0 +1,16 @@
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: GenerateModuleObjCpp
8
+ *
9
+ * We create an umbrella header (and corresponding implementation) here since
10
+ * Cxx compilation in BUCK has a limitation: source-code producing genrule()s
11
+ * must have a single output. More files => more genrule()s => slower builds.
12
+ */
13
+
14
+ #import "RNUITextViewSpec.h"
15
+
16
+