Reputation: 111
I'm using React-date-picker for my Reactjs App.When i tested date picker option on mobile,keyboard also appearing. i tried some this.but it is not solve my issue.
<DatePicker onChange={this.bidHandleChangeStart}
value={this.state.startDate} name="startDate" maxDate={new Date()} customInput={<CustomInput />} />
const CustomInput = React.forwardRef((props,ref) => {
return (
<input
readOnly={true}
/>
)
})
Upvotes: 3
Views: 1782
Reputation: 1336
I had the same problem in the past and fixed by @Oleg.
Here is an example. I think it's helpful to you.
import { Keyboard } from 'react-native';
...
<Input caretHidden onFocus={(e) => Keyboard.dismiss()} />
...
Upvotes: 0
Reputation: 313
Try forcing the blur when receiving focus. I don't know React but something like:-
onFocus={this.blur()}
Upvotes: 1
Reputation: 13906
You can solve the problem using the keyboard
module.
Example
import {Keyboard} from 'react-native';
...
componentDidMount() {
this.keyboardDidShowListener = Keyboard.addListener(
'keyboardDidShow',
this._keyboardDidShow,
);
}
componentWillUnmount() {
this.keyboardDidShowListener.remove();
}
_keyboardDidShow() {
alert('Keyboard Shown');
Keyboard.dismiss()
}
Upvotes: 2