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.

How do we access a non-global flash-message?

See original GitHub issue

I have figured out how to access the global FlashMessage component.

However, I want to have a second FlashMessage component positioned in another View in another screen.

I realize that the non-global FlashMessage is supposed to be like below with a ref. But, how do I access the non-global FlashMessage to show a message?

<FlashMessage ref="myNonGlobalFlashMessage" /> 

Or am I doing something completely wrong? What I am trying to accomplish is, I want to have this FlashMessage in a scrollview under the Header. So, I wrapped up my ScrollView with a View, and put the FlashMessage under the ScrollView. Pretty much like below,

<View>
  <ScrollView> ...</ScrollView>
  <FlashMessage.. />
</View>

But, I can’t get it to show a message.

Issue Analytics

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

github_iconTop GitHub Comments

3reactions
lucasferreiracommented, May 16, 2019

Hi @aktasfatih and @spyr0s

If you work with “string” refs, you go like this:

this.refs.myNonGlobalFlashMessage.showMessage(....);

Like this sample working with native Modals: https://snack.expo.io/@lucasferreira/flash-message-modal-demo

2reactions
dentepcommented, May 18, 2021

Found this issue so far away, thank you for your help!

I use it this way in my custom component:

const flash = useRef(null);

<FlashMessage ref={flash} floating={true} />

then in your View or anywhere else you do:

flash.current.showMessage({})

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to consume flash message in the browser? Passport ...
You can access flash messages using the request parameter ( req ). app.get('/User', function (req, res) { res.render('User', ...
Read more >
actix_web_flash_messages - Rust - Docs.rs
Only show flash messages at info level or above in a production environment, while retaining debug level messages for local development;; Use different ......
Read more >
NodeJS Essentials 38: Flash Messages - YouTube
In this tutorial, you'll learn how to add custom flash messages to a PassportJS login setup.In the previous tutorial, we setup a protected ......
Read more >
Flash Messages - Pode
Flash messages allow you to pass temporary messages - info/error or otherwise - across multiple web requests via a user's current session.
Read more >
Lesson 22. Adding sessions and flash messages
Currently, error messages are logged to the console, and users of the application have no way to know what they could do differently....
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