Skip to content

Commit a5570cf

Browse files
authored
revert: ref back of func (#64)
1 parent 4494497 commit a5570cf

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

src/CSSMotion.tsx

+4-4
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ import { getTransitionName, supportTransition } from './util/motion';
1818

1919
export interface CSSMotionRef {
2020
nativeElement: HTMLElement;
21-
inMotion: boolean;
22-
enableMotion: boolean;
21+
inMotion: () => boolean;
22+
enableMotion: () => boolean;
2323
}
2424

2525
export type CSSMotionConfig =
@@ -173,11 +173,11 @@ export function genCSSMotion(config: CSSMotionConfig) {
173173
},
174174
inMotion: {
175175
enumerable: true,
176-
get: () => getStatus() !== STATUS_NONE,
176+
get: () => () => getStatus() !== STATUS_NONE,
177177
},
178178
enableMotion: {
179179
enumerable: true,
180-
get: () => supportMotion,
180+
get: () => () => supportMotion,
181181
},
182182
});
183183
return obj;

tests/StrictMode.spec.tsx

+3-3
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ describe('StrictMode', () => {
4343
</React.StrictMode>,
4444
);
4545

46-
expect(ref.current.enableMotion).toBeTruthy();
46+
expect(ref.current.enableMotion()).toBeTruthy();
4747

4848
const node = container.querySelector('.motion-box');
4949
expect(node).toHaveClass('transition-appear', 'transition-appear-start');
@@ -52,15 +52,15 @@ describe('StrictMode', () => {
5252
act(() => {
5353
jest.runAllTimers();
5454
});
55-
expect(ref.current.inMotion).toBeTruthy();
55+
expect(ref.current.inMotion()).toBeTruthy();
5656
expect(node).not.toHaveClass('transition-appear-start');
5757
expect(node).toHaveClass('transition-appear-active');
5858

5959
// Trigger End
6060
fireEvent.transitionEnd(node);
6161
expect(node).not.toHaveClass('transition-appear');
6262

63-
expect(ref.current.inMotion).toBeFalsy();
63+
expect(ref.current.inMotion()).toBeFalsy();
6464
expect(ref.current.nativeElement).toBe(node);
6565
});
6666
});

0 commit comments

Comments
 (0)