Monday, 17 April 2017

React Horizontal Timeline distance of undefined error

I'm trying to use React Horizontal Timeline in my react app but I'm getting that error (pointing to line # 379 of react-horizontal-timeline.js):

Uncaught TypeError: Cannot read property 'distance' of undefined

My code includes:

import React, { Component } from 'react';
import HorizontalTimeline from 'react-horizontal-timeline';

class Foo extends Component {
    state = {
        value : '01-01-1990',
        previous: 0
    };
    render(){
        const VALUES = ['20-04-1991'];
        return(){
            <HorizontalTimeline 
            values={VALUES} 
            indexClick={(index) => {
                this.setState({value: index, previous: this.state.value});
            }} />
            <div className='text-center'>
                {this.state.value}
            </div>
        }
    }
}
export default Foo;

Can somebody please identify the real issue or alternatively suggest some good option for horizontal timeline for react?



via adi

No comments:

Post a Comment