Skip to content
Merged
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
10 changes: 9 additions & 1 deletion src/components/MagicCodeInput.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ const propTypes = {

/** Function to call when the input is submitted or fully complete */
onFulfill: PropTypes.func,

/** Specifies if the input has a validation error */
hasError: PropTypes.bool,
};

const defaultProps = {
Expand All @@ -50,6 +53,7 @@ const defaultProps = {
innerRef: null,
onChangeText: () => {},
onFulfill: () => {},
hasError: false,
};

/**
Expand Down Expand Up @@ -263,7 +267,11 @@ function MagicCodeInput(props) {
key={index}
style={[styles.w15]}
>
<View style={[styles.textInputContainer, focusedIndex === index ? styles.borderColorFocus : {}]}>
<View style={[
styles.textInputContainer,
focusedIndex === index ? styles.borderColorFocus : {},
props.hasError || props.errorText ? styles.borderColorDanger : {},

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because we added the error styling at the last, it overrides the focus style. This caused a regression here

]}>
<Text style={[styles.magicCodeInput, styles.textAlignCenter]}>{decomposeString(props.value)[index] || ''}</Text>
</View>
<View style={[StyleSheet.absoluteFillObject, styles.w100, styles.opacity0]}>
Expand Down