Skip to content

Commit

Permalink
patch
Browse files Browse the repository at this point in the history
  • Loading branch information
necolas committed Jun 27, 2023
1 parent be6e6c1 commit c66fc80
Showing 1 changed file with 23 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,25 @@ import AnimatedNode from './AnimatedNode';
import AnimatedWithChildren from './AnimatedWithChildren';
import NativeAnimatedHelper from '../NativeAnimatedHelper';

const mapTransform = (transform: Object): string => {
const type = Object.keys(transform)[0];
const value = transform[type];
if (type === 'matrix' || type === 'matrix3d') {
return `${type}(${value.join(',')})`;
} else {
const normalizedValue = normalizeValueWithProperty(value, type);
return `${type}(${normalizedValue})`;
}
};

const createTransformValue = (style: Style): string => {
let transform = style.transform;
if (Array.isArray(style.transform)) {
transform = style.transform.map(mapTransform).join(' ');
}
return transform;
};

class AnimatedTransform extends AnimatedWithChildren {
_transforms: $ReadOnlyArray<Object>;

Expand All @@ -35,7 +54,7 @@ class AnimatedTransform extends AnimatedWithChildren {
}

__getValue(): $ReadOnlyArray<Object> {
return this._transforms.map(transform => {
return createTransformValue(this._transforms.map(transform => {
const result = {};
for (const key in transform) {
const value = transform[key];
Expand All @@ -46,11 +65,11 @@ class AnimatedTransform extends AnimatedWithChildren {
}
}
return result;
});
}));
}

__getAnimatedValue(): $ReadOnlyArray<Object> {
return this._transforms.map(transform => {
return createTransformValue(this._transforms.map(transform => {
const result = {};
for (const key in transform) {
const value = transform[key];
Expand All @@ -62,7 +81,7 @@ class AnimatedTransform extends AnimatedWithChildren {
}
}
return result;
});
}));
}

__attach(): void {
Expand Down

0 comments on commit c66fc80

Please sign in to comment.