yaodingyd/react-flickity-component

can't remove arrows on settings update

franmastromarino opened this issue · 2 comments

Hello mate
thanks for this wonderfull component
i'm facing an issue when i try to update the component options to show/hide the dots
the component is triggerin the componentDidUpdate but the dots are always visible

import classnames from "classnames";
import Flickity from "./react-flickity-component"
import SliderContainer from './slider-container';
import { Component, createRef } from '@wordpress/element';
import { Button } from '@wordpress/components';

/**

  • WordPress dependencies
    */

import { withSelect } from '@wordpress/data';

class sliderWithOptions extends Component {

constructor(props) {
    super(props)
}

render() {

    const {
        load,
        attributes,
        children,
    } = this.props;

    const {
    } = attributes

    if (!load) {
        return null;
    }

    const settings = {
        pageDots: pageDots, 
    }

    /* console.log('settings: ',settings); */

    return [
        <SliderContainer {...this.props}>
            <Flickity 
                className={classnames(
                    "is-carousel",
                    `test-post__columns-${columns}`,
                    attributes.equalHeight && `test-post__height-100`,
                    "test-post__items"
                )}
                reloadOnUpdate
                options={settings}
                flickityRef={c => this.flkty = c}
            >
                {children}
            </Flickity >
        </SliderContainer>
    ];
}

}`

Can you use codesandbox.io to create a test case?

Will reopen with sandbox.