Add useEffect
This commit is contained in:
parent
210716a83b
commit
829f7d15d7
|
@ -18,8 +18,6 @@ type Story = StoryObj<typeof meta>
|
||||||
|
|
||||||
export const Default: Story = {
|
export const Default: Story = {
|
||||||
args: {
|
args: {
|
||||||
valueOf: () => {
|
isVisibleState: true,
|
||||||
return true
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,12 +1,17 @@
|
||||||
import { useState } from 'react'
|
import { useEffect, useState } from 'react'
|
||||||
import { XStack, YStack } from 'tamagui'
|
import { XStack, YStack } from 'tamagui'
|
||||||
import { ClearIcon } from '@status-im/icons'
|
import { ClearIcon } from '@status-im/icons'
|
||||||
import { Avatar, Text } from '@status-im/components'
|
import { Avatar, Text } from '@status-im/components'
|
||||||
|
|
||||||
type PairedDeviceCardProps = {
|
type PairedDeviceCardProps = {
|
||||||
isVisibleState: boolean
|
isVisibleState: boolean
|
||||||
}
|
}
|
||||||
const PairedDeviceCard = (isVisibleState: PairedDeviceCardProps) => {
|
const PairedDeviceCard = (isVisibleState: PairedDeviceCardProps) => {
|
||||||
const [isVisible, setIsVisible] = useState(isVisibleState)
|
const [isVisible, setIsVisible] = useState(true)
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
setIsVisible(isVisibleState.isVisibleState)
|
||||||
|
}, [isVisibleState])
|
||||||
|
|
||||||
if (!isVisible) return null
|
if (!isVisible) return null
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue