Skip to content

Instantly share code, notes, and snippets.

@PolGuixe
Created April 5, 2017 17:17
Show Gist options
  • Save PolGuixe/8abbac0a720e78a12eeb382ef1ef4549 to your computer and use it in GitHub Desktop.
Save PolGuixe/8abbac0a720e78a12eeb382ef1ef4549 to your computer and use it in GitHub Desktop.
Clickable Material UI Card
// ... do all required imports ...
const getStyles = () => ({
clickableCard: {
style: {
height: 'auto',
width: '100%',
margin: '0px',
padding: '0px'
}
},
cardStyle: {
style: {
height: '100%',
flex: '1'
},
containerStyle: {
height: '100%',
display: 'flex',
flexDirection: 'column'
}
},
});
class ClickableCard extends React.Component {
// ... do props checks ...
// ... events ....
render(){
const styles = getStyles();
return (
<RaisedButton
style={{
...styles.clickableCard.style,
...this.props.style
}}
{/* define button action */}
>
<Card
className={this.props.className}
style={styles.cardStyle.style}
containerStyle={Object.assign(styles.cardStyle.containerStyle, this.props.containerStyle)}>
{/* --- Card childs --- */}
</Card>
</RaisedButton>
);
}
}
export default ClickableCard;
@rj12info
Copy link

TypeError: Cannot read property 'displayName' of undefined
at getDisplayName (ReactComponentTreeHook.js:152)
at Object.getCurrentStackAddendum (ReactComponentTreeHook.js:262)
at validateExplicitKey (ReactElementValidator.js:103)
at validateChildKeys (ReactElementValidator.js:123)
at Object.createElement (ReactElementValidator.js:209)
at HomeScreenCards.render (HomeScreenCards.js:48)
at ReactCompositeComponent.js:796
at measureLifeCyclePerf (ReactCompositeComponent.js:75)
at ReactCompositeComponentWrapper._renderValidatedComponentWithoutOwnerOrContext (ReactCompositeComponent.js:795)
at ReactCompositeComponentWrapper._renderValidatedComponent (ReactCompositeComponent.js:822)
client.js:58 [HMR] connected

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment