Overridden "Containers.DefaultStyle.width" must be coercible to a number
Due to this line, if you override the container width, you must provide a value that is coercible to the Number type (e.g. 4 or "56.56", etc.).
This is problematic for the following reasons:
- The TypeScript definition file does not enforce this restriction, please see this line.
- Widths are constrained to pixel units.
It would be handy to be able to specify the width in other units (e.g. percentages, em, etc.), but I realise (being naive to the implementation of this package), that it might not be a simple fix.
How feasible would it be to allow for units (other than pixels), when specifying an overriding width?
@igorprado
bump
We are also running into an issue with this from a slightly different angle. We wanted to be able to gain control of the notification width through CSS so we could more easily leverage media queries. To do this without turning off inline styles and having to reimplement them in CSS, we are setting Containers.DefaultStyle.width to inherit and then setting the width using the notifications-wrapper class. This yields the expected results, but throws the following warning:
'Warning: NaN is an invalid value for the marginLeft css style property.'
Would we be able to work this case in as well? I would be willing to raise a PR if we could come up with a suitable solution.
Same as me. I want to make this notification has an auto width which is decided screen size. If there is a type check before calculating the marginLeft, it will get rid of this warning.
same error, i want to use width: 100% , but in here,
-(this.props.getStyles.overrideWidth / 2);
NaN is an invalid value for the marginLeft css style property
@igorprado could you fix this ?
Same here, has this been fixed?
My 2 cents here, indeed using this as a screen wide bar notification, and overriding container with 100%, causes a warning in the notification center. I a simple PR would be just to avoid setting marginLeft when typeof width === string.
P.S: In 4 months this ticket issue will be 4 years old! We need a cake and a celebration here 🍰 🎉