Skip to content

Commit

Permalink
feat: fix control warning
Browse files Browse the repository at this point in the history
  • Loading branch information
wkylin committed Feb 14, 2025
1 parent f5e8272 commit af4ccd2
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/pages/home/index.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { version, useState, useRef } from 'react'
import React, { version, useEffect, useState, useRef } from 'react'
import { Input, Flex, Button } from 'antd'
import { SendOutlined } from '@ant-design/icons'
import { Atom, Merge, GitMerge, GitPullRequestArrow } from 'lucide-react'
Expand Down Expand Up @@ -289,7 +289,14 @@ const Home = () => {
}

const scrollRef = useRef(null)
const { scrollDir, scrollPosition } = useDetectScroll({ target: scrollRef.current || window })
const [customElement, setCustomElement] = useState()
const { scrollDir, scrollPosition } = useDetectScroll({ target: customElement })

useEffect(() => {
if (scrollRef.current) {
setCustomElement(scrollRef.current)
}
}, [scrollRef])

const [isVisible, setIsVisible] = useState(false)

Expand Down

0 comments on commit af4ccd2

Please sign in to comment.