/** * The examples provided by Facebook are for non-commercial testing and * evaluation purposes only. * * Facebook reserves all rights not expressly granted. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NON INFRINGEMENT. IN NO EVENT SHALL * FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * @flow */ 'use strict'; const React = require('react-native'); const UIExplorerBlock = require('UIExplorerBlock'); const UIExplorerPage = require('UIExplorerPage'); const { PickerAndroid, Text, TouchableWithoutFeedback, } = React; const Item = PickerAndroid.Item; const PickerAndroidExample = React.createClass({ getInitialState: function() { return { selected1: 'key1', selected2: 'key1', selected3: 'key1', selected4: 'key1', color: 'red', mode: PickerAndroid.MODE_DIALOG, }; }, displayName: 'Android Picker', render: function() { return ( Tap here to switch between dialog/dropdown. You can not change the value of this picker because it doesn't set a selected prop on its items. ); }, changeMode: function() { const newMode = this.state.mode === PickerAndroid.MODE_DIALOG ? PickerAndroid.MODE_DROPDOWN : PickerAndroid.MODE_DIALOG; this.setState({mode: newMode}); }, onSelect: function(key, value) { const newState = {}; newState[key] = value; this.setState(newState); }, }); exports.title = ''; exports.displayName = 'PickerAndroidExample'; exports.description = 'The Android Picker component provides multiple options to choose from'; exports.examples = [ { title: 'PickerAndroidExample', render(): ReactElement { return ; } }, ];