Skip to content

Commit ec717fe

Browse files
committed
Clean up and refactor
1 parent e70019e commit ec717fe

File tree

3 files changed

+3
-12
lines changed

3 files changed

+3
-12
lines changed

src/components/TextInput/BaseTextInput.js

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,7 @@ class BaseTextInput extends Component {
190190
const hasLabel = Boolean(this.props.label.length);
191191
const inputHelpText = this.props.errorText || this.props.hint;
192192
const formHelpStyles = this.props.errorText ? styles.formError : styles.formHelp;
193+
const placeholder = (this.props.prefixCharacter || this.state.isFocused || !hasLabel || (hasLabel && this.props.forceActiveLabel)) ? this.props.placeholder : null;
193194
const textInputContainerStyles = _.reduce([
194195
styles.textInputContainer,
195196
...this.props.textInputContainerStyles,
@@ -251,16 +252,7 @@ class BaseTextInput extends Component {
251252
// eslint-disable-next-line
252253
{...inputProps}
253254
defaultValue={this.state.value}
254-
placeholder={
255-
(
256-
this.props.prefixCharacter
257-
|| this.state.isFocused
258-
|| !hasLabel
259-
|| (hasLabel && this.props.forceActiveLabel)
260-
)
261-
? this.props.placeholder
262-
: null
263-
}
255+
placeholder={placeholder}
264256
placeholderTextColor={themeColors.placeholderText}
265257
underlineColorAndroid="transparent"
266258
style={[

src/components/TextInput/baseTextInputPropTypes.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@ const propTypes = {
5757
prefixCharacter: PropTypes.string,
5858

5959
/** Form props */
60-
6160
/** Indicates that the input is being used with the Form component */
6261
isFormInput: PropTypes.bool,
6362

src/stories/Composer.stories.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@ const parser = new ExpensiMark();
2525
const Default = (args) => {
2626
const [pastedFile, setPastedFile] = useState(null);
2727
const [comment, setComment] = useState(args.defaultValue);
28-
const renderedHTML = parser.replace(comment);
2928
const [droppingFile, setDroppingFile] = useState(false);
3029
const [isComposerDroppingTarget, setIsComposerDroppingTarget] = useState(false);
30+
const renderedHTML = parser.replace(comment);
3131

3232
return (
3333
<View>

0 commit comments

Comments
 (0)