diff --git a/frameworks/bridge/declarative_frontend/engine/jsi/nativeModule/arkts_native_text_area_bridge.cpp b/frameworks/bridge/declarative_frontend/engine/jsi/nativeModule/arkts_native_text_area_bridge.cpp index d657b536aa3..1463efc8a73 100644 --- a/frameworks/bridge/declarative_frontend/engine/jsi/nativeModule/arkts_native_text_area_bridge.cpp +++ b/frameworks/bridge/declarative_frontend/engine/jsi/nativeModule/arkts_native_text_area_bridge.cpp @@ -461,6 +461,7 @@ ArkUINativeModuleValue TextAreaBridge::SetShowCounter(ArkUIRuntimeCallInfo *runt thresholdValue = thresholdArg->Int32Value(vm); if (thresholdValue < MINI_VALID_VALUE || thresholdValue > MAX_VALID_VALUE) { thresholdValue = static_cast(ILLEGAL_VALUE); + showCounter = false; } } GetArkUINodeModifiers()->getTextAreaModifier()->setTextAreaShowCounterOptions( diff --git a/frameworks/bridge/declarative_frontend/engine/jsi/nativeModule/arkts_native_text_input_bridge.cpp b/frameworks/bridge/declarative_frontend/engine/jsi/nativeModule/arkts_native_text_input_bridge.cpp index 2ebfaf1b063..aa102d8eed8 100644 --- a/frameworks/bridge/declarative_frontend/engine/jsi/nativeModule/arkts_native_text_input_bridge.cpp +++ b/frameworks/bridge/declarative_frontend/engine/jsi/nativeModule/arkts_native_text_input_bridge.cpp @@ -1497,6 +1497,7 @@ ArkUINativeModuleValue TextInputBridge::SetShowCounter(ArkUIRuntimeCallInfo* run thresholdValue = thresholdArg->Int32Value(vm); if (thresholdValue < MINI_VALID_VALUE || thresholdValue > MAX_VALID_VALUE) { thresholdValue = ILLEGAL_VALUE; + showCounter = false; } } GetArkUINodeModifiers()->getTextInputModifier()->setTextInputShowCounter( diff --git a/frameworks/bridge/declarative_frontend/jsview/js_textfield.cpp b/frameworks/bridge/declarative_frontend/jsview/js_textfield.cpp index 86e0af732e2..b97cc4aef56 100644 --- a/frameworks/bridge/declarative_frontend/jsview/js_textfield.cpp +++ b/frameworks/bridge/declarative_frontend/jsview/js_textfield.cpp @@ -1394,7 +1394,7 @@ void JSTextField::SetShowCounter(const JSCallbackInfo& info) static_cast(inputNumber) > MAX_VAILD_VALUE) { LOGI("The info is wrong, it is supposed to be a right number"); TextFieldModel::GetInstance()->SetCounterType(ILLEGAL_VALUE); - TextFieldModel::GetInstance()->SetShowCounter(jsValue->ToBoolean()); + TextFieldModel::GetInstance()->SetShowCounter(false); return; } TextFieldModel::GetInstance()->SetShowCounter(jsValue->ToBoolean());