You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Not exactly an issue, but could you elaborate on how to use the 'boardRepository.updateData(data);'. It seems that after I update the dictionary object 'data' with a new value and try and update this using a button press, data is not getting updated.
`
import { StatusBar } from 'expo-status-bar';
import React, {useState} from 'react';
import { SafeAreaView, StyleSheet, Text, View, Image, TextInput, TouchableOpacity } from 'react-native';
// @ts-ignore
import { BoardRepository, Board } from 'react-native-draganddrop-board';
const boardRepository = new BoardRepository(data);
const addTask = (taskName) =>{
console.log("Adding task");
data[0].idcount = data[0].idcount + 1;
console.log("Step 1 done");
var task = {id: data[0].idcount.toString(), name:taskName};
console.log("Step 2 done");
data[0].rows.push(task);
console.log("Step 3 done");
console.log(data);
boardRepository.updateData(data); // THIS IS THE LINE WHERE I UPDATE, THE BOARD IS NOT RE-RENDERING
}
Not exactly an issue, but could you elaborate on how to use the 'boardRepository.updateData(data);'. It seems that after I update the dictionary object 'data' with a new value and try and update this using a button press, data is not getting updated.
`
import { StatusBar } from 'expo-status-bar';
import React, {useState} from 'react';
import { SafeAreaView, StyleSheet, Text, View, Image, TextInput, TouchableOpacity } from 'react-native';
// @ts-ignore
import { BoardRepository, Board } from 'react-native-draganddrop-board';
export default function App() {
const [txt,setTxt] = useState("");
var data = [
{
id: 1,
name: 'TO DO',
idcount: 0,
rows: []
},
{
id: 2,
name: 'IN PROGRESS',
idcount: 0,
rows: []
},
{
id: 3,
name: 'DONE',
idcount: 0,
rows: []
}
]
const boardRepository = new BoardRepository(data);
const addTask = (taskName) =>{
console.log("Adding task");
data[0].idcount = data[0].idcount + 1;
console.log("Step 1 done");
var task = {id: data[0].idcount.toString(), name:taskName};
console.log("Step 2 done");
data[0].rows.push(task);
console.log("Step 3 done");
console.log(data);
boardRepository.updateData(data); // THIS IS THE LINE WHERE I UPDATE, THE BOARD IS NOT RE-RENDERING
}
return (
<Image style ={{ transform:[{scale:0.27}],}} source = {require('./assets/Kanban-board-1.png')}>
<Board
boardRepository={boardRepository}
open={() => {}}
onPress={() => {}}
onDragEnd={() => {}}
/>
<TextInput style={styles.input}
onChangeText={newText => setTxt(newText)}
placeholder="Enter new to do task here" />
<TouchableOpacity
onPress={() => {
addTask(txt);
}}>
<Image source = {require('./assets/add_task.png')}>
);
}
`
The text was updated successfully, but these errors were encountered: