expo / expo/react-native-action-sheet

Functions on ActionSheetProvider ref are all undefined

Open
#252 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
1.6k
Forks
223
PR merge metrics
No merged PRs in 30d

Description

I created an exportable ref with
`export const actionSheetRef = React.createRef()`, and applied it to the ActionSheetProvider.
When I then try to access it, using either `actionSheetRef.current` or `actionSheetRef.current._actionSheetRef.current`, all the typed functions don't seem to be accessible, even though the typescript definition file shows this:

```
export default class ActionSheet extends React.Component {
static defaultProps: {
useNativeDriver: boolean;
};
_actionSheetHeight: number;
state: State;
_deferNextShow?: () => void;
_setActionSheetHeight: ({ nativeEvent }: any) => any;
render(): JSX.Element;
_renderSheet(): JSX.Element | null;
showActionSheetWithOptions: (options: ActionSheetOptions, onSelect: (i: number) => void) => void;
_selectCancelButton: () => boolean;
_onSelect: (index: number) => boolean;
_animateOut: () => boolean;
}
```

I'd like to programatically close the action sheet using either _animateOut or _selectedCancelButton, but accessing that key returns `undefined`.

Has anyone had any luck getting ref to work properly?

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.