Skip to content

Commit 33a98b4

Browse files
jalavosusarthurdenner
authored andcommitted
feat(datepicker): Add readOnly as a supported Form.Input prop (#23)
* Add `readOnly` as a supported `Form.Input` prop. This will allow for the datepicker to be used on mobile devices without the device's virtual keyboard opening. * Add `basic readOnly` example to the storybook. This was mainly to test that my change worked, but is also a good way to demonstrate the `readOnly` prop in action. * Update README.md to reflect new `readOnly` prop support.
1 parent ac79626 commit 33a98b4

File tree

3 files changed

+8
-0
lines changed

3 files changed

+8
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ More examples [here](https://react-semantic-ui-datepickers.now.sh).
9595
- placeholder
9696
- size
9797
- transparent
98+
- readOnly
9899

99100
### Dayzed Props
100101

src/components/datepicker.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ const semanticInputProps = [
4848
'required',
4949
'size',
5050
'transparent',
51+
'readOnly',
5152
];
5253

5354
class SemanticDatepicker extends React.Component {
@@ -70,6 +71,7 @@ class SemanticDatepicker extends React.Component {
7071
type: PropTypes.oneOf(['basic', 'range']),
7172
pointing: PropTypes.oneOf(['left', 'right', 'top left', 'top right']),
7273
filterDate: PropTypes.func,
74+
readOnly: PropTypes.bool,
7375
};
7476

7577
static defaultProps = {

stories/index.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,11 @@ storiesOf('Examples', module)
3030
<SemanticDatepicker onDateChange={console.log} />
3131
</Content>
3232
))
33+
.add('Basic Readonly', () => (
34+
<Content>
35+
<SemanticDatepicker onDateChange={console.log} readOnly={true} />
36+
</Content>
37+
))
3338
.add('Basic with allowOnlyNumbers', () => (
3439
<Content>
3540
<SemanticDatepicker allowOnlyNumbers onDateChange={console.log} />

0 commit comments

Comments
 (0)