yaodingyd / react-flickity-component

A React.js component for using @desandro's Flickity
314 stars 51 forks source link

can't remove arrows on settings update #105

Closed franmastromarino closed 3 years ago

franmastromarino commented 4 years ago

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';

/**

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>
    ];
}

}`

yaodingyd commented 4 years ago

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

yaodingyd commented 3 years ago

Will reopen with sandbox.