Skip to content

Commit 6cef3d6

Browse files
pfulopxotahal
authored andcommitted
Fix leftElement to work with any element and not just icon names (#46)
* Fix leftElement to work with any element and not just icon names * Fix leftElement to work with any element and not just icon names * added style container
1 parent 83a8e31 commit 6cef3d6

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/Toolbar/Toolbar.react.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -296,6 +296,14 @@ class Toolbar extends PureComponent {
296296
return null;
297297
}
298298

299+
if (!this.state.isSearchActive && React.isValidElement(leftElement)) {
300+
return (
301+
<View style={style.leftElementContainer}>
302+
{React.cloneElement(leftElement, { key: 'customLeftElement' })}
303+
</View>
304+
);
305+
}
306+
299307
let iconName = leftElement;
300308
let onPress = onLeftElementPress;
301309

0 commit comments

Comments
 (0)