binggg / mrn

Material React Native (MRN) - A Material Design style React Native component library.
http://mrn.js.org
1.73k stars 109 forks source link

Allow toolbar actions #14

Closed Ehesp closed 8 years ago

Ehesp commented 8 years ago

@binggg Proof of concept at the moment as I'm having an issue, which I'll explain.

This PR allows you to do the following:

<Toolbar
        title='MyAwesomeApp'
    navIconName='menu'
    titleColor='#ffffff'
    actions={ [
            { icon: 'settings', onPress: function() {
            console.log('pressed settings');
        } },
        { icon: 'magnify', onPress: () => {
            console.log('pressed magnify');
        } }
    ] }
    style={ styles.toolbar }
/>

Which results in:

image

The issue I can't figure out though is the onPress function is never triggered. I've tried to trace it back to the Ripple component, it looks like onPress is never getting triggered on that component. When adding it, it complains the proptype passed down from IconButton is not a function!

Let me know what you think anyway.

Ehesp commented 8 years ago

Be aware there is an outstanding issue here, the action icons don't actually do anything right now as the press handler doesn't work.