Revize 8ff3394e
Přidáno uživatelem Fantič před více než 1 rok
src/components/item/ItemView.tsx | ||
---|---|---|
12 | 12 |
import { getItemNotes } from "../../stores/actions/itemThunks" |
13 | 13 | |
14 | 14 |
import { Dimensions } from "react-native"; |
15 |
import { DrawerNavigationProp } from "@react-navigation/drawer" |
|
16 |
import { RootDrawerParamList } from "../../pages/Navigation" |
|
15 | 17 | |
16 | 18 |
interface ItemDetailProps { |
17 | 19 |
item: Item, |
18 | 20 |
itemLoading: boolean, |
19 | 21 |
notes: Note[], |
20 | 22 |
notesLoading: boolean, |
21 |
navigation: any
|
|
23 |
navigation: DrawerNavigationProp<RootDrawerParamList, "Item", undefined>
|
|
22 | 24 |
} |
23 | 25 | |
24 | 26 |
const ItemDetail = (props: { item: Item, itemLoading: boolean }) => { |
... | ... | |
26 | 28 | |
27 | 29 |
const [selectedImage, setSelectedImage] = useState<number>(0); |
28 | 30 | |
29 |
console.log("rerender") |
|
30 | ||
31 | 31 |
return (<> |
32 | 32 |
{ |
33 | 33 |
item && props.itemLoading ? |
... | ... | |
137 | 137 | |
138 | 138 | |
139 | 139 | |
140 |
const ItemNotes = (props: { item: Item, notes: Note[], notesLoading: boolean, navigation: any }) => {
|
|
140 |
const ItemNotes = (props: { item: Item, notes: Note[], notesLoading: boolean, navigation: DrawerNavigationProp<RootDrawerParamList, "Item", undefined> }) => {
|
|
141 | 141 | |
142 | 142 |
const [showRelatedComments, setShowRelatedComments] = useState(true); |
143 | 143 | |
... | ... | |
152 | 152 |
dispatch(getItemNotes({ item: props.item, relatedComments: showRelatedComments })); |
153 | 153 |
} |
154 | 154 |
}, [triggerRefresh]) |
155 | ||
156 |
const toggleRelatedComments = () => { |
|
155 |
|
|
156 |
const toggleRelatedComments = useCallback(() => {
|
|
157 | 157 |
if (!props.notesLoading) { |
158 | 158 | |
159 | 159 |
let value = !showRelatedComments; |
... | ... | |
161 | 161 |
setShowRelatedComments(value); |
162 | 162 |
dispatch(getItemNotes({ item: props.item, relatedComments: value })); |
163 | 163 |
} |
164 |
} |
|
164 |
}, [showRelatedComments]); |
|
165 | ||
165 | 166 | |
166 | 167 |
const handleCreateItemComment = useCallback( |
167 | 168 |
(newComment: string, replyingTo: { messageId: string; userName: string } | null) => { |
Také k dispozici: Unified diff
re #10819 ItemView next, previous item list switching