Skip to content

Commit

Permalink
Fix transform style processing for native
Browse files Browse the repository at this point in the history
For simplicity (and to fix an internal edge case), we now translate all
'transform' values to the React Native object syntax. If a string
'transform' is ever passed to an Animated component, the animation will
now work as expected.

Close #123
  • Loading branch information
necolas committed May 16, 2024
1 parent c10e6a9 commit b9b7894
Show file tree
Hide file tree
Showing 8 changed files with 372 additions and 285 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
*/

import type { StrictProps } from '../../types/StrictProps';
import type { Style } from '../../types/styles';
import type { Style, Transform } from '../../types/styles';
import type {
ChangeEvent,
EditingEvent,
Expand Down Expand Up @@ -602,10 +602,13 @@ export function createStrictDOMComponent<T, P: StrictProps>(
const transitionProperties = resolvedTransitionProperty.flatMap(
(property) => {
const value = styleProps.style[property];
if (isString(value) || isNumber(value)) {
if (isString(value) || isNumber(value) || Array.isArray(value)) {
return [{ property, value }];
}
return [] as Array<{ property: string, value: string | number }>;
return [] as Array<{
property: string,
value: string | number | Transform[]
}>;
}
);
const animatedPropertyValues = useStyleTransition({
Expand Down
Loading

0 comments on commit b9b7894

Please sign in to comment.