We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
import React, { Component } from 'react' import { View, Text, StyleSheet, TouchableOpacity } from 'react-native' import Ionicons from 'react-native-vector-icons/Ionicons' import { ActionSheet, ActionSheetItem } from 'react-native-action-sheet-component' import NavigationBar from 'react-native-navbar' const checkedIcon = <Ionicons name="ios-checkmark-outline" size={30} /> export default class ActionSheetExample extends Component { constructor(props) { super(props) this.state = { selectedItems: [], } } onChange = (value, index, values) => { console.log('OnChange()', 'value:', value, 'index:', index, 'values:', values) this.setState({ selectedItems: values }) } onItemPress = (value, index) => { console.log('OnItemPress()', 'value:', value, 'index:', index) } showActionSheet = () => { this.actionSheet.show() } render() { return ( <View style={{ flex: 1, backgroundColor: '#DDDDDD' }}> <NavigationBar style={{ backgroundColor: '#ABC' }} title={{ title: 'Home' }} rightButton={{ title: 'Choose', handler: () => this.actionSheet.show() }} /> <ActionSheet ref={(actionSheet) => { this.actionSheet = actionSheet }} position="bottom" onChange={this.onChange} > <ActionSheetItem text="Github" value="item1" index={0} selectedIcon={checkedIcon} onPress={this.onItemPress} /> <ActionSheetItem text="Facebook" value="item2" index={1} selectedIcon={checkedIcon} onPress={this.onItemPress} /> </ActionSheet> </View> ) } }
OnItemPress() value: item1 index: -1 OnChange() value: item1 index: -1 values: ["item1"] OnItemPress() value: item2 index: -1 OnChange() value: item2 index: -1 values: ["item2"]
At first I thought index would be auto set by the ActionSheet, so then I tried specifying explicitly in props (see above).
index
Perhaps ActionSheet could set index automatically if not specified in props?
The text was updated successfully, but these errors were encountered:
No branches or pull requests
At first I thought
index
would be auto set by the ActionSheet, so then I tried specifying explicitly in props (see above).Perhaps ActionSheet could set index automatically if not specified in props?
The text was updated successfully, but these errors were encountered: