@oneplatformdev/react-native-uikit 1.2.7 → 1.2.8
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/README.md
CHANGED
|
@@ -343,6 +343,20 @@ Owned source is available with `npx @oneplatformdev/react-native-uikit add photo
|
|
|
343
343
|
|
|
344
344
|
`ScreenContainer` provides a theme-backed safe-area layout, optional scrolling, and optional keyboard-aware scrolling or avoidance. Pass `gradient={{ colors, locations, start, end }}` to render a caller-configured background across the entire screen, behind the safe-area content; omit it for the solid theme background. Gradient coordinates are normalized and are not scaled. Pass ordinary ScrollView props when scrolling is enabled; use `containerStyle` and `contentContainerStyle` for layout overrides.
|
|
345
345
|
|
|
346
|
+
Pass `background={<DecorativeBackground />}` for an application-owned, full-screen layer behind the safe-area content. It replaces `gradient` when both are supplied, does not affect layout, and cannot intercept touches. Pass `overlay={<FloatingAction />}` for a full-screen layer above the content; empty parts of that layer pass touches through, while its interactive children remain usable. The consumer owns each overlay child's position, safe-area offsets, visibility, and interactions.
|
|
347
|
+
|
|
348
|
+
For non-scrolling keyboard avoidance, omitting `keyboardAvoidingBehavior` keeps the default `behavior="padding"`; `keyboardAvoidingBehavior={null}` omits the behavior prop; an explicit behavior is forwarded. Keyboard-aware scrolling is unchanged.
|
|
349
|
+
|
|
350
|
+
```tsx
|
|
351
|
+
<ScreenContainer background={<DecorativeBackground />} overlay={<FloatingAction />}>
|
|
352
|
+
<Content />
|
|
353
|
+
</ScreenContainer>
|
|
354
|
+
|
|
355
|
+
<ScreenContainer isKeyboardAvoiding keyboardAvoidingBehavior={null}>
|
|
356
|
+
<Form />
|
|
357
|
+
</ScreenContainer>
|
|
358
|
+
```
|
|
359
|
+
|
|
346
360
|
`CustomAlert` animates a centered modal with a dismissible backdrop. Supply `header`, children, and optional `footer` content; compose your own actions with `Button`. Optional `closeAction` accepts an icon and an application-supplied accessibility label. No strings are translated by the kit.
|
|
347
361
|
|
|
348
362
|
`BottomModal` provides the reference-style slide/drag dismissal and keyboard-height-aware positioning. Supply `children`, `onClose`, and optionally `title`, `customHeader`, and a labeled `closeAction` icon. `Keyboard.dismiss()` and the close animation start together; `closeRef` can trigger the same close path externally. The kit does not render app-specific toasts.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ComponentRef, ReactNode, Ref } from 'react';
|
|
2
2
|
import type { ScrollView, ScrollViewProps, StyleProp, ViewStyle } from 'react-native';
|
|
3
|
-
import type { KeyboardAwareScrollViewRef } from 'react-native-keyboard-controller';
|
|
3
|
+
import type { KeyboardAwareScrollViewRef, KeyboardAvoidingViewProps } from 'react-native-keyboard-controller';
|
|
4
4
|
import type { LinearGradientProps } from 'react-native-linear-gradient';
|
|
5
5
|
import type { Edge } from 'react-native-safe-area-context';
|
|
6
6
|
|
|
@@ -14,7 +14,10 @@ export interface ScreenContainerProps extends Omit<ScrollViewProps, 'children' |
|
|
|
14
14
|
contentContainerStyle?: StyleProp<ViewStyle>;
|
|
15
15
|
headerComponent?: ReactNode;
|
|
16
16
|
footerComponent?: ReactNode;
|
|
17
|
+
background?: ReactNode;
|
|
18
|
+
overlay?: ReactNode;
|
|
17
19
|
scrollViewRef?: Ref<ComponentRef<typeof ScrollView>>;
|
|
18
20
|
keyboardScrollViewRef?: Ref<KeyboardAwareScrollViewRef>;
|
|
21
|
+
keyboardAvoidingBehavior?: KeyboardAvoidingViewProps['behavior'] | null;
|
|
19
22
|
gradient?: ScreenContainerGradient;
|
|
20
23
|
}
|
|
@@ -18,8 +18,11 @@ export const ScreenContainer = ({
|
|
|
18
18
|
contentContainerStyle,
|
|
19
19
|
headerComponent,
|
|
20
20
|
footerComponent,
|
|
21
|
+
background,
|
|
22
|
+
overlay,
|
|
21
23
|
scrollViewRef,
|
|
22
24
|
keyboardScrollViewRef,
|
|
25
|
+
keyboardAvoidingBehavior,
|
|
23
26
|
keyboardShouldPersistTaps = 'handled',
|
|
24
27
|
showsVerticalScrollIndicator = false,
|
|
25
28
|
gradient,
|
|
@@ -30,10 +33,17 @@ export const ScreenContainer = ({
|
|
|
30
33
|
const styles = useMemo(() => getStyles(colors), [colors]);
|
|
31
34
|
const bottomOffset = getBottomOffset(spacing, scaling);
|
|
32
35
|
const { onContainerStartShouldSetResponder, onContainerResponderRelease } = useScreenContainer();
|
|
36
|
+
const keyboardAvoidingViewProps = keyboardAvoidingBehavior === null
|
|
37
|
+
? {}
|
|
38
|
+
: { behavior: keyboardAvoidingBehavior ?? 'padding' };
|
|
33
39
|
|
|
34
40
|
return (
|
|
35
41
|
<View style={styles.root}>
|
|
36
|
-
{
|
|
42
|
+
{background != null ? (
|
|
43
|
+
<View pointerEvents="none" style={styles.layer}>{background}</View>
|
|
44
|
+
) : gradient ? (
|
|
45
|
+
<LinearGradient {...gradient} pointerEvents="none" style={styles.layer} />
|
|
46
|
+
) : null}
|
|
37
47
|
<SafeAreaView edges={edges} style={styles.safeArea}>
|
|
38
48
|
{headerComponent}
|
|
39
49
|
|
|
@@ -63,7 +73,7 @@ export const ScreenContainer = ({
|
|
|
63
73
|
</ScrollView>
|
|
64
74
|
)
|
|
65
75
|
) : isKeyboardAvoiding ? (
|
|
66
|
-
<KeyboardAvoidingView
|
|
76
|
+
<KeyboardAvoidingView {...keyboardAvoidingViewProps} style={[styles.container, containerStyle]}>
|
|
67
77
|
<View
|
|
68
78
|
style={styles.container}
|
|
69
79
|
onStartShouldSetResponder={onContainerStartShouldSetResponder}
|
|
@@ -78,6 +88,9 @@ export const ScreenContainer = ({
|
|
|
78
88
|
|
|
79
89
|
{footerComponent}
|
|
80
90
|
</SafeAreaView>
|
|
91
|
+
{overlay != null ? (
|
|
92
|
+
<View pointerEvents="box-none" style={styles.layer}>{overlay}</View>
|
|
93
|
+
) : null}
|
|
81
94
|
</View>
|
|
82
95
|
);
|
|
83
96
|
};
|