Fix crash when creating tag inside meme editor
Signed-off-by: Nikolaos Karaolidis <nick@karaolidis.com>
This commit is contained in:
@@ -87,6 +87,8 @@ const MemeTagSearchModal = ({
|
|||||||
[search],
|
[search],
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const [refreshKey, setRefreshKey] = useState(0);
|
||||||
|
|
||||||
const handleTagPress = (tag: Tag) => {
|
const handleTagPress = (tag: Tag) => {
|
||||||
const id = tag.id.toHexString();
|
const id = tag.id.toHexString();
|
||||||
memeTags.delete(id) || memeTags.set(id, tag);
|
memeTags.delete(id) || memeTags.set(id, tag);
|
||||||
@@ -105,6 +107,7 @@ const MemeTagSearchModal = ({
|
|||||||
if (!tag) return;
|
if (!tag) return;
|
||||||
memeTags.set(tag.id.toHexString(), tag);
|
memeTags.set(tag.id.toHexString(), tag);
|
||||||
setMemeTags(new Map(memeTags));
|
setMemeTags(new Map(memeTags));
|
||||||
|
setRefreshKey(refreshKey + 1);
|
||||||
flashListRef.current?.prepareForLayoutAnimationRender();
|
flashListRef.current?.prepareForLayoutAnimationRender();
|
||||||
LayoutAnimation.configureNext(tagLayoutAnimation);
|
LayoutAnimation.configureNext(tagLayoutAnimation);
|
||||||
};
|
};
|
||||||
@@ -129,6 +132,7 @@ const MemeTagSearchModal = ({
|
|||||||
/>
|
/>
|
||||||
<FlashList
|
<FlashList
|
||||||
ref={flashListRef}
|
ref={flashListRef}
|
||||||
|
key={refreshKey}
|
||||||
data={tags}
|
data={tags}
|
||||||
extraData={memeTags}
|
extraData={memeTags}
|
||||||
keyExtractor={tag => tag.id.toHexString()}
|
keyExtractor={tag => tag.id.toHexString()}
|
||||||
|
Reference in New Issue
Block a user