bear-junior / react-native-draganddrop-board

👆DragAndDropBoard is a simple React Native library, enabling to create a scrollable board component with carousel, sortable columns and draggable cards for your iOS and Android apps
191 stars 47 forks source link

TypeError: Cannot read property 'y' of undefined #16

Closed TacticCoder closed 4 years ago

TacticCoder commented 4 years ago
class AdminDeliveries extends React.PureComponent {
    constructor(props: any) {
        super(props);

    }
    componentDidUpdate(prevProps, prevState, snapshot) {
        if (prevProps.deliveryInfo.loading !== this.props.deliveryInfo.loading) {
            console.log('changed')
              //boardRepository.registry.updateData(data)
        }
    }

    componentDidMount() {
        /*   const {
              getDeliveryListNow,
              getCourierListNow,
              getCourierDeliveryListNow,
          } = this.props;
          getDeliveryListNow(false);
          getCourierListNow();
          getCourierDeliveryListNow(); */
    }
    render() {
        const { deliveryInfo, courierList } = this.props;

        console.log('[Admins Delivery] courierList', Object.values(courierList.courierDeliveryList));

        const data = [
            {
                id: 1,
                name: 'משלוחים פנויים',
                rows: [{
                    id: '1',
                    name: 'Draw from drawings',
                    description: 'Learn from the masters by copying them'
                },
                {
                    id: '2',
                    name: 'Draw from photographs',
                    description: 'For most people, it’s easier to reproduce an image that’s already two-dimensional'
                }],
            },
            {
                id: 2,
                name: ' פנויים',
                rows: [{
                    id: '3',
                    name: 'Draw from drawings',
                    description: 'Learn from the masters by copying them'
                },
                {
                    id: '4',
                    name: 'Draw from photographs',
                    description: 'For most people, it’s easier to reproduce an image that’s already two-dimensional'
                }],
            },
            //  ...Object.values(courierList.courierDeliveryList)

        ];
        const boardRepository = new BoardRepository([]);
        return (
            <View style={{ flex: 1 }} collapsable={true}>
                <Board
                    boardRepository={boardRepository}
                    open={() => { }}
                    onDragEnd={(srcColumnId, destColumnId, draggedItem) => {

                    }}
                    badgeBackgroundColor="#18212e"
                    columnNameTextColor="#18212e"
                    boardBackground="#18212e"

                />
            </View>
        );
    }
};
const mapDipatchToProps = (dispatch: Dispatch) => ({
    getDeliveryListNow: async (byBusiness: boolean) => {
        await dispatch(getDeliveryList(byBusiness));
    },
    getCourierListNow: async () => {
        await dispatch(getCourierList());
    },
    getCourierDeliveryListNow: async () => {
        await dispatch(getCourierDeliveryList());
    },
});

const mapStateToProps = (state: any) => ({
    deliveryInfo: { ...state.deliveryInfo },
    courierList: { ...state.courierInfo },

});
const ConnectedComponent = connect(mapStateToProps, mapDipatchToProps)(AdminDeliveries);

export {
    ConnectedComponent as AdminDeliveries,
};

Hey, as you see I just implement this board. when i use the UI(drag) I get this error: 'TypeError: Cannot read property 'y' of undefined', important to note that this component is inside Stack navigator, and when i load this component not inside the navigator i get this wired error.