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
190 stars 48 forks source link

Board data is not showing once loaded then going back again to the screen. #28

Open ariesbrylle-bms opened 3 years ago

ariesbrylle-bms commented 3 years ago

Here's how to replicate the issue:

  1. Go to board screen: Board is successfully loaded. image

  2. Leave the board screen.

  3. Go back again to the board screen: Board is not loaded.

image

But once I reloaded the app, it's working again.

Here's my code for the creation and updating of the board.

// create let boardRepository = new BoardRepository(); or let boardRepository = new BoardRepository([]);

// update useEffect(() => { if (boardData.length > 0) { console.log("should update data"); boardRepository.updateData(boardData); } }, [boardData]);

Note: it always logged "should update data" so it means that there's data that should be loaded.

ariesbrylle-bms commented 3 years ago

When I console log the board data, the map object has the items and its column item.

ariesbrylle-bms commented 3 years ago

Hi @TacticCoder, really need your help here. Thank you.

TacticCoder commented 3 years ago

Please post your code.

ariesbrylle-bms commented 3 years ago

Please post your code.

@TacticCoder

This is how I initialized my boardRepository

const boardRepository = new BoardRepository([]);

This is how I update the data

useEffect(() => { if (boardData.length > 0) { console.log("should update data"); boardRepository.updateData(boardData); } }, [boardData]);

And this is my component {boardData.length > 0 ? ( <Board boardRepository={boardRepository} open={(data) => { console.log(data); }} onDragEnd={(srcColumnId, destColumnId, draggedItem) => { console.log(srcColumnId, destColumnId, draggedItem.attributes.id); // console.log(state.info_boards[destColumnId - 1]); }} boardBackground={CONSTANTS.OFFICIAL_BG_COLOR} cardNameTextColor={CONSTANTS.PRIMARY_COLOR} cardIconColor={CONSTANTS.PRIMARY_COLOR} badgeBackgroundColor={CONSTANTS.PRIMARY_COLOR} columnNameTextColor={CONSTANTS.PRIMARY_COLOR} emptyIconColor={CONSTANTS.PRIMARY_COLOR} emptyText="No Issue on this Board." ref={boardRef} /> ) : ( <View style={{ height: "100%" }}>

No Board
    </View>
  )}
ariesbrylle-bms commented 3 years ago

Were you able to replicate the issue @TacticCoder ? :)

cenaHara commented 3 years ago

hi @TacticCoder same issue , Have you solved this problem yet ? @ariesbrylle-bms

ariesbrylle-bms commented 3 years ago

hi @TacticCoder same issue , Have you solved this problem yet ? @ariesbrylle-bms

No, I wasn't able to solve the problem yet.

If I initialized the board like this

<Board boardRepository={new BoardRepository(boardData)} open={(data) => { }}

    />

I experience this issue https://github.com/bear-junior/react-native-draganddrop-board/issues/19

However, I used my code above (comments above) I experience this issue.

ariesbrylle-bms commented 3 years ago

Hello, any help please :) Thank you. I really can't figure out what's wrong with it :)