/** * 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'; var React = require('react-native'); var { StyleSheet, Text, View, } = React; var UIExplorerBlock = require('./UIExplorerBlock'); var UIExplorerPage = require('./UIExplorerPage'); var SwitchAndroid = require('SwitchAndroid'); var ToolbarAndroid = require('ToolbarAndroid'); var ToolbarAndroidExample = React.createClass({ statics: { title: '', description: 'Examples of using the Android toolbar.' }, getInitialState: function() { return { actionText: 'Example app with toolbar component', toolbarSwitch: false, colorProps: { titleColor: '#3b5998', subtitleColor: '#6a7180', }, }; }, render: function() { return ( this.setState({actionText: 'Icon clicked'})} style={styles.toolbar} subtitle={this.state.actionText} title="Toolbar" /> {this.state.actionText} this.setState({'toolbarSwitch': value})} /> {'\'Tis but a switch'} this.setState({colorProps: {}})} title="Wow, such toolbar" style={styles.toolbar} subtitle="Much native" {...this.state.colorProps} /> Touch the icon to reset the custom colors to the default (theme-provided) ones. ); }, _onActionSelected: function(position) { this.setState({ actionText: 'Selected ' + toolbarActions[position].title, }); }, }); var toolbarActions = [ {title: 'Create', icon: require('image!ic_create_black_48dp'), show: 'always'}, {title: 'Filter'}, {title: 'Settings', icon: require('image!ic_settings_black_48dp'), show: 'always'}, ]; var styles = StyleSheet.create({ toolbar: { backgroundColor: '#e9eaed', height: 56, }, }); module.exports = ToolbarAndroidExample;