import Button from '../../button'; import Dialog from '..'; import React from 'react'; import ReactDOM from 'react-dom'; import Switch from '../../switch'; const shortContent = (

Start your business here by searching a popular product

); const longContent = [

Start your business here by searching a popular product

,

Start your business here by searching a popular product

,

Start your business here by searching a popular product

,

Start your business here by searching a popular product

, ]; class App extends React.Component { state = { visible: false, short: true, shouldUpdatePosition: true, }; onOpen = () => { this.setState({ visible: true, short: true, }); }; onClose = () => { this.setState({ visible: false, }); }; toggleShouldUpdatePosition = () => { this.setState({ shouldUpdatePosition: !this.state.shouldUpdatePosition, }); }; modifyContent = () => { this.setState({ short: !this.state.short, }); }; render() { const { visible, short, shouldUpdatePosition } = this.state; return (
Whether to update the dialog position when the dialog height changes
{short ? shortContent : longContent}
); } } ReactDOM.render(, document.getElementById('dialog-demo-5'));