Skip to content

Commit

Permalink
refactor(Transition): rename prop unmountOnExit -> unmountOnHide
Browse files Browse the repository at this point in the history
  • Loading branch information
levithomason committed Jul 26, 2017
1 parent fadb601 commit 9816f61
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion docs/app/Examples/modules/Transition/Types/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const TransitionTypesExamples = () => (
<p>Do not unmount a Transition child or else it cannot be animated.</p>
<Message.List>
<Message.Item>
Use the <code>unmountOnExit</code> prop to unmount the child after the animation exits.
Use the <code>unmountOnHide</code> prop to unmount the child after the animation exits.
</Message.Item>
<Message.Item>
Use a <code>Transition.Group</code> to animate children as they mount and unmount.
Expand Down
2 changes: 1 addition & 1 deletion src/modules/Transition/Transition.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ export interface TransitionProps {
transitionAppear?: boolean;

/** Unmount the component (remove it from the DOM) when it is not shown. */
unmountOnExit?: boolean;
unmountOnHide?: boolean;
}

export interface TransitionEventData extends TransitionProps {
Expand Down
12 changes: 6 additions & 6 deletions src/modules/Transition/Transition.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ export default class Transition extends Component {
transitionAppear: PropTypes.bool,

/** Unmount the component (remove it from the DOM) when it is not shown. */
unmountOnExit: PropTypes.bool,
unmountOnHide: PropTypes.bool,
}

static defaultProps = {
Expand All @@ -81,7 +81,7 @@ export default class Transition extends Component {
visible: true,
mountOnEnter: true,
transitionAppear: false,
unmountOnExit: false,
unmountOnHide: false,
}

static _meta = {
Expand Down Expand Up @@ -208,19 +208,19 @@ export default class Transition extends Component {
}

computeCompletedStatus = () => {
const { unmountOnExit } = this.props
const { unmountOnHide } = this.props
const { status } = this.state

if (status === Transition.ENTERING) return Transition.ENTERED
return unmountOnExit ? Transition.UNMOUNTED : Transition.EXITED
return unmountOnHide ? Transition.UNMOUNTED : Transition.EXITED
}

computeInitialStatuses = () => {
const {
visible,
mountOnEnter,
transitionAppear,
unmountOnExit,
unmountOnHide,
} = this.props

if (visible) {
Expand All @@ -233,7 +233,7 @@ export default class Transition extends Component {
return { initial: Transition.ENTERED }
}

if (mountOnEnter || unmountOnExit) return { initial: Transition.UNMOUNTED }
if (mountOnEnter || unmountOnHide) return { initial: Transition.UNMOUNTED }
return { initial: Transition.EXITED }
}

Expand Down
8 changes: 4 additions & 4 deletions test/specs/modules/Transition/Transition-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ describe('Transition', () => {
<Transition
into={false}
mountOnEnter={false}
unmountOnExit={false}
unmountOnHide={false}
>
<p />
</Transition>
Expand Down Expand Up @@ -370,7 +370,7 @@ describe('Transition', () => {
})
})

describe('unmountOnExit', () => {
describe('unmountOnHide', () => {
it('unmounts child when true', done => {
const onHide = () => {
wrapper.should.have.state('status', Transition.UNMOUNTED)
Expand All @@ -382,7 +382,7 @@ describe('Transition', () => {
duration={0}
onHide={onHide}
transitionAppear={false}
unmountOnExit
unmountOnHide
>
<p />
</Transition>
Expand All @@ -401,7 +401,7 @@ describe('Transition', () => {
duration={5}
onHide={onHide}
transitionAppear={false}
unmountOnExit={false}
unmountOnHide={false}
>
<p />
</Transition>
Expand Down

0 comments on commit 9816f61

Please sign in to comment.