Open
Description
Description
Used the ActionSheet component, when the component is visible and the user press anywhere outside the component the application crashes.
Somehow when this happens the option index sent to the onOptionPress
function is always the same as the size of the options array.
options.length
= 3, the value sent is 3.
Related to
- Components
- Demo
- Docs
- Typings
Steps to reproduce
- Use the ActionSheet component
- Show the ActionSheet
- Press outside of the ActionSheet component
- See the error
Expected behavior
Hide the ActionSheet.
Actual behavior
Crash the application.
More Info
Code snippet
Current code:
onOptionPress(optionIndex: number) {
this.props.options?.[optionIndex].onPress?.();
this.props.onDismiss?.();
}
Fix:
onOptionPress(optionIndex: number) {
this.props.options?.[optionIndex]?.onPress?.();
this.props.onDismiss?.();
}
Screenshots/Video
Environment
- React Native version: 0.68.6
- React Native UI Lib version: 6.31.0
Affected platforms
- Android
- iOS
- Web
Metadata
Metadata
Assignees
Type
Projects
Status
To do