Setzen Sie explizit W- [96px] (oder ähnlich), um der Breite von zwei Schaltflächen zu entsprechen, obwohl diese Art von Funktionen eine billige Lösung ist, und ich möchte wissen, wie man es richtig macht.
Code: Select all
import { View, TextInput, FlatList, Pressable } from 'react-native'
import { SafeAreaView } from 'react-native-safe-area-context';
import React, { useState } from 'react'
import { Plus, Pencil, X } from 'lucide-react-native';
import ReanimatedSwipeable from 'react-native-gesture-handler/ReanimatedSwipeable';
const Home = () => {
type Todo = {
_id: string;
text: string;
completed: boolean;
};
const [todos, setTodos] = useState([]);
const handleAddTodo = () => {
const newTodo = {
_id: Date.now().toString(),
text: '',
completed: false
}
setTodos(prev => [...prev, newTodo]);
}
const renderRightActions = () => (
);
return (
item._id}
ItemSeparatorComponent={() => }
renderItem={({ item }) => (
{
setTodos(prevTodos =>
prevTodos.map(todo =>
todo._id === item._id ? { ...todo, text } : todo
)
);
}}
/>
)}
/>
)
}
export default Home