mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-04-28 17:35:49 +08:00
[@types/proton-native] Fix Type RadioButtonProps and GridChildrenProps (#29424)
* Add two more uncovered functionalities to tests * Fix Type for RadioButton's onSelect * Fix GridChildrenProps missing `span`
This commit is contained in:
committed by
Wesley Wigham
parent
3a54e9f089
commit
1b858d5716
10
types/proton-native/index.d.ts
vendored
10
types/proton-native/index.d.ts
vendored
@@ -1,6 +1,7 @@
|
||||
// Type definitions for proton-native 1.1
|
||||
// Project: https://github.com/kusti8/proton-native
|
||||
// Definitions by: Nguyen Xuan Khanh <https://github.com/khanhas>
|
||||
// Lukas Tetzlaff <https://github.com/ltetzlaff>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.8
|
||||
|
||||
@@ -421,6 +422,13 @@ export interface GridChildrenProps {
|
||||
* What row the component resides in.
|
||||
*/
|
||||
row?: number;
|
||||
/**
|
||||
* How many rows/columns the component takes off.
|
||||
*/
|
||||
span?: {
|
||||
x: number;
|
||||
y: number;
|
||||
};
|
||||
}
|
||||
|
||||
export interface GridProps {
|
||||
@@ -608,7 +616,7 @@ export interface RadioButtonsProps extends GridChildrenProps, Label, Stretchy {
|
||||
/**
|
||||
* Called when a RadioButton is selected. The number selected is passed as an argument.
|
||||
*/
|
||||
onSelect?: (selected: boolean) => void;
|
||||
onSelect?: (selected: number) => void;
|
||||
/**
|
||||
* What RadioButton is selected, zero-indexed. -1 means nothing is selected.
|
||||
*/
|
||||
|
||||
@@ -48,7 +48,7 @@ class RadioTest extends React.Component {
|
||||
return (
|
||||
<App>
|
||||
<Window title="Example" size={{w: 500, h: 500}}>
|
||||
<RadioButtons enabled={true}>
|
||||
<RadioButtons onSelect={selected => selected.toFixed()} enabled={true}>
|
||||
<RadioButtons.Item>Option 1</RadioButtons.Item>
|
||||
<RadioButtons.Item>Option 2</RadioButtons.Item>
|
||||
</RadioButtons>
|
||||
@@ -118,6 +118,14 @@ class GridTest extends React.Component {
|
||||
>
|
||||
<Form><ColorButton label={"Test"}/></Form>
|
||||
</Box>
|
||||
<Box
|
||||
align={{h: false, v: false}}
|
||||
row={2}
|
||||
column={0}
|
||||
span={{x: 2, y: 1}}
|
||||
>
|
||||
<Form><ColorButton label={"Spans Two Columns"}/></Form>
|
||||
</Box>
|
||||
</Grid>
|
||||
</Window>
|
||||
</App>
|
||||
|
||||
Reference in New Issue
Block a user