question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Issue with renderCustomContent

See original GitHub issue

Hello,

Thank you for creating this package, it is very helpful! Unfortunately I wasn’t able to get renderCustomContent to work and I found that I had to change line 228 in FlashMessage.js to {!!message.renderCustomContent && message.renderCustomContent()} in order for it to work. Maybe this is something that you could look into? Thank you so much! 😃

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
lucasferreiracommented, Sep 4, 2019

Hi @imouto2005

Now I get it. renderCustomContent was a contribution from other user to this lib, but I think it’s easy to solve your problem.

I main render method you could change this:

render() {
    const { renderFlashMessageIcon, renderCustomContent, MessageComponent } = this.props;
    const { message, visibleValue } = this.state;

    const style = this.prop(message, "style");
    const textStyle = this.prop(message, "textStyle");
    ...

In this:

render() {
    const { renderFlashMessageIcon, MessageComponent } = this.props;
    const { message, visibleValue } = this.state;

    const style = this.prop(message, "style");
    const textStyle = this.prop(message, "textStyle");
    const renderCustomContent = this.prop(message, "renderCustomContent");
    ...

The this.prop method are made just to deal with when the props comes from message or come from the instance 😉

Could you try over there and tell if it works?

0reactions
federicomirallescommented, Aug 14, 2020

Hi @imouto2005

Now I get it. renderCustomContent was a contribution from other user to this lib, but I think it’s easy to solve your problem.

I main render method you could change this:

render() {
    const { renderFlashMessageIcon, renderCustomContent, MessageComponent } = this.props;
    const { message, visibleValue } = this.state;

    const style = this.prop(message, "style");
    const textStyle = this.prop(message, "textStyle");
    ...

In this:

render() {
    const { renderFlashMessageIcon, MessageComponent } = this.props;
    const { message, visibleValue } = this.state;

    const style = this.prop(message, "style");
    const textStyle = this.prop(message, "textStyle");
    const renderCustomContent = this.prop(message, "renderCustomContent");
    ...

The this.prop method are made just to deal with when the props comes from message or come from the instance 😉

Could you try over there and tell if it works?

I can confirm it works as expected!

Personally I think this approach is more flexible than having it as part of FlashMessage component. Indeed passing the renderCustomContent as another message option makes it more customisable because allows to tailor the JSX to be rendered from anywhere when it’s used to display messages globally.

@lucasferreira are you planning to release it any time soon?

BTW awesome work! Thanks!

Cheers,

Federico

Read more comments on GitHub >

github_iconTop Results From Across the Web

Developers - renderCustomContent doesn't work - - Bountysource
renderCustomContent parameter doesn't work. showMessage({ message: "Simple message", type: "info", renderCustomContent: ()=> <Text>Test ...
Read more >
How to render custom content blocks? [#2960149] | Drupal.org
So I guess it is not an issue with my theme's custom template suggestions. Is there a way to pass the custom content...
Read more >
Scheduler does not render custom content in the "All Day" cells
Hi, I'm using the scheduler with AngularJS and you can see on this codepen my problem : https://codepen.io/anon/pen/gvRQNR In Chrome it ...
Read more >
Render custom content in sheet cell (PrimeFaces Extensions)
This issue has been raised before and its not so simple with the HandsonTable. Its doable just not simple.
Read more >
New-UDTableColumn Render Parameter Issues - PowerShell ...
Use this parameter instead of property to render custom content within a column. The $Body variable will contain the current row being rendered....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found