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: undefined is not an object (evaluating '_this.listeners[columnId][event]' #19

Closed blindvalentine closed 3 years ago

blindvalentine commented 4 years ago

Hi, I'm experiencing the following error

TypeError: undefined is not an object (evaluating '_this.listeners[columnId][event]'

whenever I drag an item away from its initial position. What does this error refer to? I tried logging the listeners object within the BoardRepository component and it returns an empty object. Thanks in advance!

Screenshot 2020-10-20 at 11 43 00 PM
TacticCoder commented 4 years ago

Hey, can you please attach your code and the Tech stack?

tomasiturralde commented 4 years ago

Hi, i'm having the same issue as blindvalentine. I'm using the basic example given on the readme, and my react native version is 0.62.2. Is there anything i'm missing that should be added to the basic example to make it work?

Edit to add: from what i've been testing, the problem seems to be (at least in my case) with using a state hook. I commented every piece of code besides the basic example, and then uncommented piece by piece to see what was generating the error. The result i arrived to was that when i call the setter method for the state hook, something is happening that is breaking the board. For reference this is the code that, when fully uncommented, break the board and generates the error shown on the original post (at least in my case, that is what generates this). image

Second edit: I tried using a class instead of a functional component, same result, when i call setState, that makes the board break

ariesbrylle-bms commented 3 years ago

Same issue here.

ariesbrylle-bms commented 3 years ago

I was able to solve the problem. The problem occurs once the board is loaded then an update in the data happens.

Here's how I updated my data.

` useEffect(() => { boardRepository.updateData(boardData); }, [boardData]);

let boardRepository = new BoardRepository([]); `

TacticCoder commented 3 years ago

Great job, this method is partly mentioned in the readme. Closed for now.

ariesbrylle-bms commented 3 years ago

Re-opening this issue. When I fixed the problem, this problem occurs -- https://github.com/bear-junior/react-native-draganddrop-board/issues/28

ariesbrylle-bms commented 3 years ago

Were you able to fix the issue @tomasiturralde @blindvalentine ?

ariesbrylle-bms commented 3 years ago

image

Luke-Mueller commented 3 years ago

Has anyone seen any progress on this issue?