react-component / motion
Showing 1 of 2 files from the diff.
Other files ignored by Codecov

@@ -9,12 +9,9 @@
Loading
9 9
  MotionStatus,
10 10
  MotionEventHandler,
11 11
  MotionEndEventHandler,
12 -
  MotionPrepareEventHandler} from './interface';
13 -
import {
14 -
  STATUS_NONE,
15 -
  STEP_PREPARE,
16 -
  STEP_START,
12 +
  MotionPrepareEventHandler,
17 13
} from './interface';
14 +
import { STATUS_NONE, STEP_PREPARE, STEP_START } from './interface';
18 15
import useStatus from './hooks/useStatus';
19 16
import DomWrapper from './DomWrapper';
20 17
import { isActive } from './hooks/useStepQueue';
@@ -135,15 +132,19 @@
Loading
135 132
    const supportMotion = isSupportTransition(props);
136 133
137 134
    // Ref to the react node, it may be a HTMLElement
138 -
    const nodeRef = useRef();
135 +
    const nodeRef = useRef<any>();
139 136
    // Ref to the dom wrapper in case ref can not pass to HTMLElement
140 137
    const wrapperNodeRef = useRef();
141 138
142 139
    function getDomElement() {
143 140
      try {
144 -
        return findDOMNode<HTMLElement>(
145 -
          nodeRef.current || wrapperNodeRef.current,
146 -
        );
141 +
        // Here we're avoiding call for findDOMNode since it's deprecated
142 +
        // in strict mode. We're calling it only when node ref is not
143 +
        // an instance of DOM HTMLElement. Otherwise use
144 +
        // findDOMNode as a final resort
145 +
        return nodeRef.current instanceof HTMLElement
146 +
          ? nodeRef.current
147 +
          : findDOMNode<HTMLElement>(wrapperNodeRef.current);
147 148
      } catch (e) {
148 149
        // Only happen when `motionDeadline` trigger but element removed.
149 150
        return null;
@@ -157,7 +158,7 @@
Loading
157 158
      props,
158 159
    );
159 160
160 -
    // Record whether content has rended
161 +
    // Record whether content has rendered
161 162
    // Will return null for un-rendered even when `removeOnLeave={false}`
162 163
    const renderedRef = React.useRef(mergedVisible);
163 164
    if (mergedVisible) {
@@ -165,13 +166,9 @@
Loading
165 166
    }
166 167
167 168
    // ====================== Refs ======================
168 -
    const originRef = useRef(ref);
169 -
    originRef.current = ref;
170 -
171 169
    const setNodeRef = React.useCallback((node: any) => {
172 170
      nodeRef.current = node;
173 -
174 -
      fillRef(originRef.current, node);
171 +
      fillRef(ref, node);
175 172
    }, []);
176 173
177 174
    // ===================== Render =====================
@@ -213,10 +210,8 @@
Loading
213 210
        {
214 211
          ...mergedProps,
215 212
          className: classNames(getTransitionName(motionName, status), {
216 -
            [getTransitionName(
217 -
              motionName,
218 -
              `${status}-${statusSuffix}`,
219 -
            )]: statusSuffix,
213 +
            [getTransitionName(motionName, `${status}-${statusSuffix}`)]:
214 +
              statusSuffix,
220 215
            [motionName as string]: typeof motionName === 'string',
221 216
          }),
222 217
          style: statusStyle,
Files Coverage
src 98.35%
Project Totals (12 files) 98.35%

No yaml found.

Create your codecov.yml to customize your Codecov experience

Sunburst
The inner-most circle is the entire project, moving away from the center are folders then, finally, a single file. The size and color of each slice is representing the number of statements and the coverage, respectively.
Icicle
The top section represents the entire project. Proceeding with folders and finally individual files. The size and color of each slice is representing the number of statements and the coverage, respectively.
Grid
Each block represents a single file in the project. The size and color of each block is represented by the number of statements and the coverage, respectively.
Loading