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.

Can't make the toast message uses the whole screen width

See original GitHub issue

Describe the bug In previous versions I could set the width of the toast message to 100% and the messages uses the whole screen width. Since the version 2 this does not work anymore.

Steps to reproduce Steps to reproduce the behavior:

  1. Add the Toast component to your app and add a custom success component based on the BaseToast component.
  2. Add a custom style to make the width to 100%
  3. Open the toast message
  4. The message is very small and not readable (see screenshot)

Expected behavior The message should be use the whole size of the screen without any free space left or right.

Screenshots Greenshot 2021-11-25 15 21 46

Code sample

<Toast
  config={{
    success: (props) => (<BaseToast {...props} style={{ width: '100%' }} />)
  }}
/>

The sizing only works when using explicit width like width: 200. Greenshot 2021-11-25 15 38 56

Environment (please complete the following information):

  • OS: iOS
  • react-native-toast-message version: v2.0.2
  • react-native version v0.66.3

Issue Analytics

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

github_iconTop GitHub Comments

2reactions
calintamascommented, Dec 9, 2021

Fixed in v2.1.0.

It should be possible to have a full width Toast via:

<BaseToast style={{ width: '100%' }} />

Or change its alignment:

<BaseToast style={{ alignSelf: 'flex-end' }} />
2reactions
calintamascommented, Nov 30, 2021

I’ll have to check though, maybe it could be supported. I think it’s the container style which breaks it

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to make custom toast message to take the whole screen
Look at this line toast.setGravity(Gravity.FILL,0,0) , it makes the toast fill the whole screen just as you want. It is what I use...
Read more >
Full width toast don't work in bootstrap 4.3.1 #611 - GitHub
I update the bootstrap to the new version and I saw the "positionClass": "toast-top-full-width" don't work at the bootstraps upper than 4.2.x.
Read more >
Toasts overview - Android Developers
A toast provides simple feedback about an operation in a small popup. It only fills the amount of space required for the message...
Read more >
Toasts - Bootstrap
Push notifications to your visitors with a toast, a lightweight and easily customizable alert message. Toasts are lightweight notifications designed to mimic ...
Read more >
Toast - PrimeNG - PrimeFaces
In example below, width of the toast messages cover the whole page on screens whose widths is smaller than 921px. <p-toast [breakpoints]="{'920px': ...
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