@ankhorage/surface 1.3.1 → 1.4.0
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.
- package/CHANGELOG.md +8 -0
- package/dist/layout/ScrollArea.d.ts +9 -0
- package/dist/layout/ScrollArea.d.ts.map +1 -0
- package/dist/layout/ScrollArea.js +52 -0
- package/dist/layout/ScrollArea.js.map +1 -0
- package/dist/layout/index.d.ts +2 -0
- package/dist/layout/index.d.ts.map +1 -1
- package/dist/layout/index.js +1 -0
- package/dist/layout/index.js.map +1 -1
- package/package.json +1 -1
- package/src/layout/ScrollArea.tsx +115 -0
- package/src/layout/index.ts +2 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# @ankhorage/surface
|
|
2
2
|
|
|
3
|
+
## 1.4.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 247dd05: Add a `ScrollArea` layout primitive for themed, responsive scroll containers.
|
|
8
|
+
|
|
9
|
+
`ScrollArea` wraps React Native `ScrollView` behind Surface so higher-level packages such as ZORA can build screen-level scrolling without importing raw React Native scroll primitives directly.
|
|
10
|
+
|
|
3
11
|
## 1.3.1
|
|
4
12
|
|
|
5
13
|
### Patch Changes
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { type ScrollViewProps as ReactNativeScrollViewProps, type StyleProp, type ViewStyle } from 'react-native';
|
|
3
|
+
import { type BoxStyleProps } from './helpers';
|
|
4
|
+
export interface ScrollAreaProps extends BoxStyleProps, Omit<ReactNativeScrollViewProps, 'children' | 'contentContainerStyle' | 'style'> {
|
|
5
|
+
children?: React.ReactNode;
|
|
6
|
+
contentContainerStyle?: StyleProp<ViewStyle>;
|
|
7
|
+
}
|
|
8
|
+
export declare function ScrollArea({ children, contentContainerStyle, p, px, py, pt, pb, pl, pr, m, mx, my, mt, mb, ml, mr, bg, radius, borderWidth, borderColor, width, height, minWidth, maxWidth, minHeight, maxHeight, flex, flexGrow, flexShrink, flexBasis, alignSelf, position, top, bottom, left, right, overflow, zIndex, opacity, style, ...scrollProps }: ScrollAreaProps): React.JSX.Element;
|
|
9
|
+
//# sourceMappingURL=ScrollArea.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ScrollArea.d.ts","sourceRoot":"","sources":["../../src/layout/ScrollArea.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAEL,KAAK,eAAe,IAAI,0BAA0B,EAClD,KAAK,SAAS,EACd,KAAK,SAAS,EACf,MAAM,cAAc,CAAC;AAItB,OAAO,EAAE,KAAK,aAAa,EAAoB,MAAM,WAAW,CAAC;AAEjE,MAAM,WAAW,eACf,SACE,aAAa,EACb,IAAI,CAAC,0BAA0B,EAAE,UAAU,GAAG,uBAAuB,GAAG,OAAO,CAAC;IAClF,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,qBAAqB,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;CAC9C;AAED,wBAAgB,UAAU,CAAC,EACzB,QAAQ,EACR,qBAAqB,EACrB,CAAC,EACD,EAAE,EACF,EAAE,EACF,EAAE,EACF,EAAE,EACF,EAAE,EACF,EAAE,EACF,CAAC,EACD,EAAE,EACF,EAAE,EACF,EAAE,EACF,EAAE,EACF,EAAE,EACF,EAAE,EACF,EAAE,EACF,MAAM,EACN,WAAW,EACX,WAAW,EACX,KAAK,EACL,MAAM,EACN,QAAQ,EACR,QAAQ,EACR,SAAS,EACT,SAAS,EACT,IAAI,EACJ,QAAQ,EACR,UAAU,EACV,SAAS,EACT,SAAS,EACT,QAAQ,EACR,GAAG,EACH,MAAM,EACN,IAAI,EACJ,KAAK,EACL,QAAQ,EACR,MAAM,EACN,OAAO,EACP,KAAK,EACL,GAAG,WAAW,EACf,EAAE,eAAe,qBAoDjB"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ScrollView, } from 'react-native';
|
|
3
|
+
import { useResponsiveRuntime } from '../core/responsive';
|
|
4
|
+
import { useTheme } from '../theme/ThemeContext';
|
|
5
|
+
import { resolveBoxStyles } from './helpers';
|
|
6
|
+
export function ScrollArea({ children, contentContainerStyle, p, px, py, pt, pb, pl, pr, m, mx, my, mt, mb, ml, mr, bg, radius, borderWidth, borderColor, width, height, minWidth, maxWidth, minHeight, maxHeight, flex, flexGrow, flexShrink, flexBasis, alignSelf, position, top, bottom, left, right, overflow, zIndex, opacity, style, ...scrollProps }) {
|
|
7
|
+
const { theme } = useTheme();
|
|
8
|
+
const { breakpoint } = useResponsiveRuntime();
|
|
9
|
+
const resolved = resolveBoxStyles(theme, breakpoint, {
|
|
10
|
+
p,
|
|
11
|
+
px,
|
|
12
|
+
py,
|
|
13
|
+
pt,
|
|
14
|
+
pb,
|
|
15
|
+
pl,
|
|
16
|
+
pr,
|
|
17
|
+
m,
|
|
18
|
+
mx,
|
|
19
|
+
my,
|
|
20
|
+
mt,
|
|
21
|
+
mb,
|
|
22
|
+
ml,
|
|
23
|
+
mr,
|
|
24
|
+
bg,
|
|
25
|
+
radius,
|
|
26
|
+
borderWidth,
|
|
27
|
+
borderColor,
|
|
28
|
+
width,
|
|
29
|
+
height,
|
|
30
|
+
minWidth,
|
|
31
|
+
maxWidth,
|
|
32
|
+
minHeight,
|
|
33
|
+
maxHeight,
|
|
34
|
+
flex,
|
|
35
|
+
flexGrow,
|
|
36
|
+
flexShrink,
|
|
37
|
+
flexBasis,
|
|
38
|
+
alignSelf,
|
|
39
|
+
position,
|
|
40
|
+
top,
|
|
41
|
+
bottom,
|
|
42
|
+
left,
|
|
43
|
+
right,
|
|
44
|
+
overflow,
|
|
45
|
+
zIndex,
|
|
46
|
+
opacity,
|
|
47
|
+
});
|
|
48
|
+
return (<ScrollView {...scrollProps} contentContainerStyle={contentContainerStyle} style={[resolved, style]}>
|
|
49
|
+
{children}
|
|
50
|
+
</ScrollView>);
|
|
51
|
+
}
|
|
52
|
+
//# sourceMappingURL=ScrollArea.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ScrollArea.js","sourceRoot":"","sources":["../../src/layout/ScrollArea.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EACL,UAAU,GAIX,MAAM,cAAc,CAAC;AAEtB,OAAO,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAC1D,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACjD,OAAO,EAAsB,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAUjE,MAAM,UAAU,UAAU,CAAC,EACzB,QAAQ,EACR,qBAAqB,EACrB,CAAC,EACD,EAAE,EACF,EAAE,EACF,EAAE,EACF,EAAE,EACF,EAAE,EACF,EAAE,EACF,CAAC,EACD,EAAE,EACF,EAAE,EACF,EAAE,EACF,EAAE,EACF,EAAE,EACF,EAAE,EACF,EAAE,EACF,MAAM,EACN,WAAW,EACX,WAAW,EACX,KAAK,EACL,MAAM,EACN,QAAQ,EACR,QAAQ,EACR,SAAS,EACT,SAAS,EACT,IAAI,EACJ,QAAQ,EACR,UAAU,EACV,SAAS,EACT,SAAS,EACT,QAAQ,EACR,GAAG,EACH,MAAM,EACN,IAAI,EACJ,KAAK,EACL,QAAQ,EACR,MAAM,EACN,OAAO,EACP,KAAK,EACL,GAAG,WAAW,EACE;IAChB,MAAM,EAAE,KAAK,EAAE,GAAG,QAAQ,EAAE,CAAC;IAC7B,MAAM,EAAE,UAAU,EAAE,GAAG,oBAAoB,EAAE,CAAC;IAC9C,MAAM,QAAQ,GAAG,gBAAgB,CAAC,KAAK,EAAE,UAAU,EAAE;QACnD,CAAC;QACD,EAAE;QACF,EAAE;QACF,EAAE;QACF,EAAE;QACF,EAAE;QACF,EAAE;QACF,CAAC;QACD,EAAE;QACF,EAAE;QACF,EAAE;QACF,EAAE;QACF,EAAE;QACF,EAAE;QACF,EAAE;QACF,MAAM;QACN,WAAW;QACX,WAAW;QACX,KAAK;QACL,MAAM;QACN,QAAQ;QACR,QAAQ;QACR,SAAS;QACT,SAAS;QACT,IAAI;QACJ,QAAQ;QACR,UAAU;QACV,SAAS;QACT,SAAS;QACT,QAAQ;QACR,GAAG;QACH,MAAM;QACN,IAAI;QACJ,KAAK;QACL,QAAQ;QACR,MAAM;QACN,OAAO;KACR,CAAC,CAAC;IAEH,OAAO,CACL,CAAC,UAAU,CACT,IAAI,WAAW,CAAC,CAChB,qBAAqB,CAAC,CAAC,qBAAqB,CAAC,CAC7C,KAAK,CAAC,CAAC,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC,CAEzB;MAAA,CAAC,QAAQ,CACX;IAAA,EAAE,UAAU,CAAC,CACd,CAAC;AACJ,CAAC","sourcesContent":["import React from 'react';\nimport {\n ScrollView,\n type ScrollViewProps as ReactNativeScrollViewProps,\n type StyleProp,\n type ViewStyle,\n} from 'react-native';\n\nimport { useResponsiveRuntime } from '../core/responsive';\nimport { useTheme } from '../theme/ThemeContext';\nimport { type BoxStyleProps, resolveBoxStyles } from './helpers';\n\nexport interface ScrollAreaProps\n extends\n BoxStyleProps,\n Omit<ReactNativeScrollViewProps, 'children' | 'contentContainerStyle' | 'style'> {\n children?: React.ReactNode;\n contentContainerStyle?: StyleProp<ViewStyle>;\n}\n\nexport function ScrollArea({\n children,\n contentContainerStyle,\n p,\n px,\n py,\n pt,\n pb,\n pl,\n pr,\n m,\n mx,\n my,\n mt,\n mb,\n ml,\n mr,\n bg,\n radius,\n borderWidth,\n borderColor,\n width,\n height,\n minWidth,\n maxWidth,\n minHeight,\n maxHeight,\n flex,\n flexGrow,\n flexShrink,\n flexBasis,\n alignSelf,\n position,\n top,\n bottom,\n left,\n right,\n overflow,\n zIndex,\n opacity,\n style,\n ...scrollProps\n}: ScrollAreaProps) {\n const { theme } = useTheme();\n const { breakpoint } = useResponsiveRuntime();\n const resolved = resolveBoxStyles(theme, breakpoint, {\n p,\n px,\n py,\n pt,\n pb,\n pl,\n pr,\n m,\n mx,\n my,\n mt,\n mb,\n ml,\n mr,\n bg,\n radius,\n borderWidth,\n borderColor,\n width,\n height,\n minWidth,\n maxWidth,\n minHeight,\n maxHeight,\n flex,\n flexGrow,\n flexShrink,\n flexBasis,\n alignSelf,\n position,\n top,\n bottom,\n left,\n right,\n overflow,\n zIndex,\n opacity,\n });\n\n return (\n <ScrollView\n {...scrollProps}\n contentContainerStyle={contentContainerStyle}\n style={[resolved, style]}\n >\n {children}\n </ScrollView>\n );\n}\n"]}
|
package/dist/layout/index.d.ts
CHANGED
|
@@ -12,6 +12,8 @@ export type { GridProps } from './Grid';
|
|
|
12
12
|
export { Grid } from './Grid';
|
|
13
13
|
export type { InlineProps } from './Inline';
|
|
14
14
|
export { Inline } from './Inline';
|
|
15
|
+
export type { ScrollAreaProps } from './ScrollArea';
|
|
16
|
+
export { ScrollArea } from './ScrollArea';
|
|
15
17
|
export type { ShowProps } from './Show';
|
|
16
18
|
export { Show } from './Show';
|
|
17
19
|
export type { SpacerProps } from './Spacer';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/layout/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAC5C,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,YAAY,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACtC,OAAO,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAC5B,YAAY,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAC5C,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,YAAY,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,YAAY,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAC9C,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,YAAY,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AACxC,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC9B,YAAY,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAC5C,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,YAAY,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AACxC,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC9B,YAAY,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAC5C,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,YAAY,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAC1C,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,YAAY,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAC9D,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,YAAY,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAChD,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/layout/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAC5C,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,YAAY,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACtC,OAAO,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAC5B,YAAY,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAC5C,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,YAAY,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,YAAY,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAC9C,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,YAAY,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AACxC,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC9B,YAAY,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAC5C,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,YAAY,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AACpD,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,YAAY,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AACxC,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC9B,YAAY,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAC5C,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,YAAY,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAC1C,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,YAAY,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAC9D,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,YAAY,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAChD,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC"}
|
package/dist/layout/index.js
CHANGED
|
@@ -5,6 +5,7 @@ export { Container } from './Container';
|
|
|
5
5
|
export { Divider } from './Divider';
|
|
6
6
|
export { Grid } from './Grid';
|
|
7
7
|
export { Inline } from './Inline';
|
|
8
|
+
export { ScrollArea } from './ScrollArea';
|
|
8
9
|
export { Show } from './Show';
|
|
9
10
|
export { Spacer } from './Spacer';
|
|
10
11
|
export { Stack } from './Stack';
|
package/dist/layout/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/layout/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAElC,OAAO,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAE5B,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAElC,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAE9B,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAElC,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAE9B,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAElC,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAEhC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC","sourcesContent":["export type { AppBarProps } from './AppBar';\nexport { AppBar } from './AppBar';\nexport type { BoxProps } from './Box';\nexport { Box } from './Box';\nexport type { CenterProps } from './Center';\nexport { Center } from './Center';\nexport type { ContainerProps } from './Container';\nexport { Container } from './Container';\nexport type { DividerProps } from './Divider';\nexport { Divider } from './Divider';\nexport type { GridProps } from './Grid';\nexport { Grid } from './Grid';\nexport type { InlineProps } from './Inline';\nexport { Inline } from './Inline';\nexport type { ShowProps } from './Show';\nexport { Show } from './Show';\nexport type { SpacerProps } from './Spacer';\nexport { Spacer } from './Spacer';\nexport type { StackProps } from './Stack';\nexport { Stack } from './Stack';\nexport type { SurfaceProps, SurfaceVariant } from './Surface';\nexport { Surface } from './Surface';\nexport type { TemplateProps } from './Template';\nexport { Template } from './Template';\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/layout/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAElC,OAAO,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAE5B,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAElC,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAE9B,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAElC,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE1C,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAE9B,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAElC,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAEhC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC","sourcesContent":["export type { AppBarProps } from './AppBar';\nexport { AppBar } from './AppBar';\nexport type { BoxProps } from './Box';\nexport { Box } from './Box';\nexport type { CenterProps } from './Center';\nexport { Center } from './Center';\nexport type { ContainerProps } from './Container';\nexport { Container } from './Container';\nexport type { DividerProps } from './Divider';\nexport { Divider } from './Divider';\nexport type { GridProps } from './Grid';\nexport { Grid } from './Grid';\nexport type { InlineProps } from './Inline';\nexport { Inline } from './Inline';\nexport type { ScrollAreaProps } from './ScrollArea';\nexport { ScrollArea } from './ScrollArea';\nexport type { ShowProps } from './Show';\nexport { Show } from './Show';\nexport type { SpacerProps } from './Spacer';\nexport { Spacer } from './Spacer';\nexport type { StackProps } from './Stack';\nexport { Stack } from './Stack';\nexport type { SurfaceProps, SurfaceVariant } from './Surface';\nexport { Surface } from './Surface';\nexport type { TemplateProps } from './Template';\nexport { Template } from './Template';\n"]}
|
package/package.json
CHANGED
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import {
|
|
3
|
+
ScrollView,
|
|
4
|
+
type ScrollViewProps as ReactNativeScrollViewProps,
|
|
5
|
+
type StyleProp,
|
|
6
|
+
type ViewStyle,
|
|
7
|
+
} from 'react-native';
|
|
8
|
+
|
|
9
|
+
import { useResponsiveRuntime } from '../core/responsive';
|
|
10
|
+
import { useTheme } from '../theme/ThemeContext';
|
|
11
|
+
import { type BoxStyleProps, resolveBoxStyles } from './helpers';
|
|
12
|
+
|
|
13
|
+
export interface ScrollAreaProps
|
|
14
|
+
extends
|
|
15
|
+
BoxStyleProps,
|
|
16
|
+
Omit<ReactNativeScrollViewProps, 'children' | 'contentContainerStyle' | 'style'> {
|
|
17
|
+
children?: React.ReactNode;
|
|
18
|
+
contentContainerStyle?: StyleProp<ViewStyle>;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export function ScrollArea({
|
|
22
|
+
children,
|
|
23
|
+
contentContainerStyle,
|
|
24
|
+
p,
|
|
25
|
+
px,
|
|
26
|
+
py,
|
|
27
|
+
pt,
|
|
28
|
+
pb,
|
|
29
|
+
pl,
|
|
30
|
+
pr,
|
|
31
|
+
m,
|
|
32
|
+
mx,
|
|
33
|
+
my,
|
|
34
|
+
mt,
|
|
35
|
+
mb,
|
|
36
|
+
ml,
|
|
37
|
+
mr,
|
|
38
|
+
bg,
|
|
39
|
+
radius,
|
|
40
|
+
borderWidth,
|
|
41
|
+
borderColor,
|
|
42
|
+
width,
|
|
43
|
+
height,
|
|
44
|
+
minWidth,
|
|
45
|
+
maxWidth,
|
|
46
|
+
minHeight,
|
|
47
|
+
maxHeight,
|
|
48
|
+
flex,
|
|
49
|
+
flexGrow,
|
|
50
|
+
flexShrink,
|
|
51
|
+
flexBasis,
|
|
52
|
+
alignSelf,
|
|
53
|
+
position,
|
|
54
|
+
top,
|
|
55
|
+
bottom,
|
|
56
|
+
left,
|
|
57
|
+
right,
|
|
58
|
+
overflow,
|
|
59
|
+
zIndex,
|
|
60
|
+
opacity,
|
|
61
|
+
style,
|
|
62
|
+
...scrollProps
|
|
63
|
+
}: ScrollAreaProps) {
|
|
64
|
+
const { theme } = useTheme();
|
|
65
|
+
const { breakpoint } = useResponsiveRuntime();
|
|
66
|
+
const resolved = resolveBoxStyles(theme, breakpoint, {
|
|
67
|
+
p,
|
|
68
|
+
px,
|
|
69
|
+
py,
|
|
70
|
+
pt,
|
|
71
|
+
pb,
|
|
72
|
+
pl,
|
|
73
|
+
pr,
|
|
74
|
+
m,
|
|
75
|
+
mx,
|
|
76
|
+
my,
|
|
77
|
+
mt,
|
|
78
|
+
mb,
|
|
79
|
+
ml,
|
|
80
|
+
mr,
|
|
81
|
+
bg,
|
|
82
|
+
radius,
|
|
83
|
+
borderWidth,
|
|
84
|
+
borderColor,
|
|
85
|
+
width,
|
|
86
|
+
height,
|
|
87
|
+
minWidth,
|
|
88
|
+
maxWidth,
|
|
89
|
+
minHeight,
|
|
90
|
+
maxHeight,
|
|
91
|
+
flex,
|
|
92
|
+
flexGrow,
|
|
93
|
+
flexShrink,
|
|
94
|
+
flexBasis,
|
|
95
|
+
alignSelf,
|
|
96
|
+
position,
|
|
97
|
+
top,
|
|
98
|
+
bottom,
|
|
99
|
+
left,
|
|
100
|
+
right,
|
|
101
|
+
overflow,
|
|
102
|
+
zIndex,
|
|
103
|
+
opacity,
|
|
104
|
+
});
|
|
105
|
+
|
|
106
|
+
return (
|
|
107
|
+
<ScrollView
|
|
108
|
+
{...scrollProps}
|
|
109
|
+
contentContainerStyle={contentContainerStyle}
|
|
110
|
+
style={[resolved, style]}
|
|
111
|
+
>
|
|
112
|
+
{children}
|
|
113
|
+
</ScrollView>
|
|
114
|
+
);
|
|
115
|
+
}
|
package/src/layout/index.ts
CHANGED
|
@@ -12,6 +12,8 @@ export type { GridProps } from './Grid';
|
|
|
12
12
|
export { Grid } from './Grid';
|
|
13
13
|
export type { InlineProps } from './Inline';
|
|
14
14
|
export { Inline } from './Inline';
|
|
15
|
+
export type { ScrollAreaProps } from './ScrollArea';
|
|
16
|
+
export { ScrollArea } from './ScrollArea';
|
|
15
17
|
export type { ShowProps } from './Show';
|
|
16
18
|
export { Show } from './Show';
|
|
17
19
|
export type { SpacerProps } from './Spacer';
|