Flagsmith / Flagsmith/react-navigation-focus-render
Hook and React.memo Version
- 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
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
const Renderer: IRenderer = ({ children, Wrapper }) => {
return Wrapper ? {children} : (children as ReactElement)
}
const MemorizedRender = React.memo(Renderer, (_, { isFocused }) => {
return !isFocused
})
export const FocusRender: IFocusRender = ({ children, Wrapper }) => {
const isFocused = useIsFocused()
return (
{children}
)
}
```
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
Đánh giá
Issue này chưa được đánh giá.