Skip to content
Open
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
4 changes: 2 additions & 2 deletions src/web/WebShape.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
import { BaseProps } from './types';
import { prepare } from './utils/prepare';
import { convertInt32ColorToRGBA } from './utils/convertInt32Color';
import { camelCaseToDashed, remeasure } from './utils';
import { getAttributeName, remeasure } from './utils';
import { hasTouchableProperty } from './utils/hasProperty';
import SvgTouchableMixin from '../lib/SvgTouchableMixin';

Expand Down Expand Up @@ -76,7 +76,7 @@ export class WebShape<
// apply all other incoming prop updates as attributes on the node
// same logic as in https://github.com/software-mansion/react-native-reanimated/blob/d04720c82f5941532991b235787285d36d717247/src/reanimated2/js-reanimated/index.ts#L38-L39
// @ts-expect-error TODO: fix this
current.setAttribute(camelCaseToDashed(cleanAttribute), cleanValue);
current.setAttribute(getAttributeName(cleanAttribute), cleanValue);
break;
}
}
Expand Down
38 changes: 38 additions & 0 deletions src/web/utils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,3 +63,41 @@ export function encodeSvg(svgString: string) {
.replace(/>/g, '%3E')
.replace(/\s+/g, ' ');
}

const KEEP_CAMEL_CASE = new Set([
'stdDeviation',
'edgeMode',
'kernelMatrix',
'kernelUnitLength',
'preserveAlpha',
'baseFrequency',
'targetX',
'targetY',
'numOctaves',
'stitchTiles',
'filterUnits',
'primitiveUnits',
'pathLength',
'gradientUnits',
'gradientTransform',
'spreadMethod',
'markerHeight',
'markerUnits',
'markerWidth',
'viewBox',
'refX',
'refY',
'maskContentUnits',
'maskUnits',
'patternContentUnits',
'patternTransform',
'patternUnits',
'textLength',
'lengthAdjust',
'startOffset',
'clipPathUnits',
]);

export const getAttributeName = (attr: string) => {
return KEEP_CAMEL_CASE.has(attr) ? attr : camelCaseToDashed(attr);
};
Loading