@react-native-ohos/react-native-text-input-mask 3.1.6-rc.3 → 3.1.6-rc.4
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/harmony/text_input_mask/oh-package.json5 +1 -1
- package/harmony/text_input_mask/src/main/cpp/RNTextInputMask.cpp +2 -2
- package/harmony/text_input_mask/src/main/cpp/common/Mask.h +4 -1
- package/harmony/text_input_mask/src/main/cpp/common/model/Notation.h +5 -0
- package/harmony/text_input_mask.har +0 -0
- package/package.json +1 -1
|
@@ -47,7 +47,7 @@ void myEventReceiver(ArkUI_NodeEvent *event) {
|
|
|
47
47
|
bool useAutoskip = isDelete ? userData->maskOptions.autoskip.value() : false;
|
|
48
48
|
|
|
49
49
|
// onChange 事件
|
|
50
|
-
if (eventId ==
|
|
50
|
+
if (eventId == userData->node) {
|
|
51
51
|
std::shared_ptr<CaretString::CaretGravity> caretGravity = nullptr;
|
|
52
52
|
if (isDelete) {
|
|
53
53
|
caretGravity = std::make_shared<CaretString::Backward>(useAutoskip);
|
|
@@ -199,7 +199,7 @@ void RNTextInputMask::setMask(int reactNode, std::string primaryFormat, MaskOpti
|
|
|
199
199
|
.node = reactNode,
|
|
200
200
|
.instance = this});
|
|
201
201
|
NativeNodeApi::getInstance()->registerNodeEvent(textInputNode->getArkUINodeHandle(), NODE_TEXT_INPUT_ON_CHANGE,
|
|
202
|
-
|
|
202
|
+
reactNode, textInputNode);
|
|
203
203
|
NativeNodeApi::getInstance()->registerNodeEvent(textInputNode->getArkUINodeHandle(), NODE_ON_FOCUS, 111,
|
|
204
204
|
textInputNode);
|
|
205
205
|
this->m_userDatas.insert(userData);
|
|
@@ -42,6 +42,9 @@ public:
|
|
|
42
42
|
this->initialState = Compiler(this->customNotations).compile(this->format);
|
|
43
43
|
}
|
|
44
44
|
|
|
45
|
+
bool hasSameCustomNotations(const std::vector<Notation>& targetNotations) const {
|
|
46
|
+
return this->customNotations == targetNotations;
|
|
47
|
+
}
|
|
45
48
|
|
|
46
49
|
class MaskFactory {
|
|
47
50
|
public:
|
|
@@ -60,7 +63,7 @@ public:
|
|
|
60
63
|
static std::shared_ptr<Mask> getOrCreate(const std::string &format,
|
|
61
64
|
const std::vector<Notation> &customNotations) {
|
|
62
65
|
auto cachedMask = maskCache.find(format);
|
|
63
|
-
if (cachedMask == maskCache.end()) {
|
|
66
|
+
if (cachedMask == maskCache.end() || !cachedMask->second->hasSameCustomNotations(customNotations)) {
|
|
64
67
|
auto newMask = std::make_shared<Mask>(format, customNotations);
|
|
65
68
|
maskCache[format] = newMask;
|
|
66
69
|
return newMask;
|
|
@@ -21,5 +21,10 @@ public:
|
|
|
21
21
|
bool isOptional; // 是否可选
|
|
22
22
|
|
|
23
23
|
// 其他方法和成员可以根据需要添加
|
|
24
|
+
bool operator==(const Notation& other) const {
|
|
25
|
+
return (this->character == other.character) &&
|
|
26
|
+
(this->characterSet == other.characterSet) &&
|
|
27
|
+
(this->isOptional == other.isOptional);
|
|
28
|
+
}
|
|
24
29
|
};
|
|
25
30
|
} // namespace TinpMask
|
|
Binary file
|