Hook and React.memo Version
@kyle-ssg đang làm issue này rồi.
Từ ngày 13/10/2022.
Đánh giá
Issue này chưa được đánh giá.
Mô tả
Thanks for your awesome library.
My project can't use react-navigation 5. so I cloned your source as hook version.
I don't know yet how create this with useMemo instead of React.memo.
How about this?
import React, { ReactElement } from 'react'
import { useIsFocused } from 'react-navigation-hooks'
type RendererProps = Props & {
isFocused: boolean
}
type IRenderer = React.FC<RendererProps>
const Renderer: IRenderer = ({ children, Wrapper }) => {
return Wrapper ? <Wrapper>{children}</Wrapper> : (children as ReactElement)
}
const MemorizedRender = React.memo(Renderer, (_, { isFocused }) => {
return !isFocused
})
export const FocusRender: IFocusRender = ({ children, Wrapper }) => {
const isFocused = useIsFocused()
return (
<MemorizedRender isFocused={isFocused} Wrapper={Wrapper}>
{children}
</MemorizedRender>
)
}
- Ngôn ngữ chính
- TypeScript
- Star
- 13
- Fork
- 1
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Hướng dẫn đóng góp
Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue tương tự
-
bug(cli): hapi doctor inline-media prints a fabricated B:\ helper-script path in packaged installs Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
-
Crush Đang mở
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 85/100
catppuccin/catppuccin#3125 ·
-
Add a SECURITY.md Đang mở
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 90/100
ElementsProject/cln-application#167 · 1 bình luận · 1 reaction ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
Quantco/pnpm-licenses#17 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100