I have custom tab control in React Native app, which is rendered by dynamic config, like:
const TABS = [ { title: 'Tab 1', component: MyComponentOne }, { title: 'Tab 2', component: MyComponentTwo }];title property goes for tab title, and when the tab is selected, I need to render the corresponding component into the Animated.FlatList.
How can I render MyComponentOne and MyComponentTwo dynamically, instead of doing?:
if (typeof item.component === 'MyComponentOne') return <MyComponentOne />if (typeof item.component === 'MyComponentTwo') return <MyComponentTwo />Any ideas?