From c3146e38eab60ebd0561181e1e60b301b791ef88 Mon Sep 17 00:00:00 2001 From: Ren Rizzolo Date: Fri, 31 May 2019 13:12:47 +1000 Subject: [PATCH] use iconRenderer as Icon component --- lib/components/ItemIcon.js | 4 ++-- lib/components/RowItem.js | 16 ++++++++++++---- lib/components/RowSubItem.js | 2 +- 3 files changed, 15 insertions(+), 7 deletions(-) diff --git a/lib/components/ItemIcon.js b/lib/components/ItemIcon.js index e02c14a..65a9e60 100644 --- a/lib/components/ItemIcon.js +++ b/lib/components/ItemIcon.js @@ -1,9 +1,9 @@ import React from 'react' import PropTypes from 'prop-types' import { Image } from 'react-native' -import Icon from 'react-native-vector-icons/MaterialIcons' +// import Icon from 'react-native-vector-icons/MaterialIcons' -const ItemIcon = ({ icon, iconKey, itemIconStyle }) => { +const ItemIcon = ({ iconRenderer: Icon, icon, iconKey, itemIconStyle }) => { return ( typeof icon === 'object' || typeof icon === 'number' ? { const { - item, selectedIconComponent, mergedColors, unselectedIconComponent, + item, + selectedIconComponent, + mergedColors, + unselectedIconComponent, + iconRenderer: Icon, } = this.props return this._itemSelected(item) ? callIfFunction(selectedIconComponent) || ( @@ -205,6 +207,7 @@ class RowItem extends Component { displayKey, selectedItems, iconKey, + iconRenderer: Icon, } = this.props const hasDropDown = item[subKey] && item[subKey].length > 0 && showDropDowns @@ -235,7 +238,12 @@ class RowItem extends Component { > {selectedIconOnLeft && this._renderSelectedIcon()} {iconKey && item[iconKey] && ( - + )}