现在网上找了很多关于这个组件的使用方式,基本没人用,但是自己感觉还是挺不错的。
import ActionSheetfrom 'react-native-actionsheet';
<ActionSheet
ref="actionSheet1"
title="请选择含量单位"
options={this.state.jihuabiaozhiNameList}
cancelButtonIndex={0}
destructiveButtonIndex={1}
onPress={(data) => {this._handlePress1(data); }}
/>
介绍每个属性的用处:
title:显示标题的地方
options:属性是一个List,用于显示
cancelButtonIndex:表示在List中,取消按钮是第index个,额。。就是在List中第0个,他当做取消按钮。
destructiveButtonIndex:在List中第几个按钮显示为红色,不知道为什么会有这么一个怪属性。
坑爹的是虽然他问了你cancelButtonIndex这个属性,但是你点击取消这个按钮的时候还是以然会触发onPress,但是data传过去的是index=0;
网友评论