Skip to content

Commit b1d7d7a

Browse files
authored
Merge pull request #4 from meecodebymariomurrent/feature/update-placeholder
Added placeholder state and update for placeholder
2 parents a377159 + e6b13a6 commit b1d7d7a

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

lib/RNTextInput.tsx

+6-2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import {
77
ViewStyle,
88
TextStyle,
99
ImageStyle,
10-
ViewProps,
1110
TextInputProps,
1211
} from "react-native";
1312
import RNBounceable, {
@@ -50,13 +49,18 @@ const RNTextInput: React.FC<IRNTextInputProps> = ({
5049
onPress,
5150
...props
5251
}) => {
52+
const [placeholderText, setPlaceholderText] = React.useState<string | undefined>(placeholder);
53+
React.useEffect(() => {
54+
setPlaceholderText(placeholder)
55+
}, []);
56+
5357
const renderContent = () => (
5458
<View style={styles.contentContainer}>
5559
<TextInput
5660
placeholderTextColor="#ead4ff"
5761
{...props}
5862
ref={inputRef}
59-
placeholder={placeholder}
63+
placeholder={placeholderText}
6064
style={[styles.textInputStyle, textInputStyle]}
6165
/>
6266
{!disableButton && (

0 commit comments

Comments
 (0)