react-native-collapsible-tab-view icon indicating copy to clipboard operation
react-native-collapsible-tab-view copied to clipboard

Using Custom Components

Open ahmetkuslular opened this issue 3 years ago • 6 comments

Feature request

Is it possible to set up a structure where we can pass custom components instead of adding all components? New components such as FlatGrid and FlashList are coming out. I want to use these components with this package.

Note: I simply tried and succeeded. But it has to be done in a controlled way.

FlatGrid: https://github.com/saleel/react-native-super-grid FlashList: https://github.com/Shopify/flash-list

Example:

<Tabs.Custom
  component={FlashList}
   ...
/> 

ahmetkuslular avatar Aug 02 '22 15:08 ahmetkuslular

same +1

baronha avatar Aug 17 '22 18:08 baronha

same +1

linleiqin avatar Aug 24 '22 05:08 linleiqin

Same +1

ursnj avatar Oct 30 '22 08:10 ursnj

Any news? +1

ricardopacheco avatar Dec 16 '22 18:12 ricardopacheco

Bump

edit: @ahmetkuslular you said you tried and succeeded. how'd you do it?

pfcodes avatar Jan 04 '23 08:01 pfcodes

I just made it for testing purposes. I checked if it works or not. I have not done detailed testing.

  1. Copy FlatList.tsx -> CustomList.tsx

CustomList.tsx

const CustomListMemo = React.memo(
    React.forwardRef<RNFlatList, React.PropsWithChildren<FlatListProps<unknown>>>(
        ({component, ...props}, passRef) => {
            const AnimatedCustomList = Animated.createAnimatedComponent(component)
            return <AnimatedCustomList ref={passRef} {...props} />
        }
    )
)

//the rest are the same. Here, component-specific props need to be managed separately.
...

Example.tsx

import { FlatGrid } from 'react-native-super-grid';

<Tabs.CustomList
      component={FlatGrid}
      ...props
/>

Bump

edit: @ahmetkuslular you said you tried and succeeded. how'd you do it?

ahmetkuslular avatar Jan 04 '23 11:01 ahmetkuslular