Skip to content

Commit d7c39f6

Browse files
committed
feat(typescript): update interfaces
1 parent a8a84eb commit d7c39f6

File tree

5 files changed

+18
-9
lines changed

5 files changed

+18
-9
lines changed

src/components/Form.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
import { type PropsWithChildren } from "react";
22
import { SwiftUIParentIdProvider } from "../contexts";
33
import { useSwiftUINode } from "../hooks";
4-
import type { FunctionComponentWithId } from "../types";
4+
import type { FunctionComponentWithId, NativeViewStyle } from "../types";
55

66
// https://developer.apple.com/documentation/swiftui/form
77

8-
// eslint-disable-next-line @typescript-eslint/no-empty-object-type
9-
export type NativeFormProps = {};
8+
export type NativeFormProps = {
9+
style?: NativeViewStyle;
10+
};
1011

1112
export const Form: FunctionComponentWithId<PropsWithChildren<NativeFormProps>> = ({
1213
children,

src/components/Picker.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { ReactNode, useMemo } from "react";
22
import { useSwiftUINode } from "../hooks";
3+
import type { NativeTextStyle } from "../types";
34

45
// https://developer.apple.com/documentation/swiftui/picker
56

@@ -11,6 +12,7 @@ export type NativePickerProps<T extends string> = {
1112
label?: string;
1213
pickerStyle?: NativePickerStyle;
1314
disabled?: boolean;
15+
style?: NativeTextStyle;
1416
onChange?: (value: T) => void;
1517
onFocus?: () => void;
1618
onBlur?: () => void;

src/components/Stepper.tsx

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
import { useMemo } from "react";
1+
import { type PropsWithChildren, useMemo } from "react";
2+
import { SwiftUIParentIdProvider } from "../contexts";
23
import { useSwiftUINode } from "../hooks";
3-
import type { FunctionComponentWithId } from "../types";
4+
import type { FunctionComponentWithId, NativeTextStyle } from "../types";
45

56
// https://developer.apple.com/documentation/swiftui/stepper
67

@@ -10,12 +11,14 @@ export type NativeStepperProps = {
1011
minimum?: number;
1112
maximum?: number;
1213
step?: number;
14+
style?: NativeTextStyle;
1315
onChange?: (value: number) => void;
1416
onFocus?: () => void;
1517
onBlur?: () => void;
1618
};
1719

18-
export const Stepper: FunctionComponentWithId<NativeStepperProps> = ({
20+
export const Stepper: FunctionComponentWithId<PropsWithChildren<NativeStepperProps>> = ({
21+
children,
1922
onChange: onChangeProp,
2023
onFocus,
2124
onBlur,
@@ -31,12 +34,12 @@ export const Stepper: FunctionComponentWithId<NativeStepperProps> = ({
3134
[onChangeProp],
3235
);
3336

34-
useSwiftUINode("Stepper", otherProps, {
37+
const { id } = useSwiftUINode("Stepper", otherProps, {
3538
change: onChange,
3639
focus: onFocus,
3740
blur: onBlur,
3841
});
3942

40-
return null;
43+
return <SwiftUIParentIdProvider id={id}>{children}</SwiftUIParentIdProvider>;
4144
};
4245
Stepper.displayName = "Stepper";

src/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
// export { default as NativePopoverView } from "./PopoverViewNativeComponent";
55
// export { default as NativeSectionView } from "./SectionNativeComponent";
66
// export * from "./native/SwiftUIRootNativeComponent";
7+
export * from "./components";
78
export { default as NativeContainerView } from "./native/SwiftUIRootNativeComponent";
89
export * from "./styles";
910
export * from "./SwiftUI";

src/types/style.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,14 @@ export type NativeViewStyle = Pick<
2525
| "right"
2626
| "bottom"
2727
> & {
28+
tint?: string;
29+
accentColor?: string;
30+
foregroundColor?: string;
2831
cornerRadius?: number;
2932
};
3033

3134
export type NativeTextStyle = NativeViewStyle &
3235
Pick<TextStyle, "color" | "fontSize" | "fontWeight" | "textAlign" | "fontFamily"> & {
33-
foregroundColor?: string;
3436
font?: NativeFont;
3537
};
3638

0 commit comments

Comments
 (0)