Add useEffect

This commit is contained in:
Hristo Nedelkov 2023-09-05 10:22:19 +03:00
parent 210716a83b
commit 829f7d15d7
2 changed files with 8 additions and 5 deletions

View File

@ -18,8 +18,6 @@ type Story = StoryObj<typeof meta>
export const Default: Story = { export const Default: Story = {
args: { args: {
valueOf: () => { isVisibleState: true,
return true
},
}, },
} }

View File

@ -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