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.

[@thumbtack/thumbprint-react] Add ability to constrain `<ModalDefault>` height

See original GitHub issue

In some modal flows, I’m finding the need to constrain the modal height on desktop so that it’s consistent even across modal content (whose length varies) changes. (https://www.figma.com/file/IcbYHDSlj6A1gXJTpvM1UQF5/🗓-Calendar-%2B-Availability?node-id=4188%3A1097) I’ve found this to be a relatively common use case (i.e. it’s a bit jarring when the modal height suddenly expands/constrains as we switch from loading state or when some collapsed content within modal gets revealed, etc.)

Currently, there doesn’t seem to be a good way for consumer to apply a fixed height to modal. It’s possible to render a child of <ModalDefault> as <div> with some fixed height, but it’s deficient because (1) We’d want the entire modal (i.e. including sticky footer and close button row) height to be consistent, not just the children (2) When children are long, this wrapper <div> overflows; however, there already is a container that actually controls the overflow (<div className="index-module__contents">) and leads to weird styling issues (i.e. overflowing children will bleed into the bottom padding of <div className="index-module__contents">)

I also attempted using <ModalDefaultAnimatedWrapper> but <ModalFooter isSticky> throws a ref error (TypeError: Cannot read property 'current' of null) and it’s just a lot of reinventing <ModalDefault> mechanics when the only thing I want more is height constraint.

I would prefer if <ModalDefault> can accept an additional height prop (like width) that simply constrains height of the entire modal (whether it’s pixel, percentage, or discrete values) and I would be happy to contribute to the change. What are your thoughts?

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
danoccommented, Aug 23, 2019

Ok, sweet! Thanks for digging into it. Would chatting on Monday work?

On Thu, Aug 22, 2019, 6:02 PM Tom Genoni notifications@github.com wrote:

@danoc https://github.com/danoc I talked with @jichan-thumbtack https://github.com/jichan-thumbtack and it looks being able to add a fixed height to https://github.com/thumbtack/thumbprint/blob/master/packages/thumbprint-react/components/ModalDefault/index.jsx#L389 would produce the behavior needed.

It may be possible to get the effect without it but it involves rebuilding the layout structures that already exist. We like to discuss with you since you have better context on this component.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/thumbtack/thumbprint/issues/433?email_source=notifications&email_token=AAG7URRTKMRSHHSQPDP3SPTQF4SI3A5CNFSM4IOZGIVKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD46XSGA#issuecomment-524122392, or mute the thread https://github.com/notifications/unsubscribe-auth/AAG7URR4UA6ALCUIGVG2I4TQF4SI3ANCNFSM4IOZGIVA .

0reactions
danoccommented, Sep 18, 2019

This was done in #444.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Dynamic sizing of the modal · Issue #62 · reactjs/react ... - GitHub
We are now using pure CSS to size the modal, which works as long as you style the components in the modal so...
Read more >
Modal - (React) - Thumbprint Design System
Sets height of the modal container above small viewport. If auto (default), the modal height will be determined by its content. Otherwise, the...
Read more >
Set width and height to React-native modal - Stack Overflow
According to the Modal documentation, there is no style prop to be set. You can try setting the <View> dimensions inside the <Modal>...
Read more >
react-modal documentation
Accessible modal dialog component for React.JS ... npm install react-modal $ yarn add react-modal ... This attribute is `null` by default.
Read more >
@thumbtack/thumbprint-react - npm
Start using @thumbtack/thumbprint-react in your project by running ... Add a README to your package so that users know how to get started....
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