Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/components/Input/InputTextBase/InputTextBase.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ export const InputTextBase = memo<
({
state,
clearable = true,
onClear,
secureTextEntry: secureTextEntryProp = false,
inputRef: propsInputRef,
disabled,
Expand Down Expand Up @@ -115,8 +116,9 @@ export const InputTextBase = memo<
)

const clear = useCallback(() => {
onClear?.()
onChangeText('')
}, [onChangeText])
}, [onChangeText, onClear])

const value = useMemo(
() => otherProps.value ?? valueState,
Expand Down
4 changes: 4 additions & 0 deletions src/components/Input/InputTextBase/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ export interface InputTextBaseProps extends Omit<
* @default true
*/
clearable?: boolean
/**
* Функция вызываемая при очистке поля
*/
onClear?: () => void
/**
* Управление режимом скрытия текста
* - `true` — всегда скрывать (как в TextInput)
Expand Down
Loading