Skip to content

Commit

Permalink
Merge pull request #65 from ishanAhuja/patch-1
Browse files Browse the repository at this point in the history
Add keyboardAppearance prop to TextInput child
  • Loading branch information
BeckyWu220 authored May 7, 2020
2 parents b259c6f + 111e18a commit dc5fef8
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ const styles = StyleSheet.create({
| onCodeChanged | NO | Callback when the digits are changed |
| onCodeFilled | NO | Callback when the last digit is entered |
| secureTextEntry | NO | Hide contents of text fields |
| keyboardAppearance | NO | Keyboard appearance ('default', 'dark', 'light') |
| keyboardType | NO | Keyboard type |
| clearInputs | NO | Clear inputs after entering code |
| placeholderCharacter | NO | The character/string that will be used as placeholder in the individual code input fields |
Expand Down
4 changes: 3 additions & 1 deletion index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ export default class OTPInputView extends Component<InputProps, OTPInputViewStat
pinCount: 6,
autoFocusOnLoad: true,
secureTextEntry: false,
keyboardAppearance: "default",
keyboardType: "number-pad",
clearInputs: false,
placeholderCharacter: "",
Expand Down Expand Up @@ -179,7 +180,7 @@ export default class OTPInputView extends Component<InputProps, OTPInputViewStat
}

renderOneInputField = (_: TextInput, index: number) => {
const { codeInputFieldStyle, codeInputHighlightStyle, secureTextEntry, keyboardType, selectionColor } = this.props
const { codeInputFieldStyle, codeInputHighlightStyle, secureTextEntry, keyboardType, selectionColor, keyboardAppearance } = this.props
const { defaultTextFieldStyle } = styles
const { selectedIndex, digits } = this.state
const { clearInputs, placeholderCharacter, placeholderTextColor } = this.props
Expand All @@ -196,6 +197,7 @@ export default class OTPInputView extends Component<InputProps, OTPInputViewStat
}}
onKeyPress={({ nativeEvent: { key } }) => { this.handleKeyPressTextInput(index, key) }}
value={ !clearInputs ? digits[index]: "" }
keyboardAppearance={keyboardAppearance}
keyboardType={keyboardType}
textContentType={isAutoFillSupported ? "oneTimeCode" : "none"}
key={index}
Expand Down

0 comments on commit dc5fef8

Please sign in to comment.