Datepicker for React-Strap
Asked Answered
J

2

12

I am using react-strap npm package to use Bootstrap 4 components in my React app.

When I try to add the datepicker react-bootstrap-date-picker

npm install --save react-bootstrap-date-picker

then try to use it in my component:

var DatePicker = require("react-bootstrap-date-picker");

I get the error

Error in ./~/react-bootstrap-date-picker/lib/index.js

Module not found: 'react-bootstrap/lib/Button' in C:\Users\y\Desktop\Code\test\node_modules\react-bootstrap-date-picker\lib

@ ./~/react-bootstrap-date-picker/lib/index.js 15:14-51

Is this because react-bootstrap-date-picker is not compatible with react-strap? In this case, which npm packages should I install for bootstrap 4 components so that the datepicker module can work?

Jules answered 13/11, 2017 at 18:56 Comment(0)
C
9

react-bootstrap-date-picker is using react-bootstrap, react-bootstrap depends on bootstrap3. reactstrap is for bootstrap4 That is why it doesnt work.

You can use react-widgets DateTimePicker instead.

Caine answered 15/11, 2017 at 7:41 Comment(0)
B
3

You have now available reactstrap-date-picker, which is heavily based on react-bootstrap-date-picker, but ready for the reactstrap world.

Disclaimer: I'm the author of the library.

Although still in first 0.* versions, I'm using it successfully on my projects and, as soon as I receive feedback enough, it'll be 1.0 and considered production-ready.

Basia answered 6/3, 2020 at 22:32 Comment(3)
reactstrap-date-picker is not working with latest reactstrap versionAlexia
@Laxminarayan, looks like we have the same issue.Yearning
reactstrap-date-picker should work also with latest Reactstrap. If not working for you, don't hesitate to add an issue: github.com/afialapis/reactstrap-date-picker/issues. Thanks!Basia

© 2022 - 2024 — McMap. All rights reserved.