$ yarn add react-native-action-sheet-ios
For react-native
versions >= 0.60, no extra steps are needed to install the package
$ react-native link react-native-action-sheet-ios
- In XCode, in the project navigator, right click
Libraries
➜Add Files to [your project's name]
- Go to
node_modules
➜react-native-action-sheet-ios
and addRNActionSheetIos.xcodeproj
- In XCode, in the project navigator, select your project. Add
libRNActionSheetIos.a
to your project'sBuild Phases
➜Link Binary With Libraries
- Run your project (
Cmd+R
)
Extends all methods from ActionSheetIOS.
Implements the method dismiss()
to dismiss the current Action Sheet.
import ActionSheetIOS from 'react-native-action-sheet-ios';
// Show an action sheet
ActionSheetIOS.showActionSheetWithOptions(
{
options: ['Cancel', 'Remove'],
destructiveButtonIndex: 1,
cancelButtonIndex: 0,
},
(buttonIndex) => {
if (buttonIndex === 1) {
/* destructive action */
}
}
);
// Hide the current action sheet
ActionSheetIOS.dismiss();