From bd59e7b23d88f6e8ff33dc6fe1ae7a8985b5fa55 Mon Sep 17 00:00:00 2001 From: Tide Date: Tue, 20 Dec 2022 23:46:33 +0000 Subject: [PATCH] fix: Added support for Selection color & Placeholder Syle --- src/TextInput/index.tsx | 16 +++++++++++++++- src/TextInput/model.ts | 1 + 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/src/TextInput/index.tsx b/src/TextInput/index.tsx index 0738198..7d0e664 100644 --- a/src/TextInput/index.tsx +++ b/src/TextInput/index.tsx @@ -42,6 +42,7 @@ const TextInputComponent: InputProps = (props) => { numeric, textError, focusColor, + selectionColor, onFocus, onBlur, onChangeText = (_value: string) => {}, @@ -176,6 +177,18 @@ const TextInputComponent: InputProps = (props) => { } }, [isFocus, text.length, label, focusColor, labelStyle, placeholderStyle]); + const stylePlaceholder: StyleProp = useMemo(() => { + if (!isFocus || (text.length <=0 && placeholder)) { + const style: any = placeholderStyle; + return { + position: 'absolute', + ...style, + }; + } else { + return; + } + }, [isFocus, text.length, placeholder]); + return ( <> @@ -188,10 +201,11 @@ const TextInputComponent: InputProps = (props) => { ) => void; onBlur?: (e: NativeSyntheticEvent) => void; renderRightIcon?: () => JSX.Element | null | undefined;