Skip to content

Commit

Permalink
Merge pull request #33221 from margelo/perunt/indentation-text-input
Browse files Browse the repository at this point in the history
Rename style container for the TextInput
  • Loading branch information
mountiny authored Jan 5, 2024
2 parents 393f2be + 2015c6a commit c6bbff1
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 6 deletions.
6 changes: 3 additions & 3 deletions src/components/AmountTextInput.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ const propTypes = {
style: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.object), PropTypes.object]),

/** Style for the container */
containerStyles: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.object), PropTypes.object]),
touchableInputWrapperStyle: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.object), PropTypes.object]),

/** Function to call to handle key presses in the text input */
onKeyPress: PropTypes.func,
Expand All @@ -44,7 +44,7 @@ const defaultProps = {
onSelectionChange: () => {},
onKeyPress: () => {},
style: {},
containerStyles: {},
touchableInputWrapperStyle: {},
};

function AmountTextInput(props) {
Expand All @@ -67,7 +67,7 @@ function AmountTextInput(props) {
onSelectionChange={props.onSelectionChange}
role={CONST.ROLE.PRESENTATION}
onKeyPress={props.onKeyPress}
containerStyles={[...StyleUtils.parseStyleAsArray(props.containerStyles)]}
touchableInputWrapperStyle={props.touchableInputWrapperStyle}
/>
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ const propTypes = {
/** Customize the TextInput container */
textInputContainerStyles: PropTypes.arrayOf(PropTypes.object),

/** Customizes the touchable wrapper of the TextInput component */
touchableInputWrapperStyle: PropTypes.arrayOf(PropTypes.object),

/** Customize the main container */
containerStyles: PropTypes.arrayOf(PropTypes.object),

Expand Down
3 changes: 2 additions & 1 deletion src/components/TextInput/BaseTextInput/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ function BaseTextInput(
errorText = '',
icon = null,
textInputContainerStyles,
touchableInputWrapperStyle,
containerStyles,
inputStyle,
forceActiveLabel = false,
Expand Down Expand Up @@ -287,7 +288,7 @@ function BaseTextInput(
style={[
autoGrowHeight && styles.autoGrowHeightInputContainer(textInputHeight, variables.componentSizeLarge, typeof maxHeight === 'number' ? maxHeight : 0),
!isMultiline && styles.componentHeightLarge,
containerStyles,
touchableInputWrapperStyle,
]}
>
<View
Expand Down
3 changes: 3 additions & 0 deletions src/components/TextInput/BaseTextInput/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ type CustomBaseTextInputProps = {
/** Customize the TextInput container */
textInputContainerStyles?: StyleProp<ViewStyle>;

/** Customizes the touchable wrapper of the TextInput component */
touchableInputWrapperStyle?: StyleProp<ViewStyle>;

/** Customize the main container */
containerStyles?: StyleProp<ViewStyle>;

Expand Down
4 changes: 2 additions & 2 deletions src/components/TimePicker/TimePicker.js
Original file line number Diff line number Diff line change
Expand Up @@ -469,7 +469,7 @@ function TimePicker({forwardedRef, defaultValue, onSubmit, onInputChange}) {
setSelectionHour(e.nativeEvent.selection);
}}
style={styles.timePickerInput}
containerStyles={[styles.timePickerHeight100]}
touchableInputWrapperStyle={styles.timePickerHeight100}
selection={selectionHour}
showSoftInputOnFocus={false}
/>
Expand Down Expand Up @@ -497,7 +497,7 @@ function TimePicker({forwardedRef, defaultValue, onSubmit, onInputChange}) {
setSelectionMinute(e.nativeEvent.selection);
}}
style={styles.timePickerInput}
containerStyles={[styles.timePickerHeight100]}
touchableInputWrapperStyle={styles.timePickerHeight100}
selection={selectionMinute}
showSoftInputOnFocus={false}
/>
Expand Down

0 comments on commit c6bbff1

Please sign in to comment.