@dongsuo/react-native-uitextview 1.0.1 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/{ios/generated → android/generated/android/app/build/generated/source/codegen/jni/react/renderer/components}/RNUITextViewSpec/ComponentDescriptors.cpp +1 -1
- package/android/generated/{jni → android/app/build/generated/source/codegen/jni}/react/renderer/components/RNUITextViewSpec/ComponentDescriptors.h +1 -1
- package/android/generated/{jni → android/app/build/generated/source/codegen/jni}/react/renderer/components/RNUITextViewSpec/EventEmitters.cpp +1 -1
- package/android/generated/{jni → android/app/build/generated/source/codegen/jni}/react/renderer/components/RNUITextViewSpec/Props.cpp +3 -2
- package/android/generated/{jni → android/app/build/generated/source/codegen/jni}/react/renderer/components/RNUITextViewSpec/Props.h +23 -1
- package/{ios/generated → android/generated/android/app/build/generated/source/codegen/jni/react/renderer/components}/RNUITextViewSpec/ShadowNodes.cpp +1 -1
- package/android/generated/{jni → android/app/build/generated/source/codegen/jni}/react/renderer/components/RNUITextViewSpec/ShadowNodes.h +3 -3
- package/android/generated/{jni → android/app/build/generated/source/codegen/jni}/react/renderer/components/RNUITextViewSpec/States.cpp +1 -1
- package/ios/RNUITextView.mm +15 -6
- package/ios/RNUITextViewChild.mm +5 -9
- package/ios/RNUITextViewChildShadowNode.h +3 -3
- package/ios/RNUITextViewShadowNode.cpp +21 -4
- package/ios/RNUITextViewShadowNode.h +5 -5
- package/{android/generated/jni → ios/generated/build/generated/ios}/react/renderer/components/RNUITextViewSpec/ComponentDescriptors.cpp +1 -1
- package/ios/generated/{RNUITextViewSpec → build/generated/ios/react/renderer/components/RNUITextViewSpec}/ComponentDescriptors.h +1 -1
- package/ios/generated/{RNUITextViewSpec → build/generated/ios/react/renderer/components/RNUITextViewSpec}/EventEmitters.cpp +1 -1
- package/ios/generated/{RNUITextViewSpec → build/generated/ios/react/renderer/components/RNUITextViewSpec}/Props.cpp +3 -2
- package/ios/generated/{RNUITextViewSpec → build/generated/ios/react/renderer/components/RNUITextViewSpec}/Props.h +23 -1
- package/{android/generated/jni → ios/generated/build/generated/ios}/react/renderer/components/RNUITextViewSpec/ShadowNodes.cpp +1 -1
- package/ios/generated/{RNUITextViewSpec → build/generated/ios/react/renderer/components/RNUITextViewSpec}/ShadowNodes.h +3 -3
- package/ios/generated/{RNUITextViewSpec → build/generated/ios/react/renderer/components/RNUITextViewSpec}/States.cpp +1 -1
- package/lib/commonjs/RNUITextViewChildNativeComponent.ts +4 -1
- package/lib/commonjs/RNUITextViewNativeComponent.ts +20 -20
- package/lib/module/RNUITextViewChildNativeComponent.ts +4 -1
- package/lib/module/RNUITextViewNativeComponent.ts +20 -20
- package/lib/typescript/commonjs/example/src/App.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/RNUITextViewChildNativeComponent.d.ts +2 -0
- package/lib/typescript/commonjs/src/RNUITextViewChildNativeComponent.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/RNUITextViewNativeComponent.d.ts +5 -5
- package/lib/typescript/commonjs/src/RNUITextViewNativeComponent.d.ts.map +1 -1
- package/lib/typescript/module/example/src/App.d.ts.map +1 -1
- package/lib/typescript/module/src/RNUITextViewChildNativeComponent.d.ts +2 -0
- package/lib/typescript/module/src/RNUITextViewChildNativeComponent.d.ts.map +1 -1
- package/lib/typescript/module/src/RNUITextViewNativeComponent.d.ts +5 -5
- package/lib/typescript/module/src/RNUITextViewNativeComponent.d.ts.map +1 -1
- package/package.json +3 -4
- package/react-native-uitextview.podspec +16 -3
- package/react-native.config.js +1 -1
- package/src/RNUITextViewChildNativeComponent.ts +4 -1
- package/src/RNUITextViewNativeComponent.ts +20 -20
- /package/android/generated/{jni → android/app/build/generated/source/codegen/jni}/CMakeLists.txt +0 -0
- /package/android/generated/{jni → android/app/build/generated/source/codegen/jni}/RNUITextViewSpec-generated.cpp +0 -0
- /package/android/generated/{jni → android/app/build/generated/source/codegen/jni}/RNUITextViewSpec.h +0 -0
- /package/android/generated/{jni → android/app/build/generated/source/codegen/jni}/react/renderer/components/RNUITextViewSpec/EventEmitters.h +0 -0
- /package/android/generated/{jni → android/app/build/generated/source/codegen/jni}/react/renderer/components/RNUITextViewSpec/RNUITextViewSpecJSI-generated.cpp +0 -0
- /package/android/generated/{jni → android/app/build/generated/source/codegen/jni}/react/renderer/components/RNUITextViewSpec/RNUITextViewSpecJSI.h +0 -0
- /package/android/generated/{jni → android/app/build/generated/source/codegen/jni}/react/renderer/components/RNUITextViewSpec/States.h +0 -0
- /package/ios/generated/{RNUITextViewSpec → build/generated/ios/RNUITextViewSpec}/RNUITextViewSpec-generated.mm +0 -0
- /package/ios/generated/{RNUITextViewSpec → build/generated/ios/RNUITextViewSpec}/RNUITextViewSpec.h +0 -0
- /package/ios/generated/{RNUITextViewSpecJSI-generated.cpp → build/generated/ios/RNUITextViewSpecJSI-generated.cpp} +0 -0
- /package/ios/generated/{RNUITextViewSpecJSI.h → build/generated/ios/RNUITextViewSpecJSI.h} +0 -0
- /package/ios/generated/{RNUITextViewSpec → build/generated/ios/react/renderer/components/RNUITextViewSpec}/EventEmitters.h +0 -0
- /package/ios/generated/{RNUITextViewSpec → build/generated/ios/react/renderer/components/RNUITextViewSpec}/RCTComponentViewHelpers.h +0 -0
- /package/ios/generated/{RNUITextViewSpec → build/generated/ios/react/renderer/components/RNUITextViewSpec}/States.h +0 -0
package/README.md
CHANGED
|
@@ -218,7 +218,7 @@ Some ideas for great contributions that we do not have time to properly implemen
|
|
|
218
218
|
|
|
219
219
|
## License
|
|
220
220
|
|
|
221
|
-
|
|
221
|
+
Bluesky Social PBC has committed to a software patent non-aggression pledge. For details see [the original announcement](https://bsky.social/about/blog/10-01-2025-patent-pledge).
|
|
222
222
|
|
|
223
223
|
---
|
|
224
224
|
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* @generated by codegen project: GenerateComponentDescriptorCpp.js
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
|
-
#include
|
|
11
|
+
#include <react/renderer/components/RNUITextViewSpec/ComponentDescriptors.h>
|
|
12
12
|
#include <react/renderer/core/ConcreteComponentDescriptor.h>
|
|
13
13
|
#include <react/renderer/componentregistry/ComponentDescriptorProviderRegistry.h>
|
|
14
14
|
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
|
|
11
11
|
#pragma once
|
|
12
12
|
|
|
13
|
-
#include
|
|
13
|
+
#include <react/renderer/components/RNUITextViewSpec/ShadowNodes.h>
|
|
14
14
|
#include <react/renderer/core/ConcreteComponentDescriptor.h>
|
|
15
15
|
#include <react/renderer/componentregistry/ComponentDescriptorProviderRegistry.h>
|
|
16
16
|
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* @generated by codegen project: GeneratePropsCpp.js
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
|
-
#include
|
|
11
|
+
#include <react/renderer/components/RNUITextViewSpec/Props.h>
|
|
12
12
|
#include <react/renderer/core/PropsParserContext.h>
|
|
13
13
|
#include <react/renderer/core/propsConversions.h>
|
|
14
14
|
|
|
@@ -30,6 +30,7 @@ RNUITextViewChildProps::RNUITextViewChildProps(
|
|
|
30
30
|
textDecorationLine(convertRawProp(context, rawProps, "textDecorationLine", sourceProps.textDecorationLine, {RNUITextViewChildTextDecorationLine::None})),
|
|
31
31
|
textDecorationStyle(convertRawProp(context, rawProps, "textDecorationStyle", sourceProps.textDecorationStyle, {RNUITextViewChildTextDecorationStyle::Solid})),
|
|
32
32
|
textDecorationColor(convertRawProp(context, rawProps, "textDecorationColor", sourceProps.textDecorationColor, {})),
|
|
33
|
+
textAlign(convertRawProp(context, rawProps, "textAlign", sourceProps.textAlign, {RNUITextViewChildTextAlign::Auto})),
|
|
33
34
|
shadowRadius(convertRawProp(context, rawProps, "shadowRadius", sourceProps.shadowRadius, {0.0}))
|
|
34
35
|
{}
|
|
35
36
|
RNUITextViewProps::RNUITextViewProps(
|
|
@@ -38,7 +39,7 @@ RNUITextViewProps::RNUITextViewProps(
|
|
|
38
39
|
const RawProps &rawProps): ViewProps(context, sourceProps, rawProps),
|
|
39
40
|
|
|
40
41
|
numberOfLines(convertRawProp(context, rawProps, "numberOfLines", sourceProps.numberOfLines, {0})),
|
|
41
|
-
|
|
42
|
+
allowFontScaling(convertRawProp(context, rawProps, "allowFontScaling", sourceProps.allowFontScaling, {true})),
|
|
42
43
|
ellipsizeMode(convertRawProp(context, rawProps, "ellipsizeMode", sourceProps.ellipsizeMode, {RNUITextViewEllipsizeMode::Tail})),
|
|
43
44
|
selectable(convertRawProp(context, rawProps, "selectable", sourceProps.selectable, {false})),
|
|
44
45
|
customMenuItems(convertRawProp(context, rawProps, "customMenuItems", sourceProps.customMenuItems, {}))
|
|
@@ -93,6 +93,27 @@ static inline std::string toString(const RNUITextViewChildTextDecorationStyle &v
|
|
|
93
93
|
case RNUITextViewChildTextDecorationStyle::Dashed: return "dashed";
|
|
94
94
|
}
|
|
95
95
|
}
|
|
96
|
+
enum class RNUITextViewChildTextAlign { Auto, Left, Right, Center, Justify };
|
|
97
|
+
|
|
98
|
+
static inline void fromRawValue(const PropsParserContext& context, const RawValue &value, RNUITextViewChildTextAlign &result) {
|
|
99
|
+
auto string = (std::string)value;
|
|
100
|
+
if (string == "auto") { result = RNUITextViewChildTextAlign::Auto; return; }
|
|
101
|
+
if (string == "left") { result = RNUITextViewChildTextAlign::Left; return; }
|
|
102
|
+
if (string == "right") { result = RNUITextViewChildTextAlign::Right; return; }
|
|
103
|
+
if (string == "center") { result = RNUITextViewChildTextAlign::Center; return; }
|
|
104
|
+
if (string == "justify") { result = RNUITextViewChildTextAlign::Justify; return; }
|
|
105
|
+
abort();
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
static inline std::string toString(const RNUITextViewChildTextAlign &value) {
|
|
109
|
+
switch (value) {
|
|
110
|
+
case RNUITextViewChildTextAlign::Auto: return "auto";
|
|
111
|
+
case RNUITextViewChildTextAlign::Left: return "left";
|
|
112
|
+
case RNUITextViewChildTextAlign::Right: return "right";
|
|
113
|
+
case RNUITextViewChildTextAlign::Center: return "center";
|
|
114
|
+
case RNUITextViewChildTextAlign::Justify: return "justify";
|
|
115
|
+
}
|
|
116
|
+
}
|
|
96
117
|
|
|
97
118
|
class RNUITextViewChildProps final : public ViewProps {
|
|
98
119
|
public:
|
|
@@ -112,6 +133,7 @@ class RNUITextViewChildProps final : public ViewProps {
|
|
|
112
133
|
RNUITextViewChildTextDecorationLine textDecorationLine{RNUITextViewChildTextDecorationLine::None};
|
|
113
134
|
RNUITextViewChildTextDecorationStyle textDecorationStyle{RNUITextViewChildTextDecorationStyle::Solid};
|
|
114
135
|
SharedColor textDecorationColor{};
|
|
136
|
+
RNUITextViewChildTextAlign textAlign{RNUITextViewChildTextAlign::Auto};
|
|
115
137
|
Float shadowRadius{0.0};
|
|
116
138
|
};
|
|
117
139
|
|
|
@@ -173,7 +195,7 @@ class RNUITextViewProps final : public ViewProps {
|
|
|
173
195
|
#pragma mark - Props
|
|
174
196
|
|
|
175
197
|
int numberOfLines{0};
|
|
176
|
-
bool
|
|
198
|
+
bool allowFontScaling{true};
|
|
177
199
|
RNUITextViewEllipsizeMode ellipsizeMode{RNUITextViewEllipsizeMode::Tail};
|
|
178
200
|
bool selectable{false};
|
|
179
201
|
std::vector<RNUITextViewCustomMenuItemsStruct> customMenuItems{};
|
|
@@ -10,9 +10,9 @@
|
|
|
10
10
|
|
|
11
11
|
#pragma once
|
|
12
12
|
|
|
13
|
-
#include
|
|
14
|
-
#include
|
|
15
|
-
#include
|
|
13
|
+
#include <react/renderer/components/RNUITextViewSpec/EventEmitters.h>
|
|
14
|
+
#include <react/renderer/components/RNUITextViewSpec/Props.h>
|
|
15
|
+
#include <react/renderer/components/RNUITextViewSpec/States.h>
|
|
16
16
|
#include <react/renderer/components/view/ConcreteViewShadowNode.h>
|
|
17
17
|
#include <jsi/jsi.h>
|
|
18
18
|
|
package/ios/RNUITextView.mm
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
#import "RNUITextView.h"
|
|
2
|
-
#import "
|
|
2
|
+
#import "RNUITextViewShadowNode.h"
|
|
3
3
|
#import "RNUITextViewComponentDescriptor.h"
|
|
4
|
-
|
|
4
|
+
#import "RNUITextViewChild.h"
|
|
5
5
|
#import <React/RCTConversions.h>
|
|
6
6
|
|
|
7
|
-
#import <react-native-uitextview/EventEmitters.h>
|
|
8
|
-
#import <react-native-uitextview/Props.h>
|
|
9
|
-
#import <react-native-uitextview/RCTComponentViewHelpers.h>
|
|
10
7
|
#import <react/renderer/textlayoutmanager/RCTAttributedTextUtils.h>
|
|
11
8
|
#import <objc/runtime.h>
|
|
9
|
+
#import <react/renderer/components/RNUITextViewSpec/EventEmitters.h>
|
|
10
|
+
#import <react/renderer/components/RNUITextViewSpec/Props.h>
|
|
11
|
+
#import <react/renderer/components/RNUITextViewSpec/RCTComponentViewHelpers.h>
|
|
12
|
+
#import <objc/runtime.h>
|
|
12
13
|
#import "RCTFabricComponentsPlugins.h"
|
|
13
14
|
|
|
14
15
|
using namespace facebook::react;
|
|
@@ -90,7 +91,7 @@ using namespace facebook::react;
|
|
|
90
91
|
{
|
|
91
92
|
[super prepareForRecycle];
|
|
92
93
|
_state.reset();
|
|
93
|
-
|
|
94
|
+
|
|
94
95
|
// Reset the frame to zero so that when it properly lays out on the next use
|
|
95
96
|
_textView.frame = CGRectZero;
|
|
96
97
|
_textView.attributedText = nil;
|
|
@@ -110,6 +111,7 @@ using namespace facebook::react;
|
|
|
110
111
|
|
|
111
112
|
const auto attrString = _state->getData().attributedString;
|
|
112
113
|
const auto convertedAttrString = RCTNSAttributedStringFromAttributedString(attrString);
|
|
114
|
+
|
|
113
115
|
_textView.attributedText = convertedAttrString;
|
|
114
116
|
_textView.frame = _view.frame;
|
|
115
117
|
|
|
@@ -146,6 +148,12 @@ using namespace facebook::react;
|
|
|
146
148
|
_textView.selectable = newViewProps.selectable;
|
|
147
149
|
}
|
|
148
150
|
|
|
151
|
+
if (oldViewProps.allowFontScaling != newViewProps.allowFontScaling) {
|
|
152
|
+
if (@available(iOS 11.0, *)) {
|
|
153
|
+
_textView.adjustsFontForContentSizeCategory = newViewProps.allowFontScaling;
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
|
|
149
157
|
if (oldViewProps.ellipsizeMode != newViewProps.ellipsizeMode) {
|
|
150
158
|
if (newViewProps.ellipsizeMode == RNUITextViewEllipsizeMode::Head) {
|
|
151
159
|
_textView.textContainer.lineBreakMode = NSLineBreakMode::NSLineBreakByTruncatingHead;
|
|
@@ -157,6 +165,7 @@ using namespace facebook::react;
|
|
|
157
165
|
_textView.textContainer.lineBreakMode = NSLineBreakMode::NSLineBreakByClipping;
|
|
158
166
|
}
|
|
159
167
|
}
|
|
168
|
+
|
|
160
169
|
|
|
161
170
|
// I'm not sure if this is really the right way to handle this style. This means that the entire _view_ the text
|
|
162
171
|
// is in will have this background color applied. To apply it just to a particular part of a string, you'd need
|
package/ios/RNUITextViewChild.mm
CHANGED
|
@@ -1,12 +1,9 @@
|
|
|
1
|
-
#ifdef RCT_NEW_ARCH_ENABLED
|
|
2
1
|
#import "RNUITextViewChild.h"
|
|
3
2
|
#import "RNUITextView.h"
|
|
4
3
|
#import "RNUITextViewChildComponentDescriptor.h"
|
|
5
|
-
|
|
6
|
-
#import <react
|
|
7
|
-
#import <react
|
|
8
|
-
#import <react-native-uitextview/RCTComponentViewHelpers.h>
|
|
9
|
-
|
|
4
|
+
#import <react/renderer/components/RNUITextViewSpec/EventEmitters.h>
|
|
5
|
+
#import <react/renderer/components/RNUITextViewSpec/Props.h>
|
|
6
|
+
#import <react/renderer/components/RNUITextViewSpec/RCTComponentViewHelpers.h>
|
|
10
7
|
#import "RCTFabricComponentsPlugins.h"
|
|
11
8
|
#import "Utils.h"
|
|
12
9
|
|
|
@@ -45,7 +42,7 @@ using namespace facebook::react;
|
|
|
45
42
|
NSString *text = [NSString stringWithUTF8String:newViewProps.text.c_str()];
|
|
46
43
|
_text = text;
|
|
47
44
|
}
|
|
48
|
-
|
|
45
|
+
|
|
49
46
|
[super updateProps:props oldProps:oldProps];
|
|
50
47
|
}
|
|
51
48
|
|
|
@@ -55,7 +52,7 @@ using namespace facebook::react;
|
|
|
55
52
|
->onPress(facebook::react::RNUITextViewChildEventEmitter::OnPress{});
|
|
56
53
|
}
|
|
57
54
|
}
|
|
58
|
-
|
|
55
|
+
|
|
59
56
|
- (void)onLongPress {
|
|
60
57
|
if (_eventEmitter != nullptr) {
|
|
61
58
|
std::dynamic_pointer_cast<const facebook::react::RNUITextViewChildEventEmitter>(_eventEmitter)
|
|
@@ -73,4 +70,3 @@ Class<RCTComponentViewProtocol> RNUITextViewChildCls(void)
|
|
|
73
70
|
}
|
|
74
71
|
|
|
75
72
|
@end
|
|
76
|
-
#endif
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
#pragma once
|
|
2
2
|
|
|
3
|
-
#include <react
|
|
4
|
-
#include <react
|
|
5
|
-
#include <react
|
|
3
|
+
#include <react/renderer/components/RNUITextViewSpec/EventEmitters.h>
|
|
4
|
+
#include <react/renderer/components/RNUITextViewSpec/Props.h>
|
|
5
|
+
#include <react/renderer/components/RNUITextViewSpec/States.h>
|
|
6
6
|
#include <react/renderer/components/view/ConcreteViewShadowNode.h>
|
|
7
7
|
|
|
8
8
|
namespace facebook::react {
|
|
@@ -6,8 +6,6 @@
|
|
|
6
6
|
|
|
7
7
|
namespace facebook::react {
|
|
8
8
|
|
|
9
|
-
extern const char RNUITextViewComponentName[] = "RNUITextView";
|
|
10
|
-
|
|
11
9
|
RNUITextViewShadowNode::RNUITextViewShadowNode(
|
|
12
10
|
const ShadowNode& sourceShadowNode,
|
|
13
11
|
const ShadowNodeFragment& fragment
|
|
@@ -34,6 +32,12 @@ Size RNUITextViewShadowNode::measureContent(
|
|
|
34
32
|
|
|
35
33
|
auto baseTextAttributes = TextAttributes::defaultTextAttributes();
|
|
36
34
|
baseTextAttributes.backgroundColor = baseProps.backgroundColor;
|
|
35
|
+
baseTextAttributes.allowFontScaling = baseProps.allowFontScaling;
|
|
36
|
+
|
|
37
|
+
Float fontSizeMultiplier = 1.0;
|
|
38
|
+
if (baseTextAttributes.allowFontScaling) {
|
|
39
|
+
fontSizeMultiplier = layoutContext.fontSizeMultiplier;
|
|
40
|
+
}
|
|
37
41
|
|
|
38
42
|
auto baseAttributedString = AttributedString{};
|
|
39
43
|
const auto &children = getChildren();
|
|
@@ -44,9 +48,10 @@ Size RNUITextViewShadowNode::measureContent(
|
|
|
44
48
|
auto fragment = AttributedString::Fragment{};
|
|
45
49
|
auto textAttributes = TextAttributes::defaultTextAttributes();
|
|
46
50
|
|
|
51
|
+
textAttributes.allowFontScaling = baseProps.allowFontScaling;
|
|
47
52
|
textAttributes.backgroundColor = props.backgroundColor;
|
|
48
|
-
textAttributes.fontSize = props.fontSize;
|
|
49
|
-
textAttributes.lineHeight = props.lineHeight;
|
|
53
|
+
textAttributes.fontSize = props.fontSize * fontSizeMultiplier;
|
|
54
|
+
textAttributes.lineHeight = props.lineHeight * fontSizeMultiplier;
|
|
50
55
|
textAttributes.foregroundColor = props.color;
|
|
51
56
|
textAttributes.textShadowColor = props.shadowColor;
|
|
52
57
|
textAttributes.textShadowOffset = props.shadowOffset;
|
|
@@ -95,6 +100,18 @@ Size RNUITextViewShadowNode::measureContent(
|
|
|
95
100
|
textAttributes.textDecorationStyle = TextDecorationStyle::Double;
|
|
96
101
|
}
|
|
97
102
|
|
|
103
|
+
if (props.textAlign == RNUITextViewChildTextAlign::Left) {
|
|
104
|
+
textAttributes.alignment = TextAlignment::Left;
|
|
105
|
+
} else if (props.textAlign == RNUITextViewChildTextAlign::Right) {
|
|
106
|
+
textAttributes.alignment = TextAlignment::Right;
|
|
107
|
+
} else if (props.textAlign == RNUITextViewChildTextAlign::Center) {
|
|
108
|
+
textAttributes.alignment = TextAlignment::Center;
|
|
109
|
+
} else if (props.textAlign == RNUITextViewChildTextAlign::Justify) {
|
|
110
|
+
textAttributes.alignment = TextAlignment::Justified;
|
|
111
|
+
} else if (props.textAlign == RNUITextViewChildTextAlign::Auto) {
|
|
112
|
+
textAttributes.alignment = TextAlignment::Natural;
|
|
113
|
+
}
|
|
114
|
+
|
|
98
115
|
textAttributes.backgroundColor = props.backgroundColor;
|
|
99
116
|
|
|
100
117
|
fragment.string = props.text;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#pragma once
|
|
2
2
|
|
|
3
|
-
#include <react
|
|
4
|
-
#include <react
|
|
3
|
+
#include <react/renderer/components/RNUITextViewSpec/EventEmitters.h>
|
|
4
|
+
#include <react/renderer/components/RNUITextViewSpec/Props.h>
|
|
5
5
|
#include <react/renderer/components/view/ConcreteViewShadowNode.h>
|
|
6
6
|
#include <react/renderer/textlayoutmanager/TextLayoutManager.h>
|
|
7
7
|
#include <react/renderer/core/LayoutContext.h>
|
|
@@ -23,7 +23,7 @@ RNUITextViewEventEmitter,
|
|
|
23
23
|
RNUITextViewStateReal> {
|
|
24
24
|
public:
|
|
25
25
|
using ConcreteViewShadowNode::ConcreteViewShadowNode;
|
|
26
|
-
|
|
26
|
+
|
|
27
27
|
RNUITextViewShadowNode(
|
|
28
28
|
const ShadowNode& sourceShadowNode,
|
|
29
29
|
const ShadowNodeFragment& fragment
|
|
@@ -41,8 +41,8 @@ public:
|
|
|
41
41
|
Size measureContent(
|
|
42
42
|
const LayoutContext& layoutContext,
|
|
43
43
|
const LayoutConstraints& layoutConstraints) const override;
|
|
44
|
-
|
|
44
|
+
|
|
45
45
|
private:
|
|
46
|
-
mutable AttributedString _attributedString;
|
|
46
|
+
mutable AttributedString _attributedString;
|
|
47
47
|
};
|
|
48
48
|
} // namespace facebook::React
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* @generated by codegen project: GenerateComponentDescriptorCpp.js
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
|
-
#include
|
|
11
|
+
#include <react/renderer/components/RNUITextViewSpec/ComponentDescriptors.h>
|
|
12
12
|
#include <react/renderer/core/ConcreteComponentDescriptor.h>
|
|
13
13
|
#include <react/renderer/componentregistry/ComponentDescriptorProviderRegistry.h>
|
|
14
14
|
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
|
|
11
11
|
#pragma once
|
|
12
12
|
|
|
13
|
-
#include
|
|
13
|
+
#include <react/renderer/components/RNUITextViewSpec/ShadowNodes.h>
|
|
14
14
|
#include <react/renderer/core/ConcreteComponentDescriptor.h>
|
|
15
15
|
#include <react/renderer/componentregistry/ComponentDescriptorProviderRegistry.h>
|
|
16
16
|
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* @generated by codegen project: GeneratePropsCpp.js
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
|
-
#include
|
|
11
|
+
#include <react/renderer/components/RNUITextViewSpec/Props.h>
|
|
12
12
|
#include <react/renderer/core/PropsParserContext.h>
|
|
13
13
|
#include <react/renderer/core/propsConversions.h>
|
|
14
14
|
|
|
@@ -30,6 +30,7 @@ RNUITextViewChildProps::RNUITextViewChildProps(
|
|
|
30
30
|
textDecorationLine(convertRawProp(context, rawProps, "textDecorationLine", sourceProps.textDecorationLine, {RNUITextViewChildTextDecorationLine::None})),
|
|
31
31
|
textDecorationStyle(convertRawProp(context, rawProps, "textDecorationStyle", sourceProps.textDecorationStyle, {RNUITextViewChildTextDecorationStyle::Solid})),
|
|
32
32
|
textDecorationColor(convertRawProp(context, rawProps, "textDecorationColor", sourceProps.textDecorationColor, {})),
|
|
33
|
+
textAlign(convertRawProp(context, rawProps, "textAlign", sourceProps.textAlign, {RNUITextViewChildTextAlign::Auto})),
|
|
33
34
|
shadowRadius(convertRawProp(context, rawProps, "shadowRadius", sourceProps.shadowRadius, {0.0}))
|
|
34
35
|
{}
|
|
35
36
|
RNUITextViewProps::RNUITextViewProps(
|
|
@@ -38,7 +39,7 @@ RNUITextViewProps::RNUITextViewProps(
|
|
|
38
39
|
const RawProps &rawProps): ViewProps(context, sourceProps, rawProps),
|
|
39
40
|
|
|
40
41
|
numberOfLines(convertRawProp(context, rawProps, "numberOfLines", sourceProps.numberOfLines, {0})),
|
|
41
|
-
|
|
42
|
+
allowFontScaling(convertRawProp(context, rawProps, "allowFontScaling", sourceProps.allowFontScaling, {true})),
|
|
42
43
|
ellipsizeMode(convertRawProp(context, rawProps, "ellipsizeMode", sourceProps.ellipsizeMode, {RNUITextViewEllipsizeMode::Tail})),
|
|
43
44
|
selectable(convertRawProp(context, rawProps, "selectable", sourceProps.selectable, {false})),
|
|
44
45
|
customMenuItems(convertRawProp(context, rawProps, "customMenuItems", sourceProps.customMenuItems, {}))
|
|
@@ -93,6 +93,27 @@ static inline std::string toString(const RNUITextViewChildTextDecorationStyle &v
|
|
|
93
93
|
case RNUITextViewChildTextDecorationStyle::Dashed: return "dashed";
|
|
94
94
|
}
|
|
95
95
|
}
|
|
96
|
+
enum class RNUITextViewChildTextAlign { Auto, Left, Right, Center, Justify };
|
|
97
|
+
|
|
98
|
+
static inline void fromRawValue(const PropsParserContext& context, const RawValue &value, RNUITextViewChildTextAlign &result) {
|
|
99
|
+
auto string = (std::string)value;
|
|
100
|
+
if (string == "auto") { result = RNUITextViewChildTextAlign::Auto; return; }
|
|
101
|
+
if (string == "left") { result = RNUITextViewChildTextAlign::Left; return; }
|
|
102
|
+
if (string == "right") { result = RNUITextViewChildTextAlign::Right; return; }
|
|
103
|
+
if (string == "center") { result = RNUITextViewChildTextAlign::Center; return; }
|
|
104
|
+
if (string == "justify") { result = RNUITextViewChildTextAlign::Justify; return; }
|
|
105
|
+
abort();
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
static inline std::string toString(const RNUITextViewChildTextAlign &value) {
|
|
109
|
+
switch (value) {
|
|
110
|
+
case RNUITextViewChildTextAlign::Auto: return "auto";
|
|
111
|
+
case RNUITextViewChildTextAlign::Left: return "left";
|
|
112
|
+
case RNUITextViewChildTextAlign::Right: return "right";
|
|
113
|
+
case RNUITextViewChildTextAlign::Center: return "center";
|
|
114
|
+
case RNUITextViewChildTextAlign::Justify: return "justify";
|
|
115
|
+
}
|
|
116
|
+
}
|
|
96
117
|
|
|
97
118
|
class RNUITextViewChildProps final : public ViewProps {
|
|
98
119
|
public:
|
|
@@ -112,6 +133,7 @@ class RNUITextViewChildProps final : public ViewProps {
|
|
|
112
133
|
RNUITextViewChildTextDecorationLine textDecorationLine{RNUITextViewChildTextDecorationLine::None};
|
|
113
134
|
RNUITextViewChildTextDecorationStyle textDecorationStyle{RNUITextViewChildTextDecorationStyle::Solid};
|
|
114
135
|
SharedColor textDecorationColor{};
|
|
136
|
+
RNUITextViewChildTextAlign textAlign{RNUITextViewChildTextAlign::Auto};
|
|
115
137
|
Float shadowRadius{0.0};
|
|
116
138
|
};
|
|
117
139
|
|
|
@@ -173,7 +195,7 @@ class RNUITextViewProps final : public ViewProps {
|
|
|
173
195
|
#pragma mark - Props
|
|
174
196
|
|
|
175
197
|
int numberOfLines{0};
|
|
176
|
-
bool
|
|
198
|
+
bool allowFontScaling{true};
|
|
177
199
|
RNUITextViewEllipsizeMode ellipsizeMode{RNUITextViewEllipsizeMode::Tail};
|
|
178
200
|
bool selectable{false};
|
|
179
201
|
std::vector<RNUITextViewCustomMenuItemsStruct> customMenuItems{};
|
|
@@ -10,9 +10,9 @@
|
|
|
10
10
|
|
|
11
11
|
#pragma once
|
|
12
12
|
|
|
13
|
-
#include
|
|
14
|
-
#include
|
|
15
|
-
#include
|
|
13
|
+
#include <react/renderer/components/RNUITextViewSpec/EventEmitters.h>
|
|
14
|
+
#include <react/renderer/components/RNUITextViewSpec/Props.h>
|
|
15
|
+
#include <react/renderer/components/RNUITextViewSpec/States.h>
|
|
16
16
|
#include <react/renderer/components/view/ConcreteViewShadowNode.h>
|
|
17
17
|
#include <jsi/jsi.h>
|
|
18
18
|
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent'
|
|
2
1
|
import type {ColorValue, ViewProps} from 'react-native'
|
|
3
2
|
import type {
|
|
4
3
|
BubblingEventHandler,
|
|
@@ -6,6 +5,7 @@ import type {
|
|
|
6
5
|
Int32,
|
|
7
6
|
WithDefault,
|
|
8
7
|
} from 'react-native/Libraries/Types/CodegenTypes'
|
|
8
|
+
import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent'
|
|
9
9
|
|
|
10
10
|
interface TargetedEvent {
|
|
11
11
|
target: Int32
|
|
@@ -26,6 +26,8 @@ export type NativeFontWeight =
|
|
|
26
26
|
|
|
27
27
|
type FontStyle = 'normal' | 'italic'
|
|
28
28
|
|
|
29
|
+
type TextAlign = 'auto' | 'left' | 'right' | 'center' | 'justify'
|
|
30
|
+
|
|
29
31
|
interface NativeProps extends ViewProps {
|
|
30
32
|
text: string
|
|
31
33
|
color?: ColorValue
|
|
@@ -38,6 +40,7 @@ interface NativeProps extends ViewProps {
|
|
|
38
40
|
textDecorationLine?: WithDefault<TextDecorationLine, 'none'>
|
|
39
41
|
textDecorationStyle?: WithDefault<TextDecorationStyle, 'solid'>
|
|
40
42
|
textDecorationColor?: ColorValue
|
|
43
|
+
textAlign?: WithDefault<TextAlign, 'auto'>
|
|
41
44
|
shadowRadius?: WithDefault<Float, 0>
|
|
42
45
|
onPress?: BubblingEventHandler<TargetedEvent>
|
|
43
46
|
onLongPress?: BubblingEventHandler<TargetedEvent>
|
|
@@ -1,47 +1,47 @@
|
|
|
1
|
-
import codegenNativeComponent from
|
|
2
|
-
import type {ViewProps} from
|
|
1
|
+
import codegenNativeComponent from "react-native/Libraries/Utilities/codegenNativeComponent";
|
|
2
|
+
import type { ViewProps } from "react-native";
|
|
3
3
|
import type {
|
|
4
4
|
BubblingEventHandler,
|
|
5
5
|
Int32,
|
|
6
6
|
WithDefault,
|
|
7
7
|
DirectEventHandler,
|
|
8
|
-
} from
|
|
8
|
+
} from "react-native/Libraries/Types/CodegenTypes";
|
|
9
9
|
|
|
10
10
|
interface TargetedEvent {
|
|
11
|
-
target: Int32
|
|
11
|
+
target: Int32;
|
|
12
12
|
}
|
|
13
13
|
|
|
14
14
|
interface TextLayoutEvent extends TargetedEvent {
|
|
15
|
-
lines: string[]
|
|
15
|
+
lines: string[];
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
// 自定义菜单项接口
|
|
19
19
|
interface CustomMenuItem {
|
|
20
|
-
title: string
|
|
21
|
-
actionId: string
|
|
20
|
+
title: string;
|
|
21
|
+
actionId: string;
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
// 自定义菜单操作事件
|
|
25
25
|
interface CustomMenuActionEvent extends TargetedEvent {
|
|
26
|
-
actionId: string
|
|
27
|
-
selectedText: string
|
|
26
|
+
actionId: string;
|
|
27
|
+
selectedText: string;
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
-
type EllipsizeMode =
|
|
30
|
+
type EllipsizeMode = "head" | "middle" | "tail" | "clip";
|
|
31
31
|
|
|
32
32
|
interface NativeProps extends ViewProps {
|
|
33
33
|
// 现有属性
|
|
34
|
-
numberOfLines?: Int32
|
|
35
|
-
|
|
36
|
-
ellipsizeMode?: WithDefault<EllipsizeMode,
|
|
37
|
-
selectable?: boolean
|
|
38
|
-
onTextLayout?: BubblingEventHandler<TextLayoutEvent
|
|
34
|
+
numberOfLines?: Int32;
|
|
35
|
+
allowFontScaling?: WithDefault<boolean, true>;
|
|
36
|
+
ellipsizeMode?: WithDefault<EllipsizeMode, "tail">;
|
|
37
|
+
selectable?: boolean;
|
|
38
|
+
onTextLayout?: BubblingEventHandler<TextLayoutEvent>;
|
|
39
39
|
|
|
40
40
|
// 新增自定义菜单属性
|
|
41
|
-
customMenuItems?: ReadonlyArray<CustomMenuItem
|
|
42
|
-
onCustomMenuAction?: DirectEventHandler<CustomMenuActionEvent
|
|
41
|
+
customMenuItems?: ReadonlyArray<CustomMenuItem>;
|
|
42
|
+
onCustomMenuAction?: DirectEventHandler<CustomMenuActionEvent>;
|
|
43
43
|
}
|
|
44
44
|
|
|
45
|
-
export default codegenNativeComponent<NativeProps>(
|
|
46
|
-
excludedPlatforms: [
|
|
47
|
-
})
|
|
45
|
+
export default codegenNativeComponent<NativeProps>("RNUITextView", {
|
|
46
|
+
excludedPlatforms: ["android"],
|
|
47
|
+
});
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent'
|
|
2
1
|
import type {ColorValue, ViewProps} from 'react-native'
|
|
3
2
|
import type {
|
|
4
3
|
BubblingEventHandler,
|
|
@@ -6,6 +5,7 @@ import type {
|
|
|
6
5
|
Int32,
|
|
7
6
|
WithDefault,
|
|
8
7
|
} from 'react-native/Libraries/Types/CodegenTypes'
|
|
8
|
+
import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent'
|
|
9
9
|
|
|
10
10
|
interface TargetedEvent {
|
|
11
11
|
target: Int32
|
|
@@ -26,6 +26,8 @@ export type NativeFontWeight =
|
|
|
26
26
|
|
|
27
27
|
type FontStyle = 'normal' | 'italic'
|
|
28
28
|
|
|
29
|
+
type TextAlign = 'auto' | 'left' | 'right' | 'center' | 'justify'
|
|
30
|
+
|
|
29
31
|
interface NativeProps extends ViewProps {
|
|
30
32
|
text: string
|
|
31
33
|
color?: ColorValue
|
|
@@ -38,6 +40,7 @@ interface NativeProps extends ViewProps {
|
|
|
38
40
|
textDecorationLine?: WithDefault<TextDecorationLine, 'none'>
|
|
39
41
|
textDecorationStyle?: WithDefault<TextDecorationStyle, 'solid'>
|
|
40
42
|
textDecorationColor?: ColorValue
|
|
43
|
+
textAlign?: WithDefault<TextAlign, 'auto'>
|
|
41
44
|
shadowRadius?: WithDefault<Float, 0>
|
|
42
45
|
onPress?: BubblingEventHandler<TargetedEvent>
|
|
43
46
|
onLongPress?: BubblingEventHandler<TargetedEvent>
|
|
@@ -1,47 +1,47 @@
|
|
|
1
|
-
import codegenNativeComponent from
|
|
2
|
-
import type {ViewProps} from
|
|
1
|
+
import codegenNativeComponent from "react-native/Libraries/Utilities/codegenNativeComponent";
|
|
2
|
+
import type { ViewProps } from "react-native";
|
|
3
3
|
import type {
|
|
4
4
|
BubblingEventHandler,
|
|
5
5
|
Int32,
|
|
6
6
|
WithDefault,
|
|
7
7
|
DirectEventHandler,
|
|
8
|
-
} from
|
|
8
|
+
} from "react-native/Libraries/Types/CodegenTypes";
|
|
9
9
|
|
|
10
10
|
interface TargetedEvent {
|
|
11
|
-
target: Int32
|
|
11
|
+
target: Int32;
|
|
12
12
|
}
|
|
13
13
|
|
|
14
14
|
interface TextLayoutEvent extends TargetedEvent {
|
|
15
|
-
lines: string[]
|
|
15
|
+
lines: string[];
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
// 自定义菜单项接口
|
|
19
19
|
interface CustomMenuItem {
|
|
20
|
-
title: string
|
|
21
|
-
actionId: string
|
|
20
|
+
title: string;
|
|
21
|
+
actionId: string;
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
// 自定义菜单操作事件
|
|
25
25
|
interface CustomMenuActionEvent extends TargetedEvent {
|
|
26
|
-
actionId: string
|
|
27
|
-
selectedText: string
|
|
26
|
+
actionId: string;
|
|
27
|
+
selectedText: string;
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
-
type EllipsizeMode =
|
|
30
|
+
type EllipsizeMode = "head" | "middle" | "tail" | "clip";
|
|
31
31
|
|
|
32
32
|
interface NativeProps extends ViewProps {
|
|
33
33
|
// 现有属性
|
|
34
|
-
numberOfLines?: Int32
|
|
35
|
-
|
|
36
|
-
ellipsizeMode?: WithDefault<EllipsizeMode,
|
|
37
|
-
selectable?: boolean
|
|
38
|
-
onTextLayout?: BubblingEventHandler<TextLayoutEvent
|
|
34
|
+
numberOfLines?: Int32;
|
|
35
|
+
allowFontScaling?: WithDefault<boolean, true>;
|
|
36
|
+
ellipsizeMode?: WithDefault<EllipsizeMode, "tail">;
|
|
37
|
+
selectable?: boolean;
|
|
38
|
+
onTextLayout?: BubblingEventHandler<TextLayoutEvent>;
|
|
39
39
|
|
|
40
40
|
// 新增自定义菜单属性
|
|
41
|
-
customMenuItems?: ReadonlyArray<CustomMenuItem
|
|
42
|
-
onCustomMenuAction?: DirectEventHandler<CustomMenuActionEvent
|
|
41
|
+
customMenuItems?: ReadonlyArray<CustomMenuItem>;
|
|
42
|
+
onCustomMenuAction?: DirectEventHandler<CustomMenuActionEvent>;
|
|
43
43
|
}
|
|
44
44
|
|
|
45
|
-
export default codegenNativeComponent<NativeProps>(
|
|
46
|
-
excludedPlatforms: [
|
|
47
|
-
})
|
|
45
|
+
export default codegenNativeComponent<NativeProps>("RNUITextView", {
|
|
46
|
+
excludedPlatforms: ["android"],
|
|
47
|
+
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"App.d.ts","sourceRoot":"","sources":["../../../../../example/src/App.tsx"],"names":[],"mappings":"AAaA,MAAM,CAAC,OAAO,UAAU,GAAG,
|
|
1
|
+
{"version":3,"file":"App.d.ts","sourceRoot":"","sources":["../../../../../example/src/App.tsx"],"names":[],"mappings":"AAaA,MAAM,CAAC,OAAO,UAAU,GAAG,4CAqnB1B"}
|
|
@@ -7,6 +7,7 @@ type TextDecorationLine = 'none' | 'underline' | 'line-through';
|
|
|
7
7
|
type TextDecorationStyle = 'solid' | 'double' | 'dotted' | 'dashed';
|
|
8
8
|
export type NativeFontWeight = 'normal' | 'bold' | 'ultraLight' | 'light' | 'medium' | 'semibold' | 'heavy';
|
|
9
9
|
type FontStyle = 'normal' | 'italic';
|
|
10
|
+
type TextAlign = 'auto' | 'left' | 'right' | 'center' | 'justify';
|
|
10
11
|
interface NativeProps extends ViewProps {
|
|
11
12
|
text: string;
|
|
12
13
|
color?: ColorValue;
|
|
@@ -19,6 +20,7 @@ interface NativeProps extends ViewProps {
|
|
|
19
20
|
textDecorationLine?: WithDefault<TextDecorationLine, 'none'>;
|
|
20
21
|
textDecorationStyle?: WithDefault<TextDecorationStyle, 'solid'>;
|
|
21
22
|
textDecorationColor?: ColorValue;
|
|
23
|
+
textAlign?: WithDefault<TextAlign, 'auto'>;
|
|
22
24
|
shadowRadius?: WithDefault<Float, 0>;
|
|
23
25
|
onPress?: BubblingEventHandler<TargetedEvent>;
|
|
24
26
|
onLongPress?: BubblingEventHandler<TargetedEvent>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RNUITextViewChildNativeComponent.d.ts","sourceRoot":"","sources":["../../../../src/RNUITextViewChildNativeComponent.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"RNUITextViewChildNativeComponent.d.ts","sourceRoot":"","sources":["../../../../src/RNUITextViewChildNativeComponent.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,UAAU,EAAE,SAAS,EAAC,MAAM,cAAc,CAAA;AACvD,OAAO,KAAK,EACV,oBAAoB,EACpB,KAAK,EACL,KAAK,EACL,WAAW,EACZ,MAAM,2CAA2C,CAAA;AAGlD,UAAU,aAAa;IACrB,MAAM,EAAE,KAAK,CAAA;CACd;AAED,KAAK,kBAAkB,GAAG,MAAM,GAAG,WAAW,GAAG,cAAc,CAAA;AAE/D,KAAK,mBAAmB,GAAG,OAAO,GAAG,QAAQ,GAAG,QAAQ,GAAG,QAAQ,CAAA;AAEnE,MAAM,MAAM,gBAAgB,GACxB,QAAQ,GACR,MAAM,GACN,YAAY,GACZ,OAAO,GACP,QAAQ,GACR,UAAU,GACV,OAAO,CAAA;AAEX,KAAK,SAAS,GAAG,QAAQ,GAAG,QAAQ,CAAA;AAEpC,KAAK,SAAS,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,QAAQ,GAAG,SAAS,CAAA;AAEjE,UAAU,WAAY,SAAQ,SAAS;IACrC,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,CAAC,EAAE,UAAU,CAAA;IAClB,QAAQ,CAAC,EAAE,KAAK,CAAA;IAChB,SAAS,CAAC,EAAE,WAAW,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAA;IAC5C,UAAU,CAAC,EAAE,WAAW,CAAC,gBAAgB,EAAE,QAAQ,CAAC,CAAA;IACpD,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,aAAa,CAAC,EAAE,KAAK,CAAA;IACrB,UAAU,CAAC,EAAE,KAAK,CAAA;IAClB,kBAAkB,CAAC,EAAE,WAAW,CAAC,kBAAkB,EAAE,MAAM,CAAC,CAAA;IAC5D,mBAAmB,CAAC,EAAE,WAAW,CAAC,mBAAmB,EAAE,OAAO,CAAC,CAAA;IAC/D,mBAAmB,CAAC,EAAE,UAAU,CAAA;IAChC,SAAS,CAAC,EAAE,WAAW,CAAC,SAAS,EAAE,MAAM,CAAC,CAAA;IAC1C,YAAY,CAAC,EAAE,WAAW,CAAC,KAAK,EAAE,CAAC,CAAC,CAAA;IACpC,OAAO,CAAC,EAAE,oBAAoB,CAAC,aAAa,CAAC,CAAA;IAC7C,WAAW,CAAC,EAAE,oBAAoB,CAAC,aAAa,CAAC,CAAA;CAClD;;AAED,wBAEE"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { ViewProps } from
|
|
2
|
-
import type { BubblingEventHandler, Int32, WithDefault, DirectEventHandler } from
|
|
1
|
+
import type { ViewProps } from "react-native";
|
|
2
|
+
import type { BubblingEventHandler, Int32, WithDefault, DirectEventHandler } from "react-native/Libraries/Types/CodegenTypes";
|
|
3
3
|
interface TargetedEvent {
|
|
4
4
|
target: Int32;
|
|
5
5
|
}
|
|
@@ -14,11 +14,11 @@ interface CustomMenuActionEvent extends TargetedEvent {
|
|
|
14
14
|
actionId: string;
|
|
15
15
|
selectedText: string;
|
|
16
16
|
}
|
|
17
|
-
type EllipsizeMode =
|
|
17
|
+
type EllipsizeMode = "head" | "middle" | "tail" | "clip";
|
|
18
18
|
interface NativeProps extends ViewProps {
|
|
19
19
|
numberOfLines?: Int32;
|
|
20
|
-
|
|
21
|
-
ellipsizeMode?: WithDefault<EllipsizeMode,
|
|
20
|
+
allowFontScaling?: WithDefault<boolean, true>;
|
|
21
|
+
ellipsizeMode?: WithDefault<EllipsizeMode, "tail">;
|
|
22
22
|
selectable?: boolean;
|
|
23
23
|
onTextLayout?: BubblingEventHandler<TextLayoutEvent>;
|
|
24
24
|
customMenuItems?: ReadonlyArray<CustomMenuItem>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RNUITextViewNativeComponent.d.ts","sourceRoot":"","sources":["../../../../src/RNUITextViewNativeComponent.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"RNUITextViewNativeComponent.d.ts","sourceRoot":"","sources":["../../../../src/RNUITextViewNativeComponent.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,KAAK,EACV,oBAAoB,EACpB,KAAK,EACL,WAAW,EACX,kBAAkB,EACnB,MAAM,2CAA2C,CAAC;AAEnD,UAAU,aAAa;IACrB,MAAM,EAAE,KAAK,CAAC;CACf;AAED,UAAU,eAAgB,SAAQ,aAAa;IAC7C,KAAK,EAAE,MAAM,EAAE,CAAC;CACjB;AAGD,UAAU,cAAc;IACtB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;CAClB;AAGD,UAAU,qBAAsB,SAAQ,aAAa;IACnD,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,MAAM,CAAC;CACtB;AAED,KAAK,aAAa,GAAG,MAAM,GAAG,QAAQ,GAAG,MAAM,GAAG,MAAM,CAAC;AAEzD,UAAU,WAAY,SAAQ,SAAS;IAErC,aAAa,CAAC,EAAE,KAAK,CAAC;IACtB,gBAAgB,CAAC,EAAE,WAAW,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;IAC9C,aAAa,CAAC,EAAE,WAAW,CAAC,aAAa,EAAE,MAAM,CAAC,CAAC;IACnD,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,YAAY,CAAC,EAAE,oBAAoB,CAAC,eAAe,CAAC,CAAC;IAGrD,eAAe,CAAC,EAAE,aAAa,CAAC,cAAc,CAAC,CAAC;IAChD,kBAAkB,CAAC,EAAE,kBAAkB,CAAC,qBAAqB,CAAC,CAAC;CAChE;;AAED,wBAEG"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"App.d.ts","sourceRoot":"","sources":["../../../../../example/src/App.tsx"],"names":[],"mappings":"AAaA,MAAM,CAAC,OAAO,UAAU,GAAG,
|
|
1
|
+
{"version":3,"file":"App.d.ts","sourceRoot":"","sources":["../../../../../example/src/App.tsx"],"names":[],"mappings":"AAaA,MAAM,CAAC,OAAO,UAAU,GAAG,4CAqnB1B"}
|
|
@@ -7,6 +7,7 @@ type TextDecorationLine = 'none' | 'underline' | 'line-through';
|
|
|
7
7
|
type TextDecorationStyle = 'solid' | 'double' | 'dotted' | 'dashed';
|
|
8
8
|
export type NativeFontWeight = 'normal' | 'bold' | 'ultraLight' | 'light' | 'medium' | 'semibold' | 'heavy';
|
|
9
9
|
type FontStyle = 'normal' | 'italic';
|
|
10
|
+
type TextAlign = 'auto' | 'left' | 'right' | 'center' | 'justify';
|
|
10
11
|
interface NativeProps extends ViewProps {
|
|
11
12
|
text: string;
|
|
12
13
|
color?: ColorValue;
|
|
@@ -19,6 +20,7 @@ interface NativeProps extends ViewProps {
|
|
|
19
20
|
textDecorationLine?: WithDefault<TextDecorationLine, 'none'>;
|
|
20
21
|
textDecorationStyle?: WithDefault<TextDecorationStyle, 'solid'>;
|
|
21
22
|
textDecorationColor?: ColorValue;
|
|
23
|
+
textAlign?: WithDefault<TextAlign, 'auto'>;
|
|
22
24
|
shadowRadius?: WithDefault<Float, 0>;
|
|
23
25
|
onPress?: BubblingEventHandler<TargetedEvent>;
|
|
24
26
|
onLongPress?: BubblingEventHandler<TargetedEvent>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RNUITextViewChildNativeComponent.d.ts","sourceRoot":"","sources":["../../../../src/RNUITextViewChildNativeComponent.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"RNUITextViewChildNativeComponent.d.ts","sourceRoot":"","sources":["../../../../src/RNUITextViewChildNativeComponent.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,UAAU,EAAE,SAAS,EAAC,MAAM,cAAc,CAAA;AACvD,OAAO,KAAK,EACV,oBAAoB,EACpB,KAAK,EACL,KAAK,EACL,WAAW,EACZ,MAAM,2CAA2C,CAAA;AAGlD,UAAU,aAAa;IACrB,MAAM,EAAE,KAAK,CAAA;CACd;AAED,KAAK,kBAAkB,GAAG,MAAM,GAAG,WAAW,GAAG,cAAc,CAAA;AAE/D,KAAK,mBAAmB,GAAG,OAAO,GAAG,QAAQ,GAAG,QAAQ,GAAG,QAAQ,CAAA;AAEnE,MAAM,MAAM,gBAAgB,GACxB,QAAQ,GACR,MAAM,GACN,YAAY,GACZ,OAAO,GACP,QAAQ,GACR,UAAU,GACV,OAAO,CAAA;AAEX,KAAK,SAAS,GAAG,QAAQ,GAAG,QAAQ,CAAA;AAEpC,KAAK,SAAS,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,QAAQ,GAAG,SAAS,CAAA;AAEjE,UAAU,WAAY,SAAQ,SAAS;IACrC,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,CAAC,EAAE,UAAU,CAAA;IAClB,QAAQ,CAAC,EAAE,KAAK,CAAA;IAChB,SAAS,CAAC,EAAE,WAAW,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAA;IAC5C,UAAU,CAAC,EAAE,WAAW,CAAC,gBAAgB,EAAE,QAAQ,CAAC,CAAA;IACpD,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,aAAa,CAAC,EAAE,KAAK,CAAA;IACrB,UAAU,CAAC,EAAE,KAAK,CAAA;IAClB,kBAAkB,CAAC,EAAE,WAAW,CAAC,kBAAkB,EAAE,MAAM,CAAC,CAAA;IAC5D,mBAAmB,CAAC,EAAE,WAAW,CAAC,mBAAmB,EAAE,OAAO,CAAC,CAAA;IAC/D,mBAAmB,CAAC,EAAE,UAAU,CAAA;IAChC,SAAS,CAAC,EAAE,WAAW,CAAC,SAAS,EAAE,MAAM,CAAC,CAAA;IAC1C,YAAY,CAAC,EAAE,WAAW,CAAC,KAAK,EAAE,CAAC,CAAC,CAAA;IACpC,OAAO,CAAC,EAAE,oBAAoB,CAAC,aAAa,CAAC,CAAA;IAC7C,WAAW,CAAC,EAAE,oBAAoB,CAAC,aAAa,CAAC,CAAA;CAClD;;AAED,wBAEE"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { ViewProps } from
|
|
2
|
-
import type { BubblingEventHandler, Int32, WithDefault, DirectEventHandler } from
|
|
1
|
+
import type { ViewProps } from "react-native";
|
|
2
|
+
import type { BubblingEventHandler, Int32, WithDefault, DirectEventHandler } from "react-native/Libraries/Types/CodegenTypes";
|
|
3
3
|
interface TargetedEvent {
|
|
4
4
|
target: Int32;
|
|
5
5
|
}
|
|
@@ -14,11 +14,11 @@ interface CustomMenuActionEvent extends TargetedEvent {
|
|
|
14
14
|
actionId: string;
|
|
15
15
|
selectedText: string;
|
|
16
16
|
}
|
|
17
|
-
type EllipsizeMode =
|
|
17
|
+
type EllipsizeMode = "head" | "middle" | "tail" | "clip";
|
|
18
18
|
interface NativeProps extends ViewProps {
|
|
19
19
|
numberOfLines?: Int32;
|
|
20
|
-
|
|
21
|
-
ellipsizeMode?: WithDefault<EllipsizeMode,
|
|
20
|
+
allowFontScaling?: WithDefault<boolean, true>;
|
|
21
|
+
ellipsizeMode?: WithDefault<EllipsizeMode, "tail">;
|
|
22
22
|
selectable?: boolean;
|
|
23
23
|
onTextLayout?: BubblingEventHandler<TextLayoutEvent>;
|
|
24
24
|
customMenuItems?: ReadonlyArray<CustomMenuItem>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RNUITextViewNativeComponent.d.ts","sourceRoot":"","sources":["../../../../src/RNUITextViewNativeComponent.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"RNUITextViewNativeComponent.d.ts","sourceRoot":"","sources":["../../../../src/RNUITextViewNativeComponent.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,KAAK,EACV,oBAAoB,EACpB,KAAK,EACL,WAAW,EACX,kBAAkB,EACnB,MAAM,2CAA2C,CAAC;AAEnD,UAAU,aAAa;IACrB,MAAM,EAAE,KAAK,CAAC;CACf;AAED,UAAU,eAAgB,SAAQ,aAAa;IAC7C,KAAK,EAAE,MAAM,EAAE,CAAC;CACjB;AAGD,UAAU,cAAc;IACtB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;CAClB;AAGD,UAAU,qBAAsB,SAAQ,aAAa;IACnD,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,MAAM,CAAC;CACtB;AAED,KAAK,aAAa,GAAG,MAAM,GAAG,QAAQ,GAAG,MAAM,GAAG,MAAM,CAAC;AAEzD,UAAU,WAAY,SAAQ,SAAS;IAErC,aAAa,CAAC,EAAE,KAAK,CAAC;IACtB,gBAAgB,CAAC,EAAE,WAAW,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;IAC9C,aAAa,CAAC,EAAE,WAAW,CAAC,aAAa,EAAE,MAAM,CAAC,CAAC;IACnD,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,YAAY,CAAC,EAAE,oBAAoB,CAAC,eAAe,CAAC,CAAC;IAGrD,eAAe,CAAC,EAAE,aAAa,CAAC,cAAc,CAAC,CAAC;IAChD,kBAAkB,CAAC,EAAE,kBAAkB,CAAC,qBAAqB,CAAC,CAAC;CAChE;;AAED,wBAEG"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dongsuo/react-native-uitextview",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2",
|
|
4
4
|
"description": "Enhanced UITextView for React Native with custom context menu support",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -72,7 +72,7 @@
|
|
|
72
72
|
"prettier": "^3.0.3",
|
|
73
73
|
"react": "19.0.0",
|
|
74
74
|
"react-native": "0.79.2",
|
|
75
|
-
"react-native-builder-bob": "0.40.
|
|
75
|
+
"react-native-builder-bob": "0.40.12",
|
|
76
76
|
"react-native-test-app": "4.0.4",
|
|
77
77
|
"release-it": "^19.0.1",
|
|
78
78
|
"turbo": "^1.10.7",
|
|
@@ -145,8 +145,7 @@
|
|
|
145
145
|
"outputDir": {
|
|
146
146
|
"android": "android/generated",
|
|
147
147
|
"ios": "ios/generated"
|
|
148
|
-
}
|
|
149
|
-
"includesGeneratedCode": true
|
|
148
|
+
}
|
|
150
149
|
},
|
|
151
150
|
"create-react-native-library": {
|
|
152
151
|
"languages": "kotlin-objc",
|
|
@@ -2,6 +2,10 @@ require "json"
|
|
|
2
2
|
|
|
3
3
|
package = JSON.parse(File.read(File.join(__dir__, "package.json")))
|
|
4
4
|
|
|
5
|
+
# Detect whether the new architecture / Fabric is enabled
|
|
6
|
+
new_arch_enabled = ENV['RCT_NEW_ARCH_ENABLED'] == '1'
|
|
7
|
+
|
|
8
|
+
|
|
5
9
|
Pod::Spec.new do |s|
|
|
6
10
|
s.name = "react-native-uitextview"
|
|
7
11
|
s.version = package["version"]
|
|
@@ -13,9 +17,18 @@ Pod::Spec.new do |s|
|
|
|
13
17
|
s.platforms = { :ios => min_ios_version_supported }
|
|
14
18
|
s.source = { :git => "https://github.com/bluesky-social/react-native-uitextview.git", :tag => "#{s.version}" }
|
|
15
19
|
|
|
16
|
-
|
|
20
|
+
# Include module‑authored Obj‑C/Obj‑C++ plus the C++ files that Codegen
|
|
21
|
+
# writes to build/generated/ios during `pod install`
|
|
22
|
+
s.source_files = [
|
|
23
|
+
"ios/**/*.{h,mm,cpp}",
|
|
24
|
+
]
|
|
17
25
|
|
|
18
|
-
s
|
|
26
|
+
install_modules_dependencies(s)
|
|
19
27
|
|
|
20
|
-
|
|
28
|
+
# ---------- Fabric Components (when using frameworks) ----------
|
|
29
|
+
if ENV['USE_FRAMEWORKS'] != nil && new_arch_enabled
|
|
30
|
+
add_dependency(s, "React-FabricComponents", :additional_framework_paths => [
|
|
31
|
+
"react/renderer/textlayoutmanager/platform/ios",
|
|
32
|
+
])
|
|
33
|
+
end
|
|
21
34
|
end
|
package/react-native.config.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent'
|
|
2
1
|
import type {ColorValue, ViewProps} from 'react-native'
|
|
3
2
|
import type {
|
|
4
3
|
BubblingEventHandler,
|
|
@@ -6,6 +5,7 @@ import type {
|
|
|
6
5
|
Int32,
|
|
7
6
|
WithDefault,
|
|
8
7
|
} from 'react-native/Libraries/Types/CodegenTypes'
|
|
8
|
+
import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent'
|
|
9
9
|
|
|
10
10
|
interface TargetedEvent {
|
|
11
11
|
target: Int32
|
|
@@ -26,6 +26,8 @@ export type NativeFontWeight =
|
|
|
26
26
|
|
|
27
27
|
type FontStyle = 'normal' | 'italic'
|
|
28
28
|
|
|
29
|
+
type TextAlign = 'auto' | 'left' | 'right' | 'center' | 'justify'
|
|
30
|
+
|
|
29
31
|
interface NativeProps extends ViewProps {
|
|
30
32
|
text: string
|
|
31
33
|
color?: ColorValue
|
|
@@ -38,6 +40,7 @@ interface NativeProps extends ViewProps {
|
|
|
38
40
|
textDecorationLine?: WithDefault<TextDecorationLine, 'none'>
|
|
39
41
|
textDecorationStyle?: WithDefault<TextDecorationStyle, 'solid'>
|
|
40
42
|
textDecorationColor?: ColorValue
|
|
43
|
+
textAlign?: WithDefault<TextAlign, 'auto'>
|
|
41
44
|
shadowRadius?: WithDefault<Float, 0>
|
|
42
45
|
onPress?: BubblingEventHandler<TargetedEvent>
|
|
43
46
|
onLongPress?: BubblingEventHandler<TargetedEvent>
|
|
@@ -1,47 +1,47 @@
|
|
|
1
|
-
import codegenNativeComponent from
|
|
2
|
-
import type {ViewProps} from
|
|
1
|
+
import codegenNativeComponent from "react-native/Libraries/Utilities/codegenNativeComponent";
|
|
2
|
+
import type { ViewProps } from "react-native";
|
|
3
3
|
import type {
|
|
4
4
|
BubblingEventHandler,
|
|
5
5
|
Int32,
|
|
6
6
|
WithDefault,
|
|
7
7
|
DirectEventHandler,
|
|
8
|
-
} from
|
|
8
|
+
} from "react-native/Libraries/Types/CodegenTypes";
|
|
9
9
|
|
|
10
10
|
interface TargetedEvent {
|
|
11
|
-
target: Int32
|
|
11
|
+
target: Int32;
|
|
12
12
|
}
|
|
13
13
|
|
|
14
14
|
interface TextLayoutEvent extends TargetedEvent {
|
|
15
|
-
lines: string[]
|
|
15
|
+
lines: string[];
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
// 自定义菜单项接口
|
|
19
19
|
interface CustomMenuItem {
|
|
20
|
-
title: string
|
|
21
|
-
actionId: string
|
|
20
|
+
title: string;
|
|
21
|
+
actionId: string;
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
// 自定义菜单操作事件
|
|
25
25
|
interface CustomMenuActionEvent extends TargetedEvent {
|
|
26
|
-
actionId: string
|
|
27
|
-
selectedText: string
|
|
26
|
+
actionId: string;
|
|
27
|
+
selectedText: string;
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
-
type EllipsizeMode =
|
|
30
|
+
type EllipsizeMode = "head" | "middle" | "tail" | "clip";
|
|
31
31
|
|
|
32
32
|
interface NativeProps extends ViewProps {
|
|
33
33
|
// 现有属性
|
|
34
|
-
numberOfLines?: Int32
|
|
35
|
-
|
|
36
|
-
ellipsizeMode?: WithDefault<EllipsizeMode,
|
|
37
|
-
selectable?: boolean
|
|
38
|
-
onTextLayout?: BubblingEventHandler<TextLayoutEvent
|
|
34
|
+
numberOfLines?: Int32;
|
|
35
|
+
allowFontScaling?: WithDefault<boolean, true>;
|
|
36
|
+
ellipsizeMode?: WithDefault<EllipsizeMode, "tail">;
|
|
37
|
+
selectable?: boolean;
|
|
38
|
+
onTextLayout?: BubblingEventHandler<TextLayoutEvent>;
|
|
39
39
|
|
|
40
40
|
// 新增自定义菜单属性
|
|
41
|
-
customMenuItems?: ReadonlyArray<CustomMenuItem
|
|
42
|
-
onCustomMenuAction?: DirectEventHandler<CustomMenuActionEvent
|
|
41
|
+
customMenuItems?: ReadonlyArray<CustomMenuItem>;
|
|
42
|
+
onCustomMenuAction?: DirectEventHandler<CustomMenuActionEvent>;
|
|
43
43
|
}
|
|
44
44
|
|
|
45
|
-
export default codegenNativeComponent<NativeProps>(
|
|
46
|
-
excludedPlatforms: [
|
|
47
|
-
})
|
|
45
|
+
export default codegenNativeComponent<NativeProps>("RNUITextView", {
|
|
46
|
+
excludedPlatforms: ["android"],
|
|
47
|
+
});
|
/package/android/generated/{jni → android/app/build/generated/source/codegen/jni}/CMakeLists.txt
RENAMED
|
File without changes
|
|
File without changes
|
/package/android/generated/{jni → android/app/build/generated/source/codegen/jni}/RNUITextViewSpec.h
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
/package/ios/generated/{RNUITextViewSpec → build/generated/ios/RNUITextViewSpec}/RNUITextViewSpec.h
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|