ywana-core8 0.0.580 → 0.0.581

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
1
  import 'material-design-icons-iconfont/dist/material-design-icons.css';
2
- import React, { useState, useContext, useEffect, Fragment, useRef, useMemo, Children } from 'react';
2
+ import React, { useState, useEffect, useContext, Fragment, useRef, useMemo, Children } from 'react';
3
3
  import RSwitch from 'react-switch';
4
4
  import moment$1 from 'moment';
5
5
  import { extendMoment } from 'moment-range';
@@ -198,18 +198,25 @@ var Accordion = function Accordion(props) {
198
198
  sections = _props$sections === void 0 ? [] : _props$sections,
199
199
  onCheck = props.onCheck;
200
200
 
201
- var _useState = useState(sections.map(function (section) {
202
- return section.open;
203
- })),
201
+ var _useState = useState([]),
204
202
  openSections = _useState[0],
205
203
  setOpenSections = _useState[1];
206
204
 
207
- var _useState2 = useState(sections.map(function (section) {
208
- return section.checked;
209
- })),
205
+ var _useState2 = useState([]),
210
206
  checkedSections = _useState2[0],
211
207
  setCheckedSections = _useState2[1];
212
208
 
209
+ useEffect(function () {
210
+ var openSections = sections.map(function (section) {
211
+ return section.open;
212
+ });
213
+ var checkedSections = sections.map(function (section) {
214
+ return section.checked;
215
+ });
216
+ setOpenSections(openSections);
217
+ setCheckedSections(checkedSections);
218
+ }, [sections]);
219
+
213
220
  function toggle(index) {
214
221
  var next = openSections.map(function (open, i) {
215
222
  return i === index ? !open : open;