Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix setNativeProps type #2058

Merged
merged 4 commits into from
May 23, 2023
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/elements/G.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import type {
CommonPathProps,
FontProps,
NumberProp,
TransformProps,
} from '../lib/extract/types';
import Shape from './Shape';
import RNSVGGroup from '../fabric/GroupNativeComponent';
Expand All @@ -22,9 +21,10 @@ export default class G<P> extends Shape<GProps & P> {
static displayName = 'G';

setNativeProps = (
props: Object & {
matrix?: number[];
} & TransformProps,
props: GProps &
P & {
matrix?: number[];
},
) => {
const matrix = !props.matrix && extractTransform(props);
if (matrix) {
Expand Down
3 changes: 1 addition & 2 deletions src/elements/Polygon.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@ export default class Polygon extends Shape<PolygonProps> {
};

setNativeProps = (
props: Object & {
points?: string | NumberProp[];
props: PolygonProps & {
d?: string;
},
) => {
Expand Down
3 changes: 1 addition & 2 deletions src/elements/Polyline.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@ export default class Polyline extends Shape<PolylineProps> {
};

setNativeProps = (
props: Object & {
points?: string | NumberProp[];
props: PolylineProps & {
d?: string;
},
) => {
Expand Down
2 changes: 1 addition & 1 deletion src/elements/Shape.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ export default class Shape<P> extends Component<P> {
return this.root;
}
setNativeProps = (
props: Object & {
props: P & {
matrix?: ColumnMajorTransformMatrix;
fill?: ColorValue;
} & TransformProps,
Expand Down
4 changes: 1 addition & 3 deletions src/elements/Svg.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,7 @@ export default class Svg extends Shape<SvgProps> {
};

setNativeProps = (
props: Object & {
width?: NumberProp;
height?: NumberProp;
props: SvgProps & {
bbWidth?: NumberProp;
bbHeight?: NumberProp;
},
Expand Down
5 changes: 2 additions & 3 deletions src/elements/TSpan.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import type {
FontProps,
NumberArray,
NumberProp,
TransformProps,
} from '../lib/extract/types';
import RNSVGTSpan from '../fabric/TSpanNativeComponent';

Expand All @@ -30,10 +29,10 @@ export default class TSpan extends Shape<TSpanProps> {
static displayName = 'TSpan';

setNativeProps = (
props: Object & {
props: TSpanProps & {
matrix?: ColumnMajorTransformMatrix;
style?: [] | {};
} & TransformProps,
},
) => {
const matrix = !props.matrix && extractTransform(props);
if (matrix) {
Expand Down
5 changes: 2 additions & 3 deletions src/elements/Text.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import type {
NumberArray,
NumberProp,
TextSpecificProps,
TransformProps,
} from '../lib/extract/types';
import { pickNotNil } from '../lib/util';
import Shape from './Shape';
Expand All @@ -30,10 +29,10 @@ export default class Text extends Shape<TextProps> {
static displayName = 'Text';

setNativeProps = (
props: Object & {
props: TextProps & {
matrix?: ColumnMajorTransformMatrix;
style?: [] | {};
} & TransformProps,
},
) => {
const matrix = props && !props.matrix && extractTransform(props);
if (matrix) {
Expand Down