@bsky.app/react-native-uitextview 2.3.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 (103) hide show
  1. package/LICENSE +20 -0
  2. package/README.md +188 -0
  3. package/android/generated/android/app/build/generated/source/codegen/jni/CMakeLists.txt +28 -0
  4. package/android/generated/android/app/build/generated/source/codegen/jni/RNUITextViewSpec-generated.cpp +22 -0
  5. package/android/generated/android/app/build/generated/source/codegen/jni/RNUITextViewSpec.h +24 -0
  6. package/android/generated/android/app/build/generated/source/codegen/jni/react/renderer/components/RNUITextViewSpec/ComponentDescriptors.cpp +23 -0
  7. package/android/generated/android/app/build/generated/source/codegen/jni/react/renderer/components/RNUITextViewSpec/ComponentDescriptors.h +25 -0
  8. package/android/generated/android/app/build/generated/source/codegen/jni/react/renderer/components/RNUITextViewSpec/EventEmitters.cpp +61 -0
  9. package/android/generated/android/app/build/generated/source/codegen/jni/react/renderer/components/RNUITextViewSpec/EventEmitters.h +49 -0
  10. package/android/generated/android/app/build/generated/source/codegen/jni/react/renderer/components/RNUITextViewSpec/Props.cpp +151 -0
  11. package/android/generated/android/app/build/generated/source/codegen/jni/react/renderer/components/RNUITextViewSpec/Props.h +236 -0
  12. package/android/generated/android/app/build/generated/source/codegen/jni/react/renderer/components/RNUITextViewSpec/RNUITextViewSpecJSI.h +19 -0
  13. package/android/generated/android/app/build/generated/source/codegen/jni/react/renderer/components/RNUITextViewSpec/ShadowNodes.cpp +18 -0
  14. package/android/generated/android/app/build/generated/source/codegen/jni/react/renderer/components/RNUITextViewSpec/ShadowNodes.h +43 -0
  15. package/android/generated/android/app/build/generated/source/codegen/jni/react/renderer/components/RNUITextViewSpec/States.cpp +16 -0
  16. package/android/generated/android/app/build/generated/source/codegen/jni/react/renderer/components/RNUITextViewSpec/States.h +22 -0
  17. package/ios/RNUITextView.h +13 -0
  18. package/ios/RNUITextView.mm +338 -0
  19. package/ios/RNUITextViewChild.h +24 -0
  20. package/ios/RNUITextViewChild.mm +72 -0
  21. package/ios/RNUITextViewChildComponentDescriptor.h +13 -0
  22. package/ios/RNUITextViewChildShadowNode.cpp +6 -0
  23. package/ios/RNUITextViewChildShadowNode.h +16 -0
  24. package/ios/RNUITextViewComponentDescriptor.h +13 -0
  25. package/ios/RNUITextViewManager.mm +36 -0
  26. package/ios/RNUITextViewShadowNode.cpp +139 -0
  27. package/ios/RNUITextViewShadowNode.h +48 -0
  28. package/ios/generated/build/generated/ios/ReactCodegen/RNUITextViewSpec/RNUITextViewSpec-generated.mm +16 -0
  29. package/ios/generated/build/generated/ios/ReactCodegen/RNUITextViewSpec/RNUITextViewSpec.h +38 -0
  30. package/ios/generated/build/generated/ios/ReactCodegen/RNUITextViewSpecJSI.h +19 -0
  31. package/ios/generated/build/generated/ios/ReactCodegen/react/renderer/components/RNUITextViewSpec/ComponentDescriptors.cpp +23 -0
  32. package/ios/generated/build/generated/ios/ReactCodegen/react/renderer/components/RNUITextViewSpec/ComponentDescriptors.h +25 -0
  33. package/ios/generated/build/generated/ios/ReactCodegen/react/renderer/components/RNUITextViewSpec/EventEmitters.cpp +61 -0
  34. package/ios/generated/build/generated/ios/ReactCodegen/react/renderer/components/RNUITextViewSpec/EventEmitters.h +49 -0
  35. package/ios/generated/build/generated/ios/ReactCodegen/react/renderer/components/RNUITextViewSpec/Props.cpp +151 -0
  36. package/ios/generated/build/generated/ios/ReactCodegen/react/renderer/components/RNUITextViewSpec/Props.h +236 -0
  37. package/ios/generated/build/generated/ios/ReactCodegen/react/renderer/components/RNUITextViewSpec/RCTComponentViewHelpers.h +24 -0
  38. package/ios/generated/build/generated/ios/ReactCodegen/react/renderer/components/RNUITextViewSpec/ShadowNodes.cpp +18 -0
  39. package/ios/generated/build/generated/ios/ReactCodegen/react/renderer/components/RNUITextViewSpec/ShadowNodes.h +43 -0
  40. package/ios/generated/build/generated/ios/ReactCodegen/react/renderer/components/RNUITextViewSpec/States.cpp +16 -0
  41. package/ios/generated/build/generated/ios/ReactCodegen/react/renderer/components/RNUITextViewSpec/States.h +22 -0
  42. package/lib/commonjs/RNUITextViewChildNativeComponent.ts +49 -0
  43. package/lib/commonjs/RNUITextViewNativeComponent.ts +53 -0
  44. package/lib/commonjs/Text.js +111 -0
  45. package/lib/commonjs/Text.js.map +1 -0
  46. package/lib/commonjs/Text.web.js +23 -0
  47. package/lib/commonjs/Text.web.js.map +1 -0
  48. package/lib/commonjs/index.js +17 -0
  49. package/lib/commonjs/index.js.map +1 -0
  50. package/lib/commonjs/package.json +1 -0
  51. package/lib/commonjs/util.js +66 -0
  52. package/lib/commonjs/util.js.map +1 -0
  53. package/lib/module/RNUITextViewChildNativeComponent.ts +49 -0
  54. package/lib/module/RNUITextViewNativeComponent.ts +53 -0
  55. package/lib/module/Text.js +106 -0
  56. package/lib/module/Text.js.map +1 -0
  57. package/lib/module/Text.web.js +19 -0
  58. package/lib/module/Text.web.js.map +1 -0
  59. package/lib/module/index.js +4 -0
  60. package/lib/module/index.js.map +1 -0
  61. package/lib/module/package.json +1 -0
  62. package/lib/module/util.js +62 -0
  63. package/lib/module/util.js.map +1 -0
  64. package/lib/typescript/commonjs/example/src/App.d.ts +3 -0
  65. package/lib/typescript/commonjs/example/src/App.d.ts.map +1 -0
  66. package/lib/typescript/commonjs/package.json +1 -0
  67. package/lib/typescript/commonjs/src/RNUITextViewChildNativeComponent.d.ts +29 -0
  68. package/lib/typescript/commonjs/src/RNUITextViewChildNativeComponent.d.ts.map +1 -0
  69. package/lib/typescript/commonjs/src/RNUITextViewNativeComponent.d.ts +43 -0
  70. package/lib/typescript/commonjs/src/RNUITextViewNativeComponent.d.ts.map +1 -0
  71. package/lib/typescript/commonjs/src/Text.d.ts +25 -0
  72. package/lib/typescript/commonjs/src/Text.d.ts.map +1 -0
  73. package/lib/typescript/commonjs/src/Text.web.d.ts +19 -0
  74. package/lib/typescript/commonjs/src/Text.web.d.ts.map +1 -0
  75. package/lib/typescript/commonjs/src/index.d.ts +2 -0
  76. package/lib/typescript/commonjs/src/index.d.ts.map +1 -0
  77. package/lib/typescript/commonjs/src/util.d.ts +163 -0
  78. package/lib/typescript/commonjs/src/util.d.ts.map +1 -0
  79. package/lib/typescript/module/example/src/App.d.ts +3 -0
  80. package/lib/typescript/module/example/src/App.d.ts.map +1 -0
  81. package/lib/typescript/module/package.json +1 -0
  82. package/lib/typescript/module/src/RNUITextViewChildNativeComponent.d.ts +29 -0
  83. package/lib/typescript/module/src/RNUITextViewChildNativeComponent.d.ts.map +1 -0
  84. package/lib/typescript/module/src/RNUITextViewNativeComponent.d.ts +43 -0
  85. package/lib/typescript/module/src/RNUITextViewNativeComponent.d.ts.map +1 -0
  86. package/lib/typescript/module/src/Text.d.ts +25 -0
  87. package/lib/typescript/module/src/Text.d.ts.map +1 -0
  88. package/lib/typescript/module/src/Text.web.d.ts +19 -0
  89. package/lib/typescript/module/src/Text.web.d.ts.map +1 -0
  90. package/lib/typescript/module/src/index.d.ts +2 -0
  91. package/lib/typescript/module/src/index.d.ts.map +1 -0
  92. package/lib/typescript/module/src/util.d.ts +163 -0
  93. package/lib/typescript/module/src/util.d.ts.map +1 -0
  94. package/package.json +185 -0
  95. package/react-native-uitextview.podspec +34 -0
  96. package/react-native.config.js +28 -0
  97. package/scripts/ensure-rnc-cli-executable.js +19 -0
  98. package/src/RNUITextViewChildNativeComponent.ts +49 -0
  99. package/src/RNUITextViewNativeComponent.ts +53 -0
  100. package/src/Text.tsx +125 -0
  101. package/src/Text.web.tsx +22 -0
  102. package/src/index.tsx +1 -0
  103. package/src/util.ts +67 -0
@@ -0,0 +1,48 @@
1
+ #pragma once
2
+
3
+ #include <react/renderer/components/RNUITextViewSpec/EventEmitters.h>
4
+ #include <react/renderer/components/RNUITextViewSpec/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,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
+
@@ -0,0 +1,38 @@
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
+ #ifndef __cplusplus
15
+ #error This file must be compiled as Obj-C++. If you are importing it, you must change your file extension to .mm.
16
+ #endif
17
+
18
+ // Avoid multiple includes of RNUITextViewSpec symbols
19
+ #ifndef RNUITextViewSpec_H
20
+ #define RNUITextViewSpec_H
21
+
22
+ #import <Foundation/Foundation.h>
23
+ #import <RCTRequired/RCTRequired.h>
24
+ #import <RCTTypeSafety/RCTConvertHelpers.h>
25
+ #import <RCTTypeSafety/RCTTypedModuleConstants.h>
26
+ #import <React/RCTBridgeModule.h>
27
+ #import <React/RCTCxxConvert.h>
28
+ #import <React/RCTManagedPointer.h>
29
+ #import <ReactCommon/RCTTurboModule.h>
30
+ #import <optional>
31
+ #import <vector>
32
+
33
+
34
+ NS_ASSUME_NONNULL_BEGIN
35
+
36
+
37
+ NS_ASSUME_NONNULL_END
38
+ #endif // RNUITextViewSpec_H
@@ -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 <react/renderer/components/RNUITextViewSpec/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 <react/renderer/components/RNUITextViewSpec/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 <react/renderer/components/RNUITextViewSpec/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::onSelectionChange(OnSelectionChange event) const {
52
+ dispatchEvent("selectionChange", [event=std::move(event)](jsi::Runtime &runtime) {
53
+ auto payload = jsi::Object(runtime);
54
+ payload.setProperty(runtime, "target", event.target);
55
+ payload.setProperty(runtime, "start", event.start);
56
+ payload.setProperty(runtime, "end", event.end);
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 OnSelectionChange {
41
+ int target;
42
+ int start;
43
+ int end;
44
+ };
45
+ void onTextLayout(OnTextLayout value) const;
46
+
47
+ void onSelectionChange(OnSelectionChange value) const;
48
+ };
49
+ } // namespace facebook::react
@@ -0,0 +1,151 @@
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 <react/renderer/components/RNUITextViewSpec/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
+ textAlign(convertRawProp(context, rawProps, "textAlign", sourceProps.textAlign, {RNUITextViewChildTextAlign::Auto})),
34
+ shadowRadius(convertRawProp(context, rawProps, "shadowRadius", sourceProps.shadowRadius, {0.0})) {}
35
+
36
+ #ifdef RN_SERIALIZABLE_STATE
37
+ ComponentName RNUITextViewChildProps::getDiffPropsImplementationTarget() const {
38
+ return "RNUITextViewChild";
39
+ }
40
+
41
+ folly::dynamic RNUITextViewChildProps::getDiffProps(
42
+ const Props* prevProps) const {
43
+ static const auto defaultProps = RNUITextViewChildProps();
44
+ const RNUITextViewChildProps* oldProps = prevProps == nullptr
45
+ ? &defaultProps
46
+ : static_cast<const RNUITextViewChildProps*>(prevProps);
47
+ if (this == oldProps) {
48
+ return folly::dynamic::object();
49
+ }
50
+ folly::dynamic result = HostPlatformViewProps::getDiffProps(prevProps);
51
+
52
+ if (text != oldProps->text) {
53
+ result["text"] = text;
54
+ }
55
+
56
+ if (color != oldProps->color) {
57
+ result["color"] = *color;
58
+ }
59
+
60
+ if ((fontSize != oldProps->fontSize) && !(std::isnan(fontSize) && std::isnan(oldProps->fontSize))) {
61
+ result["fontSize"] = fontSize;
62
+ }
63
+
64
+ if (fontStyle != oldProps->fontStyle) {
65
+ result["fontStyle"] = toDynamic(fontStyle);
66
+ }
67
+
68
+ if (fontWeight != oldProps->fontWeight) {
69
+ result["fontWeight"] = toDynamic(fontWeight);
70
+ }
71
+
72
+ if (fontFamily != oldProps->fontFamily) {
73
+ result["fontFamily"] = fontFamily;
74
+ }
75
+
76
+ if ((letterSpacing != oldProps->letterSpacing) && !(std::isnan(letterSpacing) && std::isnan(oldProps->letterSpacing))) {
77
+ result["letterSpacing"] = letterSpacing;
78
+ }
79
+
80
+ if ((lineHeight != oldProps->lineHeight) && !(std::isnan(lineHeight) && std::isnan(oldProps->lineHeight))) {
81
+ result["lineHeight"] = lineHeight;
82
+ }
83
+
84
+ if (textDecorationLine != oldProps->textDecorationLine) {
85
+ result["textDecorationLine"] = toDynamic(textDecorationLine);
86
+ }
87
+
88
+ if (textDecorationStyle != oldProps->textDecorationStyle) {
89
+ result["textDecorationStyle"] = toDynamic(textDecorationStyle);
90
+ }
91
+
92
+ if (textDecorationColor != oldProps->textDecorationColor) {
93
+ result["textDecorationColor"] = *textDecorationColor;
94
+ }
95
+
96
+ if (textAlign != oldProps->textAlign) {
97
+ result["textAlign"] = toDynamic(textAlign);
98
+ }
99
+
100
+ if ((shadowRadius != oldProps->shadowRadius) && !(std::isnan(shadowRadius) && std::isnan(oldProps->shadowRadius))) {
101
+ result["shadowRadius"] = shadowRadius;
102
+ }
103
+ return result;
104
+ }
105
+ #endif
106
+ RNUITextViewProps::RNUITextViewProps(
107
+ const PropsParserContext &context,
108
+ const RNUITextViewProps &sourceProps,
109
+ const RawProps &rawProps): ViewProps(context, sourceProps, rawProps),
110
+
111
+ numberOfLines(convertRawProp(context, rawProps, "numberOfLines", sourceProps.numberOfLines, {0})),
112
+ allowFontScaling(convertRawProp(context, rawProps, "allowFontScaling", sourceProps.allowFontScaling, {true})),
113
+ ellipsizeMode(convertRawProp(context, rawProps, "ellipsizeMode", sourceProps.ellipsizeMode, {RNUITextViewEllipsizeMode::Tail})),
114
+ selectable(convertRawProp(context, rawProps, "selectable", sourceProps.selectable, {false})) {}
115
+
116
+ #ifdef RN_SERIALIZABLE_STATE
117
+ ComponentName RNUITextViewProps::getDiffPropsImplementationTarget() const {
118
+ return "RNUITextView";
119
+ }
120
+
121
+ folly::dynamic RNUITextViewProps::getDiffProps(
122
+ const Props* prevProps) const {
123
+ static const auto defaultProps = RNUITextViewProps();
124
+ const RNUITextViewProps* oldProps = prevProps == nullptr
125
+ ? &defaultProps
126
+ : static_cast<const RNUITextViewProps*>(prevProps);
127
+ if (this == oldProps) {
128
+ return folly::dynamic::object();
129
+ }
130
+ folly::dynamic result = HostPlatformViewProps::getDiffProps(prevProps);
131
+
132
+ if (numberOfLines != oldProps->numberOfLines) {
133
+ result["numberOfLines"] = numberOfLines;
134
+ }
135
+
136
+ if (allowFontScaling != oldProps->allowFontScaling) {
137
+ result["allowFontScaling"] = allowFontScaling;
138
+ }
139
+
140
+ if (ellipsizeMode != oldProps->ellipsizeMode) {
141
+ result["ellipsizeMode"] = toDynamic(ellipsizeMode);
142
+ }
143
+
144
+ if (selectable != oldProps->selectable) {
145
+ result["selectable"] = selectable;
146
+ }
147
+ return result;
148
+ }
149
+ #endif
150
+
151
+ } // namespace facebook::react
@@ -0,0 +1,236 @@
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/debug/DebugStringConvertible.h>
15
+ #include <react/renderer/graphics/Color.h>
16
+
17
+ namespace facebook::react {
18
+
19
+ enum class RNUITextViewChildFontStyle { Normal, Italic };
20
+
21
+ static inline void fromRawValue(const PropsParserContext& context, const RawValue &value, RNUITextViewChildFontStyle &result) {
22
+ auto string = (std::string)value;
23
+ if (string == "normal") { result = RNUITextViewChildFontStyle::Normal; return; }
24
+ if (string == "italic") { result = RNUITextViewChildFontStyle::Italic; return; }
25
+ abort();
26
+ }
27
+
28
+ static inline std::string toString(const RNUITextViewChildFontStyle &value) {
29
+ switch (value) {
30
+ case RNUITextViewChildFontStyle::Normal: return "normal";
31
+ case RNUITextViewChildFontStyle::Italic: return "italic";
32
+ default:
33
+ abort();
34
+ }
35
+ }
36
+
37
+ #ifdef RN_SERIALIZABLE_STATE
38
+ static inline folly::dynamic toDynamic(const RNUITextViewChildFontStyle &value) {
39
+ return toString(value);
40
+ }
41
+ #endif
42
+ enum class RNUITextViewChildFontWeight { Normal, Bold, UltraLight, Light, Medium, Semibold, Heavy };
43
+
44
+ static inline void fromRawValue(const PropsParserContext& context, const RawValue &value, RNUITextViewChildFontWeight &result) {
45
+ auto string = (std::string)value;
46
+ if (string == "normal") { result = RNUITextViewChildFontWeight::Normal; return; }
47
+ if (string == "bold") { result = RNUITextViewChildFontWeight::Bold; return; }
48
+ if (string == "ultraLight") { result = RNUITextViewChildFontWeight::UltraLight; return; }
49
+ if (string == "light") { result = RNUITextViewChildFontWeight::Light; return; }
50
+ if (string == "medium") { result = RNUITextViewChildFontWeight::Medium; return; }
51
+ if (string == "semibold") { result = RNUITextViewChildFontWeight::Semibold; return; }
52
+ if (string == "heavy") { result = RNUITextViewChildFontWeight::Heavy; return; }
53
+ abort();
54
+ }
55
+
56
+ static inline std::string toString(const RNUITextViewChildFontWeight &value) {
57
+ switch (value) {
58
+ case RNUITextViewChildFontWeight::Normal: return "normal";
59
+ case RNUITextViewChildFontWeight::Bold: return "bold";
60
+ case RNUITextViewChildFontWeight::UltraLight: return "ultraLight";
61
+ case RNUITextViewChildFontWeight::Light: return "light";
62
+ case RNUITextViewChildFontWeight::Medium: return "medium";
63
+ case RNUITextViewChildFontWeight::Semibold: return "semibold";
64
+ case RNUITextViewChildFontWeight::Heavy: return "heavy";
65
+ default:
66
+ abort();
67
+ }
68
+ }
69
+
70
+ #ifdef RN_SERIALIZABLE_STATE
71
+ static inline folly::dynamic toDynamic(const RNUITextViewChildFontWeight &value) {
72
+ return toString(value);
73
+ }
74
+ #endif
75
+ enum class RNUITextViewChildTextDecorationLine { None, Underline, LineThrough };
76
+
77
+ static inline void fromRawValue(const PropsParserContext& context, const RawValue &value, RNUITextViewChildTextDecorationLine &result) {
78
+ auto string = (std::string)value;
79
+ if (string == "none") { result = RNUITextViewChildTextDecorationLine::None; return; }
80
+ if (string == "underline") { result = RNUITextViewChildTextDecorationLine::Underline; return; }
81
+ if (string == "line-through") { result = RNUITextViewChildTextDecorationLine::LineThrough; return; }
82
+ abort();
83
+ }
84
+
85
+ static inline std::string toString(const RNUITextViewChildTextDecorationLine &value) {
86
+ switch (value) {
87
+ case RNUITextViewChildTextDecorationLine::None: return "none";
88
+ case RNUITextViewChildTextDecorationLine::Underline: return "underline";
89
+ case RNUITextViewChildTextDecorationLine::LineThrough: return "line-through";
90
+ default:
91
+ abort();
92
+ }
93
+ }
94
+
95
+ #ifdef RN_SERIALIZABLE_STATE
96
+ static inline folly::dynamic toDynamic(const RNUITextViewChildTextDecorationLine &value) {
97
+ return toString(value);
98
+ }
99
+ #endif
100
+ enum class RNUITextViewChildTextDecorationStyle { Solid, Double, Dotted, Dashed };
101
+
102
+ static inline void fromRawValue(const PropsParserContext& context, const RawValue &value, RNUITextViewChildTextDecorationStyle &result) {
103
+ auto string = (std::string)value;
104
+ if (string == "solid") { result = RNUITextViewChildTextDecorationStyle::Solid; return; }
105
+ if (string == "double") { result = RNUITextViewChildTextDecorationStyle::Double; return; }
106
+ if (string == "dotted") { result = RNUITextViewChildTextDecorationStyle::Dotted; return; }
107
+ if (string == "dashed") { result = RNUITextViewChildTextDecorationStyle::Dashed; return; }
108
+ abort();
109
+ }
110
+
111
+ static inline std::string toString(const RNUITextViewChildTextDecorationStyle &value) {
112
+ switch (value) {
113
+ case RNUITextViewChildTextDecorationStyle::Solid: return "solid";
114
+ case RNUITextViewChildTextDecorationStyle::Double: return "double";
115
+ case RNUITextViewChildTextDecorationStyle::Dotted: return "dotted";
116
+ case RNUITextViewChildTextDecorationStyle::Dashed: return "dashed";
117
+ default:
118
+ abort();
119
+ }
120
+ }
121
+
122
+ #ifdef RN_SERIALIZABLE_STATE
123
+ static inline folly::dynamic toDynamic(const RNUITextViewChildTextDecorationStyle &value) {
124
+ return toString(value);
125
+ }
126
+ #endif
127
+ enum class RNUITextViewChildTextAlign { Auto, Left, Right, Center, Justify };
128
+
129
+ static inline void fromRawValue(const PropsParserContext& context, const RawValue &value, RNUITextViewChildTextAlign &result) {
130
+ auto string = (std::string)value;
131
+ if (string == "auto") { result = RNUITextViewChildTextAlign::Auto; return; }
132
+ if (string == "left") { result = RNUITextViewChildTextAlign::Left; return; }
133
+ if (string == "right") { result = RNUITextViewChildTextAlign::Right; return; }
134
+ if (string == "center") { result = RNUITextViewChildTextAlign::Center; return; }
135
+ if (string == "justify") { result = RNUITextViewChildTextAlign::Justify; return; }
136
+ abort();
137
+ }
138
+
139
+ static inline std::string toString(const RNUITextViewChildTextAlign &value) {
140
+ switch (value) {
141
+ case RNUITextViewChildTextAlign::Auto: return "auto";
142
+ case RNUITextViewChildTextAlign::Left: return "left";
143
+ case RNUITextViewChildTextAlign::Right: return "right";
144
+ case RNUITextViewChildTextAlign::Center: return "center";
145
+ case RNUITextViewChildTextAlign::Justify: return "justify";
146
+ default:
147
+ abort();
148
+ }
149
+ }
150
+
151
+ #ifdef RN_SERIALIZABLE_STATE
152
+ static inline folly::dynamic toDynamic(const RNUITextViewChildTextAlign &value) {
153
+ return toString(value);
154
+ }
155
+ #endif
156
+
157
+ class RNUITextViewChildProps final : public ViewProps {
158
+ public:
159
+ RNUITextViewChildProps() = default;
160
+ RNUITextViewChildProps(const PropsParserContext& context, const RNUITextViewChildProps &sourceProps, const RawProps &rawProps);
161
+
162
+ #pragma mark - Props
163
+
164
+ std::string text{};
165
+ SharedColor color{};
166
+ Float fontSize{0.0};
167
+ RNUITextViewChildFontStyle fontStyle{RNUITextViewChildFontStyle::Normal};
168
+ RNUITextViewChildFontWeight fontWeight{RNUITextViewChildFontWeight::Normal};
169
+ std::string fontFamily{};
170
+ Float letterSpacing{0.0};
171
+ Float lineHeight{0.0};
172
+ RNUITextViewChildTextDecorationLine textDecorationLine{RNUITextViewChildTextDecorationLine::None};
173
+ RNUITextViewChildTextDecorationStyle textDecorationStyle{RNUITextViewChildTextDecorationStyle::Solid};
174
+ SharedColor textDecorationColor{};
175
+ RNUITextViewChildTextAlign textAlign{RNUITextViewChildTextAlign::Auto};
176
+ Float shadowRadius{0.0};
177
+
178
+ #ifdef RN_SERIALIZABLE_STATE
179
+ ComponentName getDiffPropsImplementationTarget() const override;
180
+
181
+ folly::dynamic getDiffProps(const Props* prevProps) const override;
182
+ #endif
183
+
184
+
185
+ };
186
+
187
+ enum class RNUITextViewEllipsizeMode { Head, Middle, Tail, Clip };
188
+
189
+ static inline void fromRawValue(const PropsParserContext& context, const RawValue &value, RNUITextViewEllipsizeMode &result) {
190
+ auto string = (std::string)value;
191
+ if (string == "head") { result = RNUITextViewEllipsizeMode::Head; return; }
192
+ if (string == "middle") { result = RNUITextViewEllipsizeMode::Middle; return; }
193
+ if (string == "tail") { result = RNUITextViewEllipsizeMode::Tail; return; }
194
+ if (string == "clip") { result = RNUITextViewEllipsizeMode::Clip; return; }
195
+ abort();
196
+ }
197
+
198
+ static inline std::string toString(const RNUITextViewEllipsizeMode &value) {
199
+ switch (value) {
200
+ case RNUITextViewEllipsizeMode::Head: return "head";
201
+ case RNUITextViewEllipsizeMode::Middle: return "middle";
202
+ case RNUITextViewEllipsizeMode::Tail: return "tail";
203
+ case RNUITextViewEllipsizeMode::Clip: return "clip";
204
+ default:
205
+ abort();
206
+ }
207
+ }
208
+
209
+ #ifdef RN_SERIALIZABLE_STATE
210
+ static inline folly::dynamic toDynamic(const RNUITextViewEllipsizeMode &value) {
211
+ return toString(value);
212
+ }
213
+ #endif
214
+
215
+ class RNUITextViewProps final : public ViewProps {
216
+ public:
217
+ RNUITextViewProps() = default;
218
+ RNUITextViewProps(const PropsParserContext& context, const RNUITextViewProps &sourceProps, const RawProps &rawProps);
219
+
220
+ #pragma mark - Props
221
+
222
+ int numberOfLines{0};
223
+ bool allowFontScaling{true};
224
+ RNUITextViewEllipsizeMode ellipsizeMode{RNUITextViewEllipsizeMode::Tail};
225
+ bool selectable{false};
226
+
227
+ #ifdef RN_SERIALIZABLE_STATE
228
+ ComponentName getDiffPropsImplementationTarget() const override;
229
+
230
+ folly::dynamic getDiffProps(const Props* prevProps) const override;
231
+ #endif
232
+
233
+
234
+ };
235
+
236
+ } // namespace facebook::react