@proulr/sdui-components 0.1.14 → 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,22 @@ 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}
|
|
103
110
|
refreshControl={chromeScroll?.refreshControl}
|
|
104
111
|
showsVerticalScrollIndicator={false}
|
|
105
112
|
>
|
|
@@ -27,6 +27,8 @@ export type SduiChromeScrollConfig = {
|
|
|
27
27
|
onScroll?: (event: NativeSyntheticEvent<NativeScrollEvent>) => void;
|
|
28
28
|
/** Pull-to-refresh (Caçar e outras listas full-bleed SDUI). */
|
|
29
29
|
refreshControl?: ReactElement<RefreshControlProps>;
|
|
30
|
+
/** Extra ScrollView props (ex.: touch handlers do pull web). */
|
|
31
|
+
scrollViewProps?: Record<string, unknown>;
|
|
30
32
|
};
|
|
31
33
|
|
|
32
34
|
const SduiChromeScrollContext = createContext<SduiChromeScrollConfig | null>(null);
|