-
Notifications
You must be signed in to change notification settings - Fork 36
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Please give actual examples of usage in your .md file #127
Comments
@aronlmin great idea I see a lot of people getting stuck in implementation, an app demo and code should solve the problem indeed. I'll see if I can cook an example. PRs are also welcome |
also, calling proptypes directly to React is depricated now, https://facebook.github.io/react/warnings/dont-call-proptypes.html |
Oh need to upgrade them or remove prop type validations wherever not necessary. Thanks again |
Yeah, im new, thx for this package but didn't succed to used it. Tell me what wrong here ?
Im sure that's easy but i dont understand the base to make it work properly... |
Ok the issue is coming from that i didn't refresh the state in my own component with a incremental Notifications count in the constructor, but the question is why this package do not refresh his state itself ? not mine. |
Oh i see,
Then your state will be refresh after a new notification ? i 'll tried this and back then. |
Ok i got a working solution. I 've remove your static function and replace by simple function.
and call it with :
and place Redux do it well to. |
@Vandell63 i was able to use a HOC and keep the static function and get it to work by using import React from 'react';
import ReactMaterialUiNotifications from 'react-materialui-notifications';
class NotificationHOC extends React.Component {
componentDidMount(){
window.addEventListener('addNotification', (e) => {
const notification = e.detail;
ReactMaterialUiNotifications.showNotification(notification);
this.forceUpdate();
});
}
render() {
return <ReactMaterialUiNotifications {...this.props} />;
}
};
const NotificationShell = () => (
<NotificationHOC
desktop={true}
transitionName={{
leave: 'dummy',
leaveActive: 'fadeOut',
appear: 'dummy',
appearActive: 'zoomInUp',
}}
transitionAppear={true}
transitionLeave={true}
/>
);
export default NotificationShell; then in the root of my app... <MuiThemeProvider>
<Router>
<div>
<AppBar />
<div>
<SideBar />
<MainContent />
</div>
<NotificationShell />
</div>
</Router>
</MuiThemeProvider> |
Turns out that the above code only worked to get the notifications to render when they are added. But when you click the X button to remove one, it breaks the app because of something related to the animation on the button. This was enough for me to switch to |
I love what I see is possible to do, but newer developers are going to have a difficult time reading your documentation and understanding at a glance how to implement your product.
if you could give smaller code examples in the MD file and samples on how to include it in an application, your product would likely grow in popularity
The text was updated successfully, but these errors were encountered: