@proulr/sdui-components 0.1.13 → 0.1.15
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/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { ScrollView, StyleSheet, Text, View } from 'react-native';
|
|
2
|
+
import { Platform, ScrollView, StyleSheet, Text, View } from 'react-native';
|
|
3
3
|
import type { SduiBlock } from '@proulr/sdui-contract';
|
|
4
4
|
import { AppButton } from '../ui/AppButton';
|
|
5
5
|
import { colors, m3Type, spacing } from '../theme/proulr-theme';
|
|
@@ -91,15 +91,23 @@ export function SduiScrollBlock({ block, children }: SduiBlockRenderProps) {
|
|
|
91
91
|
return (
|
|
92
92
|
<SduiLayoutDebugFrame layer="scroll" style={{ flex: 1, minHeight: 0, alignSelf: 'stretch' }}>
|
|
93
93
|
<ScrollView
|
|
94
|
-
style={[
|
|
94
|
+
style={[
|
|
95
|
+
styles.scroll,
|
|
96
|
+
resolveViewStyleProps(block.props.style as Record<string, unknown>),
|
|
97
|
+
Platform.OS === 'web'
|
|
98
|
+
? ({ touchAction: 'pan-y', WebkitOverflowScrolling: 'touch' } as object)
|
|
99
|
+
: null,
|
|
100
|
+
]}
|
|
95
101
|
contentContainerStyle={
|
|
96
102
|
chromeScroll
|
|
97
103
|
? [chromeScroll.contentContainerStyle, blockContentStyle]
|
|
98
104
|
: blockContentStyle
|
|
99
105
|
}
|
|
100
106
|
{...(chromeScroll?.scrollInsetProps ?? {})}
|
|
107
|
+
{...(chromeScroll?.scrollViewProps ?? {})}
|
|
101
108
|
onScroll={chromeScroll?.onScroll}
|
|
102
|
-
scrollEventThrottle={chromeScroll?.onScroll ? 16 : undefined}
|
|
109
|
+
scrollEventThrottle={chromeScroll?.onScroll || chromeScroll?.scrollViewProps ? 16 : undefined}
|
|
110
|
+
refreshControl={chromeScroll?.refreshControl}
|
|
103
111
|
showsVerticalScrollIndicator={false}
|
|
104
112
|
>
|
|
105
113
|
{children}
|
|
@@ -1,5 +1,10 @@
|
|
|
1
|
-
import React, { createContext, useContext, type ReactNode } from 'react';
|
|
2
|
-
import type {
|
|
1
|
+
import React, { createContext, useContext, type ReactElement, type ReactNode } from 'react';
|
|
2
|
+
import type {
|
|
3
|
+
NativeScrollEvent,
|
|
4
|
+
NativeSyntheticEvent,
|
|
5
|
+
RefreshControlProps,
|
|
6
|
+
ViewStyle,
|
|
7
|
+
} from 'react-native';
|
|
3
8
|
|
|
4
9
|
export type SduiChromeScrollInsetProps = {
|
|
5
10
|
contentInset?: { top: number; bottom: number };
|
|
@@ -20,6 +25,10 @@ export type SduiChromeScrollConfig = {
|
|
|
20
25
|
contentContainerStyle: ViewStyle;
|
|
21
26
|
chromeInsets: SduiChromeScrollInsets;
|
|
22
27
|
onScroll?: (event: NativeSyntheticEvent<NativeScrollEvent>) => void;
|
|
28
|
+
/** Pull-to-refresh (Caçar e outras listas full-bleed SDUI). */
|
|
29
|
+
refreshControl?: ReactElement<RefreshControlProps>;
|
|
30
|
+
/** Extra ScrollView props (ex.: touch handlers do pull web). */
|
|
31
|
+
scrollViewProps?: Record<string, unknown>;
|
|
23
32
|
};
|
|
24
33
|
|
|
25
34
|
const SduiChromeScrollContext = createContext<SduiChromeScrollConfig | null>(null);
|