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],
|
||||
);
|
||||
|
||||
const [refreshKey, setRefreshKey] = useState(0);
|
||||
|
||||
const handleTagPress = (tag: Tag) => {
|
||||
const id = tag.id.toHexString();
|
||||
memeTags.delete(id) || memeTags.set(id, tag);
|
||||
@@ -105,6 +107,7 @@ const MemeTagSearchModal = ({
|
||||
if (!tag) return;
|
||||
memeTags.set(tag.id.toHexString(), tag);
|
||||
setMemeTags(new Map(memeTags));
|
||||
setRefreshKey(refreshKey + 1);
|
||||
flashListRef.current?.prepareForLayoutAnimationRender();
|
||||
LayoutAnimation.configureNext(tagLayoutAnimation);
|
||||
};
|
||||
@@ -129,6 +132,7 @@ const MemeTagSearchModal = ({
|
||||
/>
|
||||
<FlashList
|
||||
ref={flashListRef}
|
||||
key={refreshKey}
|
||||
data={tags}
|
||||
extraData={memeTags}
|
||||
keyExtractor={tag => tag.id.toHexString()}
|
||||
|
Reference in New Issue
Block a user