Skip to content

Requesting for this change in _handleFigureClick #74

@leroyvaughan

Description

@leroyvaughan

I don't like the fact that clicking an image opens the URL in a new window. I'm not sure how to create my own NPM package using yours and don't have the time to remove any reference to you in the module and replace it with reference to me.

I tried to override it using my own module class, but it's not working:

newMod.jsx
`
import newMod from 'react-coverflow';

delete newMod["_handleFigureClick"];

newMod._handleFigureClick = { method below with small change };

export default newMod
`

image-carousel-page.jsx
`
import CoverFlow from '../components/newMod';

{yada, yada, yada}
`

I thought that maybe Radium was the problem, so I did this...but that didn't work either:

newMod.jsx
`
import Radium from 'radium';

import newMod from 'react-coverflow';

delete newMod["_handleFigureClick"];

newMod._handleFigureClick = { method below with small change };

export default Radium(newMod)
`

Here is the small change I'm requesting:

`
._handleFigureClick = (index, action, e) => {

if (!this.props.clickable) {
    e.preventDefault();
    return;
}
if (this.state.current === index) {
    // If on the active figure
    if (typeof action === 'string') {
        // If action is a URL (string), follow the link
        **document.location.href = action;** //<-- HERE ####
    }

    this._removePointerEvents();
} else {
    // Move to the selected figure
    e.preventDefault();
    const { displayQuantityOfSide } = this.props;
    const { width } = this.state;
    const baseWidth = width / (displayQuantityOfSide * 2 + 1);
    const distance = this._center() - index;
    const move = distance * baseWidth;
    this.setState({ current: index, move });
}

};
`

Thanks for any help you can provide.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions