From ebe400fa3d524d62a3b0cb738a543070c63665c5 Mon Sep 17 00:00:00 2001 From: Aakash N S Date: Sun, 1 Nov 2015 02:54:11 +0530 Subject: [PATCH] Added choice dialog --- examples/ExampleApp/index.android.js | 36 +++++++++++++++++++++++++--- 1 file changed, 33 insertions(+), 3 deletions(-) diff --git a/examples/ExampleApp/index.android.js b/examples/ExampleApp/index.android.js index fd195dc..3b19e34 100644 --- a/examples/ExampleApp/index.android.js +++ b/examples/ExampleApp/index.android.js @@ -15,8 +15,38 @@ var { } = React; class ExampleApp extends React.Component { + constructor(props) { + super(props); + + this.state = {selected: 0}; + } handleClick() { - NativeModules.SimpleDialog.showBasicDialog(); + // NativeModules.SimpleDialog.showBasicDialog({ + // title: "Hello World", + // content: "This seems to be working well", + // positiveText: "Cool!", + // negativeText: "Get Lost", + // neutralText: "Hmm" + // }, + // () => this.setState({count: this.state.count + 1}), + // () => this.setState({count: this.state.count - 1}), + // (x, op) => console.log(x, op) + // ); + + NativeModules.SimpleDialog.showItemsDialog({ + title: "Country", + items: [ + "India", + "United States", + "China", + "Russia", + ], + choice: true, + selectedIndex: this.state.selected, + }, + (i) => this.setState({selected: i}), + (x, op) => console.log(x, op) + ); } render() { @@ -25,7 +55,7 @@ class ExampleApp extends React.Component { Welcome to React Native! - + this.handleClick(c)}> To get started, edit index.android.js @@ -33,7 +63,7 @@ class ExampleApp extends React.Component { - Shake or press menu button for dev menu + {"Selected : " + this.state.selected} );