rodal icon indicating copy to clipboard operation
rodal copied to clipboard

how to custom rodal height

Open dandingol03 opened this issue 7 years ago • 12 comments

this is my case: i write a prototype tool,and i need a little modal to provide to user to fill some info, but when i inspect the modal element,i find it's height has been limited to 240px, so i wonder if there is any interface or props to use for it

dandingol03 avatar May 09 '17 08:05 dandingol03

You can use height or customStyles prop to custom height of dialog.

chenjiahan avatar May 09 '17 09:05 chenjiahan

Clarification to @chenjiahan response.
If you specify height in pixles use the "height" property. Note that no units are specified. eg: <Rodal height='300'> If you specify relative height then you must use the "customStyles" property. eg: <Rodal customStyles={{height: '80%'}}>

cniesen avatar May 15 '17 18:05 cniesen

What about media queries? (Width for example).

The modal have a Dynamic or auto Height? If i see a content in a cell phone or in my browser the height is different.

hmontes avatar Jun 07 '17 17:06 hmontes

@hmontes You can get the innerWidth of window and set different height by window's width.

chenjiahan avatar Jun 12 '17 12:06 chenjiahan

I had solved this problem

fuzhongfeng avatar Jun 23 '17 11:06 fuzhongfeng

screen shot 2017-07-05 at 10 29 05

@chenjiahan @fuzhongfeng Hello. How to make it possible to set the height dynamically depending on content ?

zenati avatar Jul 05 '17 08:07 zenati

I had forked this component in my profile , you can set the height dynamically depending on your css

fuzhongfeng avatar Jul 05 '17 15:07 fuzhongfeng

@zenati Try this:

const customStyles = {
  height: 'auto',
  bottom: 'auto',
  top: '30%'
};

<Rodal customStyles={customStyles}>

You can adjust the value of top property.

chenjiahan avatar Jul 06 '17 02:07 chenjiahan

using a transform works for me

customStyles={{ height: 'auto', bottom: 'auto', top: '50%', transform: 'translateY(-50%)' }}

knoya avatar Jul 15 '17 05:07 knoya

I used something like this.

<Rodal className='new_product_rodal' visible={this.state.visible} onClose={this.hide.bind(this)}
  customStyles={{ height: 'auto', bottom: 'auto', top: 'auto' }}
>
  <Whatever />
<Rodal/>

And then in the css.

.new_product_rodal {
  display: flex;
  align-items: center;
}

ritsource avatar Sep 17 '18 05:09 ritsource

@knoya @ritsource It works on Chrome but on IE11 content gets shifted toward bottom.

saurabhnemade avatar Dec 16 '19 09:12 saurabhnemade

There is no way to change inner width and height for the modal using media queries. I am migrating to react-responsive-modal.

irgipaulius avatar May 24 '22 20:05 irgipaulius