chore: fix icon picker state not changing in tag context menu
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import { classNames } from '@standardnotes/utils'
|
||||
import { EmojiString, Platform, VectorIconNameOrEmoji } from '@standardnotes/snjs'
|
||||
import { ForwardedRef, forwardRef, useCallback, useMemo, useRef, useState } from 'react'
|
||||
import { ForwardedRef, forwardRef, useCallback, useEffect, useMemo, useRef, useState } from 'react'
|
||||
import Dropdown from '../Dropdown/Dropdown'
|
||||
import { DropdownItem } from '../Dropdown/DropdownItem'
|
||||
import { getEmojiLength } from './EmojiLength'
|
||||
@@ -75,6 +75,10 @@ const IconPicker = ({ selectedValue, onIconChange, platform, className, useIconG
|
||||
const [currentType, setCurrentType] = useState<IconPickerType>(isSelectedEmoji ? 'emoji' : 'icon')
|
||||
const [emojiInputValue, setEmojiInputValue] = useState(isSelectedEmoji ? selectedValue : '')
|
||||
|
||||
useEffect(() => {
|
||||
setEmojiInputValue(isSelectedEmoji ? selectedValue : '')
|
||||
}, [isSelectedEmoji, selectedValue])
|
||||
|
||||
const selectTab = (type: IconPickerType | 'reset') => {
|
||||
if (type === 'reset') {
|
||||
onIconChange(undefined)
|
||||
|
||||
Reference in New Issue
Block a user