Skip to content

Commit 0c29346

Browse files
authored
feat(pattern-input-mode): added pattern and inputMode props (#39)
1 parent f7fb57f commit 0c29346

File tree

6 files changed

+17
-7
lines changed

6 files changed

+17
-7
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,8 @@ const props = {
9090
| disabled | bool | When present, it specifies that the element should be disabled. |
9191
| autoFocus | bool | Setup autofocus on the first input, `true` by default. |
9292
| filterKeyCodes | array | Filter characters on key down. |
93+
| pattern | string | The pattern prop specifies a regular expression that the <input> element's value is checked against. |
94+
| inputMode | string | The inputMode prop tells the browser on devices with dynamic keyboards which keyboard to display. |
9395

9496
## Compatible with
9597
[`redux-form`](https://github.com/erikras/redux-form) from [erikras](https://github.com/erikras)

example/dist/example.js

Lines changed: 3 additions & 3 deletions
Large diffs are not rendered by default.

example/dist/example.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/ReactCodeInput.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/ReactCodeInput.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/ReactCodeInput.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ class ReactCodeInput extends Component {
194194
}
195195

196196
render() {
197-
const { className, style = {}, inputStyle = {}, inputStyleInvalid = {}, type, autoFocus } = this.props,
197+
const { className, style = {}, inputStyle = {}, inputStyleInvalid = {}, type, autoFocus, pattern, inputMode } = this.props,
198198
{ disabled, input, isValid, defaultInputStyle } = this.state,
199199
styles = {
200200
container: style,
@@ -257,6 +257,8 @@ class ReactCodeInput extends Component {
257257
onKeyDown={(e) => this.handleKeyDown(e)}
258258
disabled={disabled}
259259
data-valid={isValid}
260+
pattern={pattern}
261+
inputMode={inputMode}
260262
/>
261263
);
262264
})}
@@ -292,6 +294,12 @@ ReactCodeInput.propTypes = {
292294
inputStyleInvalid: PropTypes.object,
293295
autoFocus: PropTypes.bool,
294296
filterKeyCodes: PropTypes.array,
297+
pattern: PropTypes.string,
298+
inputMode: PropTypes.oneOf([
299+
'verbatim', 'latin', 'latin-name', 'latin-prose',
300+
'full-width-latin', 'kana', 'kana-name', 'katakana',
301+
'numeric', 'tel', 'email', 'url',
302+
]),
295303
};
296304

297305
export default ReactCodeInput;

0 commit comments

Comments
 (0)