Skip to content

Commit 3efb3c3

Browse files
committed
Move more types to the common dir
1 parent 3b46b45 commit 3efb3c3

File tree

16 files changed

+41
-49
lines changed

16 files changed

+41
-49
lines changed

packages/react-native-reanimated/src/common/types.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
'use strict';
2+
3+
import type { ComponentType } from 'react';
4+
import type { ImageStyle, TextStyle, ViewStyle } from 'react-native';
5+
26
export type Maybe<T> = T | null | undefined;
37

48
/**
@@ -22,3 +26,18 @@ export type NormalizedTransformOrigin = [
2226
`${number}%` | number,
2327
number,
2428
];
29+
30+
type DeprecatedProps =
31+
| 'transformMatrix'
32+
| 'rotation'
33+
| 'scaleX'
34+
| 'scaleY'
35+
| 'translateX'
36+
| 'translateY';
37+
38+
export type PlainStyle = Omit<
39+
ViewStyle & TextStyle & ImageStyle,
40+
DeprecatedProps
41+
>;
42+
43+
export type AnyComponent = ComponentType<any>;

packages/react-native-reanimated/src/css/component/AnimatedComponent.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { Component } from 'react';
44
import type { StyleProp } from 'react-native';
55
import { Platform, StyleSheet } from 'react-native';
66

7-
import type { AnyRecord } from '../../common';
7+
import type { AnyComponent, AnyRecord, PlainStyle } from '../../common';
88
import { IS_JEST, ReanimatedError, SHOULD_BE_USE_WEB } from '../../common';
99
import type {
1010
InternalHostInstance,
@@ -20,7 +20,7 @@ import { getShadowNodeWrapperFromRef } from '../../fabricUtils';
2020
import { findHostInstance } from '../../platform-specific/findHostInstance';
2121
import { markNodeAsRemovable, unmarkNodeAsRemovable } from '../native';
2222
import { CSSManager } from '../platform';
23-
import type { AnyComponent, CSSStyle, PlainStyle } from '../types';
23+
import type { CSSStyle } from '../types';
2424
import { filterNonCSSStyleProps } from './utils';
2525

2626
export type AnimatedComponentProps = Record<string, unknown> & {

packages/react-native-reanimated/src/css/models/CSSKeyframesRuleBase.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
11
'use strict';
2+
import type { PlainStyle } from '../../common';
23
import { ANIMATION_NAME_PREFIX } from '../constants';
3-
import type {
4-
CSSAnimationKeyframes,
5-
CSSKeyframesRule,
6-
PlainStyle,
7-
} from '../types';
4+
import type { CSSAnimationKeyframes, CSSKeyframesRule } from '../types';
85

96
export default abstract class CSSKeyframesRuleBase<S extends PlainStyle>
107
implements CSSKeyframesRule

packages/react-native-reanimated/src/css/native/keyframes/CSSKeyframesRuleImpl.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
'use strict';
2+
import type { PlainStyle } from '../../../common';
23
import { CSSKeyframesRuleBase } from '../../models';
3-
import type { CSSAnimationKeyframes, PlainStyle } from '../../types';
4+
import type { CSSAnimationKeyframes } from '../../types';
45
import { normalizeAnimationKeyframes } from '../normalization';
56
import { getStyleBuilder } from '../registry';
67
import type { NormalizedCSSAnimationKeyframesConfig } from '../types';

packages/react-native-reanimated/src/css/native/style/__tests__/createStyleBuilder.test.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
'use strict';
2-
import type { PlainStyle } from '../../../types';
2+
import type { PlainStyle } from '../../../../common';
33
import createStyleBuilder from '../createStyleBuilder';
4-
54
// TODO - add more tests
65

76
describe(createStyleBuilder, () => {

packages/react-native-reanimated/src/css/native/style/config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
'use strict';
2+
import type { PlainStyle } from '../../../common';
23
import {
34
IS_ANDROID,
45
processBoxShadowNative,
56
processColor,
67
processTransformOrigin,
78
} from '../../../common';
8-
import type { PlainStyle } from '../../types';
99
import {
1010
processAspectRatio,
1111
processFontWeight,

packages/react-native-reanimated/src/css/native/types/animation.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
'use strict';
2+
import type { PlainStyle } from '../../../common';
23
import type { NormalizedCSSTimingFunction } from '../../easing';
34
import type {
45
CSSAnimationDirection,
56
CSSAnimationFillMode,
67
CSSAnimationPlayState,
7-
PlainStyle,
88
} from '../../types';
99

1010
type CSSKeyframesStyleValue<V> = {

packages/react-native-reanimated/src/css/stylesheet/keyframes.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
11
'use strict';
2+
import type { PlainStyle } from '../../common';
23
import { CSSKeyframesRuleImpl } from '../platform';
3-
import type {
4-
CSSAnimationKeyframes,
5-
CSSKeyframesRule,
6-
PlainStyle,
7-
} from '../types';
4+
import type { CSSAnimationKeyframes, CSSKeyframesRule } from '../types';
85

96
export default function keyframes<S extends PlainStyle>(
107
// TODO - think of better types

packages/react-native-reanimated/src/css/types/animation.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
'use strict';
2+
import type { PlainStyle } from '../../common';
23
import type { CSSTimingFunction } from '../easing';
3-
import type { PlainStyle, TimeUnit } from './common';
4+
import type { TimeUnit } from './common';
45
import type { AddArrayPropertyType, AddArrayPropertyTypes } from './helpers';
56

67
export interface CSSKeyframesRule {

packages/react-native-reanimated/src/css/types/common.ts

Lines changed: 1 addition & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,5 @@
11
'use strict';
2-
import type { ComponentType } from 'react';
3-
import type {
4-
ImageStyle,
5-
TextStyle,
6-
TransformsStyle,
7-
ViewStyle,
8-
} from 'react-native';
9-
10-
type DeprecatedProps =
11-
| 'transformMatrix'
12-
| 'rotation'
13-
| 'scaleX'
14-
| 'scaleY'
15-
| 'translateX'
16-
| 'translateY';
17-
18-
export type PlainStyle = Omit<
19-
ViewStyle & TextStyle & ImageStyle,
20-
DeprecatedProps
21-
>;
22-
23-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
24-
export type AnyComponent = ComponentType<any>;
2+
import type { TransformsStyle } from 'react-native';
253

264
export type TimeUnit = `${number}s` | `${number}ms` | number;
275

0 commit comments

Comments
 (0)