@oneplatformdev/react-native-uikit 1.2.6 → 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 +16 -1
- package/package.json +1 -1
- package/src/components/ScreenContainer/types/types.ts +4 -1
- package/src/components/ScreenContainer/ui/ScreenContainer.tsx +15 -2
- package/src/components/ScreenContainer/ui/styles.ts +1 -1
- package/src/components/Typography/ui/styles.ts +2 -2
- package/src/theme/types.ts +1 -0
package/README.md
CHANGED
|
@@ -96,6 +96,7 @@ export const typography = {
|
|
|
96
96
|
font: 'extraBold',
|
|
97
97
|
fontSize: 18,
|
|
98
98
|
lineHeight: 24,
|
|
99
|
+
color: 'premium',
|
|
99
100
|
},
|
|
100
101
|
} as const;
|
|
101
102
|
```
|
|
@@ -209,7 +210,7 @@ Package import: `import { Typography } from '@oneplatformdev/react-native-uikit'
|
|
|
209
210
|
<Typography variant="body">Hello</Typography>
|
|
210
211
|
```
|
|
211
212
|
|
|
212
|
-
Prefer `text` (`string | number`) for simple content. Use `children` for composed or custom content; TypeScript disallows supplying both, and neither is also valid. Typography retains React Native `TextProps`, styles, and ref forwarding. Its main visual props are `variant`, `weight`, `color`, `size`, and `lineHeight
|
|
213
|
+
Prefer `text` (`string | number`) for simple content. Use `children` for composed or custom content; TypeScript disallows supplying both, and neither is also valid. Typography retains React Native `TextProps`, styles, and ref forwarding. Its main visual props are `variant`, `weight`, `color`, `size`, and `lineHeight`. A variant may define an optional `color` token; an explicit `color` prop overrides it, otherwise Typography uses the theme's `text` color. Caller `style` is applied last and can override either color. Customize typography/font/color tokens through `createTheme` and the extension interfaces described above. Owned/local source installation: **available** with `npx @oneplatformdev/react-native-uikit add typography`.
|
|
213
214
|
|
|
214
215
|
## Button
|
|
215
216
|
|
|
@@ -342,6 +343,20 @@ Owned source is available with `npx @oneplatformdev/react-native-uikit add photo
|
|
|
342
343
|
|
|
343
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.
|
|
344
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
|
+
|
|
345
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.
|
|
346
361
|
|
|
347
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
|
};
|
|
@@ -8,7 +8,7 @@ type TypographyStyleProps = Pick<TypographyProps, 'variant' | 'weight' | 'color'
|
|
|
8
8
|
export const getTypographyStyle = (
|
|
9
9
|
{ colors, fonts, typography }: UITheme,
|
|
10
10
|
scaling: ScalingFunctions,
|
|
11
|
-
{ variant = 'body', weight, color
|
|
11
|
+
{ variant = 'body', weight, color, size, lineHeight }: TypographyStyleProps,
|
|
12
12
|
): TextStyle => {
|
|
13
13
|
const token = typography[variant] as UITypographyToken;
|
|
14
14
|
const font = fonts[weight ?? token.font];
|
|
@@ -16,7 +16,7 @@ export const getTypographyStyle = (
|
|
|
16
16
|
|
|
17
17
|
return {
|
|
18
18
|
...font,
|
|
19
|
-
color: colors[color],
|
|
19
|
+
color: colors[color ?? token.color ?? 'text'],
|
|
20
20
|
fontSize: scaling.scaleFontSize(size ?? token.fontSize),
|
|
21
21
|
lineHeight: resolvedLineHeight === undefined ? undefined : scaling.scaleLineHeight(resolvedLineHeight),
|
|
22
22
|
letterSpacing: token.letterSpacing,
|
package/src/theme/types.ts
CHANGED
|
@@ -102,6 +102,7 @@ export type UIRadius = DefaultUIRadius & ExtendedUIRadius;
|
|
|
102
102
|
export type UITypographyToken = {
|
|
103
103
|
font: UIFontKey;
|
|
104
104
|
fontSize: number;
|
|
105
|
+
color?: UIColorKey;
|
|
105
106
|
lineHeight?: number;
|
|
106
107
|
letterSpacing?: number;
|
|
107
108
|
includeFontPadding?: TextStyle['includeFontPadding'];
|