Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import type { JSX } from 'react';
import type {
ImageProps,
ImageStyle,
Expand All @@ -22,7 +23,6 @@ import {
} from '@/apps/css/components';
import { stringifyConfig } from '@/apps/css/utils';
import { colors, radius, sizes, spacing } from '@/theme';
import type { JSX } from 'react';

const sharedConfig: CSSAnimationSettings = {
animationDirection: 'alternate',
Expand Down
10 changes: 0 additions & 10 deletions packages/react-native-reanimated/src/Colors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -354,16 +354,6 @@ export const ColorProperties = [
'stroke',
];

/* copied from:
* https://github.com/facebook/react-native/blob/v0.81.0/packages/react-native/Libraries/StyleSheet/PlatformColorValueTypesIOS.d.ts
*/
export const DynamicColorIOSProperties = [
'light',
'dark',
'highContrastLight',
'highContrastDark',
] as const;

export function normalizeColor(color: unknown): number | null | undefined {
'worklet';

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
'use strict';
export * from './font';
export * from './platform';
2 changes: 1 addition & 1 deletion packages/react-native-reanimated/src/common/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
export * from './constants';
export * from './errors';
export * from './logger';
export * from './processors';
export * from './style';
export type * from './types';
export * from './utils';

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
'use strict';
import type { PlainStyle } from '../../../../common';
import type { PlainStyle } from '../../types';
import createStyleBuilder from '../createStyleBuilder';
// TODO - add more tests

Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
'use strict';
import type { PlainStyle } from '../../../common';
import { IS_ANDROID } from '../constants';
import type { PlainStyle } from '../types';
import { processTransformOrigin } from '../web';
import {
IS_ANDROID,
processAspectRatio,
processBoxShadowNative,
processColor,
processTransformOrigin,
} from '../../../common';
import {
processAspectRatio,
processFontWeight,
processGap,
processInset,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use strict';

import type { AnyRecord } from '../../../common';
import { isConfigPropertyAlias, isDefined, isRecord } from '../../utils';
import type { AnyRecord } from '../types';
import { isConfigPropertyAlias, isDefined, isRecord } from '../utils';
import type {
StyleBuilder,
StyleBuilderConfig,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
'use strict';
import { ReanimatedError } from '../../errors';
import { ReanimatedError } from '../../../errors';
import { ERROR_MESSAGES, processColor, processColorsInProps } from '../colors';

describe(processColorsInProps, () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
'use strict';
import { ReanimatedError } from '../../../../../common';
import { ReanimatedError } from '../../../errors';
import { ERROR_MESSAGES, processAspectRatio } from '../others';

describe(processAspectRatio, () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict';
import { ReanimatedError } from '../../../../../common';
import type { TransformsArray } from '../../../../types';
import { ReanimatedError } from '../../../errors';
import type { TransformsArray } from '../../../types';
import { ERROR_MESSAGES, processTransform } from '../transform';

describe(processTransform, () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
'use strict';
import { ReanimatedError } from '../../errors';
import type { NormalizedTransformOrigin, TransformOrigin } from '../../types';
import { ReanimatedError } from '../../../errors';
import type {
NormalizedTransformOrigin,
TransformOrigin,
} from '../../../types';
import { ERROR_MESSAGES, processTransformOrigin } from '../transformOrigin';

describe(processTransformOrigin, () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,11 @@ import type {
DynamicColorIOS as RNDynamicColorIOS,
} from 'react-native';

import {
ColorProperties,
DynamicColorIOSProperties,
processColorInitially,
} from '../../Colors';
import type { StyleProps } from '../../commonTypes';
import { IS_ANDROID, IS_IOS } from '../constants';
import { ReanimatedError } from '../errors';
import type { Maybe } from '../types';
import { ColorProperties, processColorInitially } from '../../../Colors';
import type { StyleProps } from '../../../commonTypes';
import { IS_ANDROID, IS_IOS } from '../../constants';
import { ReanimatedError } from '../../errors';
import type { Maybe } from '../../types';

type DynamicColorIOSTuple = Parameters<typeof RNDynamicColorIOS>[0];

Expand All @@ -37,6 +33,16 @@ export function PlatformColor(...names: Array<string>): PlatformColorValue {
return mapped as PlatformColorValue;
}

/* copied from:
* https://github.com/facebook/react-native/blob/v0.81.0/packages/react-native/Libraries/StyleSheet/PlatformColorValueTypesIOS.d.ts
*/
const DynamicColorIOSProperties = [
'light',
'dark',
'highContrastLight',
'highContrastDark',
] as const;

export function DynamicColorIOS(
tuple: DynamicColorIOSTuple
): DynamicColorValue {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use strict';
import type { ValueProcessor } from '../../../../common';
import { ReanimatedError } from '../../../../common';
import { FONT_WEIGHT_MAPPINGS } from '../../../constants';
import { FONT_WEIGHT_MAPPINGS } from '../../constants';
import { ReanimatedError } from '../../errors';
import type { ValueProcessor } from '../../types';

const ERROR_MESSAGES = {
invalidFontWeight: (weight: string | number) =>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
'use strict';
export {
DynamicColorIOS,
PlatformColor,
processColor,
processColorsInProps,
} from './colors';
export { processFontWeight } from './font';
export { processInset, processInsetBlock, processInsetInline } from './insets';
export { processAspectRatio, processGap } from './others';
export { processBoxShadowNative } from './shadows';
export { processTransform } from './transform';
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use strict';
import type { DimensionValue } from 'react-native';

import type { ValueProcessor } from '../../../../common';
import type { ValueProcessor } from '../../types';

type InsetProcessor = ValueProcessor<
DimensionValue,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict';
import type { ValueProcessor } from '../../../../common';
import { ReanimatedError } from '../../../../common';
import { ReanimatedError } from '../../errors';
import type { ValueProcessor } from '../../types';

export const ERROR_MESSAGES = {
unsupportedAspectRatio: (ratio: string | number) =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
'worklet';
import type { BoxShadowValue } from 'react-native';

import { IS_ANDROID } from '../constants';
import { ReanimatedError } from '../errors';
import type { ValueProcessor } from '../types';
import { maybeAddSuffix, parseBoxShadowString } from '../utils';
import { IS_ANDROID } from '../../constants';
import { ReanimatedError } from '../../errors';
import type { ValueProcessor } from '../../types';
import { parseBoxShadowString } from '../../utils';
import { processColor } from './colors';

const ERROR_MESSAGES = {
Expand Down Expand Up @@ -75,34 +75,3 @@ export const processBoxShadowNative: ValueProcessor<
};
});
};

export const processBoxShadowWeb: ValueProcessor<
string | ReadonlyArray<BoxShadowValue>,
string
> = (value) => {
const parsedShadow =
typeof value === 'string' ? parseBoxShadowString(value) : value;

return parsedShadow
.map(
({
offsetX,
offsetY,
color = '#000',
blurRadius = '',
spreadDistance = '',
inset = '',
}) =>
[
maybeAddSuffix(offsetX, 'px'),
maybeAddSuffix(offsetY, 'px'),
maybeAddSuffix(blurRadius, 'px'),
maybeAddSuffix(spreadDistance, 'px'),
color,
inset ? 'inset' : '',
]
.filter(Boolean)
.join(' ')
)
.join(', ');
};
Loading