@tamagui/sheet 1.0.1-beta.133 → 1.0.1-beta.136

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. package/dist/cjs/RemoveScrollProps.js +17 -0
  2. package/dist/cjs/RemoveScrollProps.js.map +7 -0
  3. package/dist/cjs/SHEET_HANDLE_NAME.js +35 -0
  4. package/dist/cjs/SHEET_HANDLE_NAME.js.map +7 -0
  5. package/dist/cjs/Sheet.js +61 -118
  6. package/dist/cjs/Sheet.js.map +2 -2
  7. package/dist/cjs/SheetContext.js +38 -0
  8. package/dist/cjs/SheetContext.js.map +7 -0
  9. package/dist/cjs/SheetScrollView.js +115 -0
  10. package/dist/cjs/SheetScrollView.js.map +7 -0
  11. package/dist/cjs/types.js +17 -0
  12. package/dist/cjs/types.js.map +7 -0
  13. package/dist/esm/RemoveScrollProps.js +1 -0
  14. package/dist/esm/RemoveScrollProps.js.map +7 -0
  15. package/dist/esm/SHEET_HANDLE_NAME.js +9 -0
  16. package/dist/esm/SHEET_HANDLE_NAME.js.map +7 -0
  17. package/dist/esm/Sheet.js +54 -113
  18. package/dist/esm/Sheet.js.map +2 -2
  19. package/dist/esm/SheetContext.js +11 -0
  20. package/dist/esm/SheetContext.js.map +7 -0
  21. package/dist/esm/SheetScrollView.js +88 -0
  22. package/dist/esm/SheetScrollView.js.map +7 -0
  23. package/dist/esm/types.js +1 -0
  24. package/dist/esm/types.js.map +7 -0
  25. package/dist/jsx/RemoveScrollProps.js +1 -0
  26. package/dist/jsx/RemoveScrollProps.js.map +7 -0
  27. package/dist/jsx/SHEET_HANDLE_NAME.js +9 -0
  28. package/dist/jsx/SHEET_HANDLE_NAME.js.map +7 -0
  29. package/dist/jsx/Sheet.js +58 -101
  30. package/dist/jsx/Sheet.js.map +2 -2
  31. package/dist/jsx/SheetContext.js +11 -0
  32. package/dist/jsx/SheetContext.js.map +7 -0
  33. package/dist/jsx/SheetScrollView.js +77 -0
  34. package/dist/jsx/SheetScrollView.js.map +7 -0
  35. package/dist/jsx/types.js +1 -0
  36. package/dist/jsx/types.js.map +7 -0
  37. package/package.json +9 -8
  38. package/src/SHEET_HANDLE_NAME.tsx +4 -0
  39. package/src/Sheet.tsx +82 -203
  40. package/src/SheetContext.tsx +25 -0
  41. package/src/SheetScrollView.tsx +109 -0
  42. package/src/types.tsx +44 -0
  43. package/types/SHEET_HANDLE_NAME.d.ts +4 -0
  44. package/types/Sheet.d.ts +21 -56
  45. package/types/SheetContext.d.ts +36 -0
  46. package/types/SheetScrollView.d.ts +4 -0
  47. package/types/types.d.ts +40 -0
package/types/Sheet.d.ts CHANGED
@@ -1,64 +1,31 @@
1
1
  import { GetProps } from '@tamagui/core';
2
- import { ScopedProps } from '@tamagui/create-context';
3
- import { RemoveScroll } from '@tamagui/remove-scroll';
4
2
  import { XStackProps } from '@tamagui/stacks';
5
- import React, { ReactNode } from 'react';
6
- import { Animated, ScrollView, ScrollViewProps, View } from 'react-native';
7
- declare type RemoveScrollProps = React.ComponentProps<typeof RemoveScroll>;
8
- export declare type SheetProps = ScopedProps<{
9
- open?: boolean;
10
- defaultOpen?: boolean;
11
- onChangeOpen?: OpenChangeHandler;
12
- position?: number;
13
- defaultPosition?: number;
14
- snapPoints?: number[];
15
- onChangePosition?: PositionChangeHandler;
16
- children?: ReactNode;
17
- dismissOnOverlayPress?: boolean;
18
- dismissOnSnapToBottom?: boolean;
19
- animationConfig?: Animated.SpringAnimationConfig;
20
- disableDrag?: boolean;
21
- modal?: boolean;
22
- allowPinchZoom?: RemoveScrollProps['allowPinchZoom'];
23
- }, 'Sheet'>;
24
- declare type PositionChangeHandler = (position: number) => void;
25
- declare type OpenChangeHandler = ((open: boolean) => void) | React.Dispatch<React.SetStateAction<boolean>>;
26
- declare const createSheetScope: import("@tamagui/create-context").CreateScope;
27
- export declare const SheetHandleFrame: import("@tamagui/core").TamaguiComponent<(Omit<import("react-native").ViewProps, "children" | "display"> & import("@tamagui/core").RNWViewProps & import("@tamagui/core").TamaguiComponentPropsBase & import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase> & import("@tamagui/core").WithShorthands<import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase>> & Omit<{}, "elevation" | "fullscreen"> & {
3
+ import React from 'react';
4
+ import { Animated, View } from 'react-native';
5
+ import { SheetScopedProps } from './types';
6
+ export { createSheetScope } from './SheetContext';
7
+ export declare const SheetHandleFrame: import("@tamagui/core").TamaguiComponent<Omit<import("react-native").ViewProps, "children" | "display"> & import("@tamagui/core").RNWViewProps & import("@tamagui/core").TamaguiComponentPropsBase & import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase> & import("@tamagui/core").WithShorthands<import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase>> & Omit<{
28
8
  readonly fullscreen?: boolean | undefined;
29
9
  readonly elevation?: import("@tamagui/core").SizeTokens | undefined;
30
- } & import("@tamagui/core").MediaProps<Partial<Omit<import("react-native").ViewProps, "children" | "display"> & import("@tamagui/core").RNWViewProps & import("@tamagui/core").TamaguiComponentPropsBase & import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase> & import("@tamagui/core").WithShorthands<import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase>> & Omit<{}, "elevation" | "fullscreen"> & {
31
- readonly fullscreen?: boolean | undefined;
32
- readonly elevation?: import("@tamagui/core").SizeTokens | undefined;
33
- }>> & import("@tamagui/core").PseudoProps<Partial<Omit<import("react-native").ViewProps, "children" | "display"> & import("@tamagui/core").RNWViewProps & import("@tamagui/core").TamaguiComponentPropsBase & import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase> & import("@tamagui/core").WithShorthands<import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase>> & Omit<{}, "elevation" | "fullscreen"> & {
34
- readonly fullscreen?: boolean | undefined;
35
- readonly elevation?: import("@tamagui/core").SizeTokens | undefined;
36
- }>>) | (Omit<import("react-native").ViewProps, "children" | "display"> & import("@tamagui/core").RNWViewProps & import("@tamagui/core").TamaguiComponentPropsBase & import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase> & import("@tamagui/core").WithShorthands<import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase>> & Omit<{
37
- readonly fullscreen?: boolean | undefined;
38
- readonly elevation?: import("@tamagui/core").SizeTokens | undefined;
39
- }, string | number> & {
40
- [x: string]: undefined;
10
+ }, "open"> & {
11
+ readonly open?: boolean | undefined;
41
12
  } & import("@tamagui/core").MediaProps<Partial<Omit<import("react-native").ViewProps, "children" | "display"> & import("@tamagui/core").RNWViewProps & import("@tamagui/core").TamaguiComponentPropsBase & import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase> & import("@tamagui/core").WithShorthands<import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase>> & Omit<{
42
13
  readonly fullscreen?: boolean | undefined;
43
14
  readonly elevation?: import("@tamagui/core").SizeTokens | undefined;
44
- }, string | number> & {
45
- [x: string]: undefined;
15
+ }, "open"> & {
16
+ readonly open?: boolean | undefined;
46
17
  }>> & import("@tamagui/core").PseudoProps<Partial<Omit<import("react-native").ViewProps, "children" | "display"> & import("@tamagui/core").RNWViewProps & import("@tamagui/core").TamaguiComponentPropsBase & import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase> & import("@tamagui/core").WithShorthands<import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase>> & Omit<{
47
18
  readonly fullscreen?: boolean | undefined;
48
19
  readonly elevation?: import("@tamagui/core").SizeTokens | undefined;
49
- }, string | number> & {
50
- [x: string]: undefined;
51
- }>>), any, import("@tamagui/core").StackPropsBase, {
52
- readonly fullscreen?: boolean | undefined;
53
- readonly elevation?: import("@tamagui/core").SizeTokens | undefined;
54
- } | ({
20
+ }, "open"> & {
21
+ readonly open?: boolean | undefined;
22
+ }>>, any, import("@tamagui/core").StackPropsBase, {
55
23
  readonly fullscreen?: boolean | undefined;
56
24
  readonly elevation?: import("@tamagui/core").SizeTokens | undefined;
57
25
  } & {
58
- [x: string]: undefined;
59
- })>;
60
- declare type SheetScopedProps<A> = ScopedProps<A, 'Sheet'>;
61
- export declare const SheetHandle: ({ __scopeSheet, ...props }: SheetScopedProps<XStackProps>) => JSX.Element | null;
26
+ readonly open?: boolean | undefined;
27
+ }>;
28
+ export declare const SheetHandle: ({ __scopeSheet, ...props }: SheetScopedProps<XStackProps>) => JSX.Element;
62
29
  export declare const SheetOverlayFrame: import("@tamagui/core").TamaguiComponent<Omit<import("react-native").ViewProps, "children" | "display"> & import("@tamagui/core").RNWViewProps & import("@tamagui/core").TamaguiComponentPropsBase & import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase> & import("@tamagui/core").WithShorthands<import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase>> & Omit<{
63
30
  readonly fullscreen?: boolean | undefined;
64
31
  readonly elevation?: import("@tamagui/core").SizeTokens | undefined;
@@ -82,7 +49,6 @@ export declare const SheetOverlayFrame: import("@tamagui/core").TamaguiComponent
82
49
  }>;
83
50
  export declare type SheetOverlayProps = GetProps<typeof SheetOverlayFrame>;
84
51
  export declare const SheetOverlay: ({ __scopeSheet, ...props }: SheetScopedProps<SheetOverlayProps>) => JSX.Element;
85
- export declare const SheetScrollView: React.ForwardRefExoticComponent<ScrollViewProps & React.RefAttributes<ScrollView>>;
86
52
  export declare const SheetFrameFrame: import("@tamagui/core").TamaguiComponent<(Omit<import("react-native").ViewProps, "children" | "display"> & import("@tamagui/core").RNWViewProps & import("@tamagui/core").TamaguiComponentPropsBase & import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase> & import("@tamagui/core").WithShorthands<import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase>> & Omit<{}, "elevation" | "fullscreen"> & {
87
53
  readonly fullscreen?: boolean | undefined;
88
54
  readonly elevation?: import("@tamagui/core").SizeTokens | undefined;
@@ -131,25 +97,25 @@ export declare const SheetFrame: React.ForwardRefExoticComponent<Omit<import("re
131
97
  export declare const Sheet: ((props: Omit<{
132
98
  open?: boolean | undefined;
133
99
  defaultOpen?: boolean | undefined;
134
- onChangeOpen?: OpenChangeHandler | undefined;
100
+ onChangeOpen?: (((open: boolean) => void) | React.Dispatch<React.SetStateAction<boolean>>) | undefined;
135
101
  position?: number | undefined;
136
102
  defaultPosition?: number | undefined;
137
103
  snapPoints?: number[] | undefined;
138
- onChangePosition?: PositionChangeHandler | undefined;
139
- children?: ReactNode;
104
+ onChangePosition?: import("./types").PositionChangeHandler | undefined;
105
+ children?: React.ReactNode;
140
106
  dismissOnOverlayPress?: boolean | undefined;
141
107
  dismissOnSnapToBottom?: boolean | undefined;
142
108
  animationConfig?: Animated.SpringAnimationConfig | undefined;
109
+ handleDisableScroll?: boolean | undefined;
143
110
  disableDrag?: boolean | undefined;
144
111
  modal?: boolean | undefined;
145
- allowPinchZoom?: RemoveScrollProps['allowPinchZoom'];
146
112
  } & {
147
113
  __scopeSheet?: import("@tamagui/create-context").Scope<any>;
148
114
  } & React.RefAttributes<View>, "theme" | "themeInverse"> & {
149
115
  theme?: import("@tamagui/core").ThemeName | null | undefined;
150
116
  themeInverse?: boolean | undefined;
151
117
  }) => React.ReactElement<any, string | React.JSXElementConstructor<any>> | null) & {
152
- Handle: ({ __scopeSheet, ...props }: SheetScopedProps<XStackProps>) => JSX.Element | null;
118
+ Handle: ({ __scopeSheet, ...props }: SheetScopedProps<XStackProps>) => JSX.Element;
153
119
  Frame: React.ForwardRefExoticComponent<Omit<import("react-native").ViewProps, "children" | "display"> & import("@tamagui/core").RNWViewProps & import("@tamagui/core").TamaguiComponentPropsBase & import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase> & import("@tamagui/core").WithShorthands<import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase>> & Omit<{}, "elevation" | "fullscreen"> & {
154
120
  readonly fullscreen?: boolean | undefined;
155
121
  readonly elevation?: import("@tamagui/core").SizeTokens | undefined;
@@ -163,7 +129,7 @@ export declare const Sheet: ((props: Omit<{
163
129
  __scopeSheet?: import("@tamagui/create-context").Scope<any>;
164
130
  } & React.RefAttributes<unknown>>;
165
131
  Overlay: ({ __scopeSheet, ...props }: SheetScopedProps<SheetOverlayProps>) => JSX.Element;
166
- ScrollView: React.ForwardRefExoticComponent<ScrollViewProps & React.RefAttributes<ScrollView>>;
132
+ ScrollView: React.ForwardRefExoticComponent<import("react-native").ScrollViewProps & React.RefAttributes<import("react-native").ScrollView>>;
167
133
  };
168
134
  declare type SheetControllerContextValue = {
169
135
  disableDrag?: boolean;
@@ -174,5 +140,4 @@ declare type SheetControllerContextValue = {
174
140
  export declare const SheetController: ({ children, onChangeOpen, ...value }: Partial<SheetControllerContextValue> & {
175
141
  children?: React.ReactNode;
176
142
  }) => JSX.Element;
177
- export { createSheetScope };
178
143
  //# sourceMappingURL=Sheet.d.ts.map
@@ -0,0 +1,36 @@
1
+ import { TamaguiElement } from '@tamagui/core';
2
+ import React from 'react';
3
+ import { PositionChangeHandler, ScrollBridge, SheetProps } from './types';
4
+ declare type SheetContextValue = Required<Pick<SheetProps, 'open' | 'position' | 'snapPoints' | 'dismissOnOverlayPress'>> & {
5
+ hidden: boolean;
6
+ setPosition: PositionChangeHandler;
7
+ setOpen: React.Dispatch<React.SetStateAction<boolean>>;
8
+ contentRef: React.RefObject<TamaguiElement>;
9
+ dismissOnSnapToBottom: boolean;
10
+ scrollBridge: ScrollBridge;
11
+ modal: boolean;
12
+ };
13
+ export declare const createSheetContext: <ContextValueType extends object | null>(rootComponentName: string, defaultContext?: ContextValueType | undefined) => readonly [{
14
+ (props: ContextValueType & {
15
+ scope: import("@tamagui/create-context").Scope<ContextValueType>;
16
+ children: React.ReactNode;
17
+ }): JSX.Element;
18
+ displayName: string;
19
+ }, (consumerName: string, scope: import("@tamagui/create-context").Scope<ContextValueType | undefined>) => ContextValueType], createSheetScope: import("@tamagui/create-context").CreateScope;
20
+ export declare const SheetProvider: {
21
+ (props: Required<Pick<SheetProps, "open" | "position" | "snapPoints" | "dismissOnOverlayPress">> & {
22
+ hidden: boolean;
23
+ setPosition: PositionChangeHandler;
24
+ setOpen: React.Dispatch<React.SetStateAction<boolean>>;
25
+ contentRef: React.RefObject<TamaguiElement>;
26
+ dismissOnSnapToBottom: boolean;
27
+ scrollBridge: ScrollBridge;
28
+ modal: boolean;
29
+ } & {
30
+ scope: import("@tamagui/create-context").Scope<SheetContextValue>;
31
+ children: React.ReactNode;
32
+ }): JSX.Element;
33
+ displayName: string;
34
+ }, useSheetContext: (consumerName: string, scope: import("@tamagui/create-context").Scope<SheetContextValue | undefined>) => SheetContextValue;
35
+ export {};
36
+ //# sourceMappingURL=SheetContext.d.ts.map
@@ -0,0 +1,4 @@
1
+ import React from 'react';
2
+ import { ScrollView, ScrollViewProps } from 'react-native';
3
+ export declare const SheetScrollView: React.ForwardRefExoticComponent<ScrollViewProps & React.RefAttributes<ScrollView>>;
4
+ //# sourceMappingURL=SheetScrollView.d.ts.map
@@ -0,0 +1,40 @@
1
+ import { ScopedProps } from '@tamagui/create-context';
2
+ import { RemoveScroll } from '@tamagui/remove-scroll';
3
+ import React, { ReactNode } from 'react';
4
+ import { Animated } from 'react-native';
5
+ export declare type SheetProps = ScopedProps<{
6
+ open?: boolean;
7
+ defaultOpen?: boolean;
8
+ onChangeOpen?: OpenChangeHandler;
9
+ position?: number;
10
+ defaultPosition?: number;
11
+ snapPoints?: number[];
12
+ onChangePosition?: PositionChangeHandler;
13
+ children?: ReactNode;
14
+ dismissOnOverlayPress?: boolean;
15
+ dismissOnSnapToBottom?: boolean;
16
+ animationConfig?: Animated.SpringAnimationConfig;
17
+ handleDisableScroll?: boolean;
18
+ disableDrag?: boolean;
19
+ modal?: boolean;
20
+ }, 'Sheet'>;
21
+ export declare type PositionChangeHandler = (position: number) => void;
22
+ declare type OpenChangeHandler = ((open: boolean) => void) | React.Dispatch<React.SetStateAction<boolean>>;
23
+ export declare type RemoveScrollProps = React.ComponentProps<typeof RemoveScroll>;
24
+ export declare type SheetScopedProps<A> = ScopedProps<A, 'Sheet'>;
25
+ export declare type ScrollBridge = {
26
+ enabled: boolean;
27
+ y: number;
28
+ paneY: number;
29
+ paneMinY: number;
30
+ scrollStartY: number;
31
+ drag: (dy: number) => void;
32
+ release: (state: {
33
+ dragAt: number;
34
+ vy: number;
35
+ }) => void;
36
+ scrollLock: boolean;
37
+ onFinishAnimate?: () => void;
38
+ };
39
+ export {};
40
+ //# sourceMappingURL=types.d.ts.map