mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-03 22:37:03 +00:00
Merge pull request #30694 from stackbuilders/master
Fix children type for react-native-dialog
This commit is contained in:
Vendored
+3
-1
@@ -1,6 +1,8 @@
|
||||
// Type definitions for react-native-dialog 4.0
|
||||
// Project: https://github.com/mmazzarolo/react-native-dialog
|
||||
// Definitions by: MrLuje <https://github.com/MrLuje>
|
||||
// Stack Builders <https://github.com/stackbuilders>
|
||||
// Esteban Ibarra <https://github.com/ibarrae>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.8
|
||||
|
||||
@@ -32,7 +34,7 @@ interface ButtonProps {
|
||||
|
||||
interface ContainerProps {
|
||||
blurComponentIOS?: ReactNode;
|
||||
children: JSX.Element[];
|
||||
children: React.ReactNode[];
|
||||
/**
|
||||
* default: false
|
||||
*/
|
||||
|
||||
@@ -2,6 +2,24 @@ import Dialog from "react-native-dialog";
|
||||
import { createRef, Component } from "react";
|
||||
|
||||
class Example extends Component {
|
||||
dynamicButtons() {
|
||||
const buttonFunc = () => console.log('click');
|
||||
const buttons = [
|
||||
{ label: 'Button 1', action: buttonFunc },
|
||||
{ label: 'Button 2', action: buttonFunc },
|
||||
];
|
||||
return buttons.map(({ label , action }) =>
|
||||
<Dialog.Button
|
||||
label={label}
|
||||
onPress={action}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
singleButton() {
|
||||
return (<Dialog.Button label="Click" onPress={() => null} />);
|
||||
}
|
||||
|
||||
render() {
|
||||
const ref = createRef();
|
||||
|
||||
@@ -23,6 +41,8 @@ class Example extends Component {
|
||||
label="Validate"
|
||||
onPress={() => console.log("test")}
|
||||
/>
|
||||
{this.dynamicButtons()}
|
||||
{this.singleButton()}
|
||||
</Dialog.Container>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user