尝试使用语义组件时出错

时间:2018-08-23 14:46:10

标签: javascript typescript semantic-ui-react

我正在尝试使用语义UI React Transition组件。我已经安装了语义并将其导入:

import { 
  Transition,
 } from "semantic-ui-react";

import 'semantic-ui-css/semantic.min.css';

当我尝试使用它时:

return (
  <div> 
    {
      <div>
      <Transition
        visible={this.state.shouldShowMessageBar}
        animation="scale"
        duration={500}>
          <MessageBar
            messageBarType={ this.state.messageBarStatus.type }
            onDismiss={ () => this.setState({ shouldShowMessageBar: false }) }
          >
            { this.state.messageBarStatus.description }
          </MessageBar>
       </Transition>

      .../

      </div>
    }
  </div>
);

它发出警告:

Warning - [webpack] 'dist':
./node_modules/semantic-ui-react/dist/es/lib/shallowEqual.js
There are multiple modules with names that only differ in casing.
This can lead to unexpected behavior when compiling on a filesystem with other case-semantic.
Use equal casing. Compare these module identifiers:
* C:\...\Dev\truckDeliverySchedule\node_modules\source-map-loader\index.js!C:\...\Dev\truckDeliverySchedule\node_modules\semantic-ui-react\dist\es\lib\shallowEqual.js
    Used by 1 module(s), i. e.
    C:\...\Dev\truckDeliverySchedule\node_modules\source-map-loader\index.js!C:\...\Dev\truckDeliverySchedule\node_modules\semantic-ui-react\dist\es\lib\index.js
* C:\...\Dev\truckDeliverySchedule\node_modules\source-map-loader\index.js!C:\...\Dev\truckDeliverySchedule\node_modules\semantic-ui-react\dist\es\lib\shallowequal.js
    Used by 2 module(s), i. e.
    C:\...\Dev\truckDeliverySchedule\node_modules\source-map-loader\index.js!C:\...\Dev\truckDeliverySchedule\node_modules\semantic-ui-react\dist\es\lib\shallowEqual.js

我还导入了大约十二个Office UI Fabric React组件:

../
import { 
  Dialog,
  DialogType,
  DialogFooter,
} from 'office-ui-fabric-react/lib/dialog';
import { 
  MessageBar,
  MessageBarType,
} from 'office-ui-fabric-react/lib/messageBar';
../

我不确定该错误是想说什么还是如何解决。

编辑:

├─ webpack-dev-middleware@1.12.2
├─ webpack-sources@1.1.0
├─ webpack-stream@4.0.3
├─ webpack@3.11.0

...

├─ semantic-ui-css@2.3.3
├─ semantic-ui-react@0.82.3

...

├─ react-dom@15.6.2
├─ react@15.6.2

1 个答案:

答案 0 :(得分:0)

您正在使用旧版本的React。 SUIR had a breaking change at 0.82.0 updating to React 16+。您需要使用SUIR 0.81.0或将您的React版本更新到16+。