Answers for "DrawerItemList how to get index item"

0

DrawerItemList how to get index item

{drawerItems.map((item, index) => {
return (
  <DrawerItem
    label={item.drawerLabel}
    onPress={() => props.navigation.navigate(item.routeName)}
  />
);
})}
Posted by: Guest on November-26-2020
0

DrawerItemList how to get index item

let [drawerItems, setDrawerItems] = useState([]);

useEffect(() => {
let drawerItemsList = [];
for (const key in props.descriptors) {
  if (props.descriptors.hasOwnProperty(key)) {
    if (!key.includes('profile')) {
      const element = props.descriptors[key];
      element.options.routeName = key.substring(0, key.indexOf('-'));
      drawerItemsList.push(element.options);
    }
  }
}
setDrawerItems(drawerItemsList);
}, []);
Posted by: Guest on November-26-2020

Code answers related to "DrawerItemList how to get index item"

Browse Popular Code Answers by Language