Atakan Savaş
Atakan Savaş

Reputation: 185

ReactJs Bootstrap Validation Error

When i include react-bootstrap-validation v "^0.1.11" i get the following error. My page imports like this;

import React, { Component } from 'react';
import { Grid, Row, Col, Image, Button } from 'react-bootstrap';
import {withRouter} from "react-router-dom";
import contactImage from './../images/contact-img.png';
import { Form, ValidatedInput } from 'react-bootstrap-validation';

page error looks like this

If i remove last line, page works correctly. And my package.json looks like this;

{
 "name": "coinepo-frontend",
 "version": "0.1.0",
 "private": true,
 "dependencies": {
   "babel-loader": "^7.1.2",
   "babel-preset-es2015": "^6.24.1",
   "babel-preset-react": "^6.24.1",
   "bootstrap": "^3.3.7",
   "history": "^4.7.2",
   "moment": "^2.20.1",
   "prop-types": "^15.6.0",
   "react": "^16.2.0",
   "react-bootstrap": "^0.32.1",
   "react-bootstrap-validation": "^0.1.11",
   "react-dom": "^16.2.0",
   "react-redux": "^5.0.7",
   "react-router": "^4.2.0",
   "react-router-dom": "^4.2.2",
   "react-scripts": "1.1.1",
   "redux": "^3.7.2",
   "redux-logger": "^3.0.6",
   "redux-thunk": "^2.2.0"
 },
 "scripts": {
   "start": "react-scripts start",
   "build": "react-scripts build",
   "test": "react-scripts test --env=jsdom",
   "eject": "react-scripts eject"
 }
}

Anyone can help me? Thank you all.

Upvotes: 0

Views: 596

Answers (1)

Abdennour TOUMI
Abdennour TOUMI

Reputation: 93183

You should downgrade "react-bootstrap": "^0.32.1", to version before <0.30.0

Anything under react-bootstrap <0.30.0 works . For example 0.29.5.

For more info, check this link

The reason is

If you look at version 0.30.0 of React Bootstrap, there is no component named Input, but in React Bootstrap Validation v0.1.11 for the ValidatedInput component, there is a reference to the Input component, which leads to an error: super expression must be null or a function

https://github.com/heilhead/react-bootstrap-validation/pull/67#issuecomment-235331997

Upvotes: 1

Related Questions