add dismiss all

This commit is contained in:
Hailey
2024-10-02 22:40:31 -07:00
parent a32f58753d
commit cc81342256
6 changed files with 17 additions and 13 deletions
@@ -8,6 +8,7 @@ import {
View,
ViewStyle,
} from 'react-native'
import {requireNativeModule} from 'expo'
import {requireNativeViewManager} from 'expo-modules-core'
import {BottomSheetState, BottomSheetViewProps} from './BottomSheet.types'
@@ -21,7 +22,9 @@ const NativeView: React.ComponentType<
}
> = requireNativeViewManager('BottomSheet')
export class BottomSheetView extends React.Component<
const NativeModule = requireNativeModule('BottomSheet')
export class BottomSheet extends React.Component<
BottomSheetViewProps,
{
open: boolean
@@ -68,6 +71,10 @@ export class BottomSheetView extends React.Component<
this.ref.current?.updateLayout()
}
static dismissAll = async () => {
await NativeModule.dismissAll()
}
render() {
const {children, ...rest} = this.props
const topInset = rest.topInset ?? 0
@@ -1,5 +1,5 @@
import {BottomSheetViewProps} from './BottomSheet.types'
export function BottomSheetView(_: BottomSheetViewProps) {
export function BottomSheet(_: BottomSheetViewProps) {
throw new Error('BottomSheetView is not available on web')
}