Skip to content

Commit e87e2ba

Browse files
authored
fix(Modal): remove default timeout in modal and backdrop transition (react-bootstrap#5837)
1 parent e546768 commit e87e2ba

File tree

2 files changed

+24
-2
lines changed

2 files changed

+24
-2
lines changed

src/Modal.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -231,11 +231,11 @@ const defaultProps = {
231231

232232
/* eslint-disable no-use-before-define, react/no-multi-comp */
233233
function DialogTransition(props) {
234-
return <Fade {...props} />;
234+
return <Fade {...props} timeout={null} />;
235235
}
236236

237237
function BackdropTransition(props) {
238-
return <Fade {...props} />;
238+
return <Fade {...props} timeout={null} />;
239239
}
240240

241241
/* eslint-enable no-use-before-define */

test/ModalSpec.js

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -276,6 +276,28 @@ describe('<Modal>', () => {
276276
);
277277
});
278278

279+
it('should call `transitionend` before `exited`', (done) => {
280+
const increment = sinon.spy();
281+
let modal;
282+
283+
const instance = mount(
284+
<Modal
285+
show
286+
style={{ transition: 'opacity 1s linear' }}
287+
onExited={() => {
288+
expect(increment.callCount).to.equal(1);
289+
modal.removeEventListener('transitionend', increment);
290+
done();
291+
}}
292+
>
293+
<strong>Message</strong>
294+
</Modal>,
295+
);
296+
modal = instance.find('.modal').getDOMNode();
297+
modal.addEventListener('transitionend', increment);
298+
instance.setProps({ show: false });
299+
});
300+
279301
describe('cleanup', () => {
280302
let offSpy;
281303

0 commit comments

Comments
 (0)