@idealyst/components 1.2.43 → 1.2.44
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 +3 -3
- package/src/Screen/Screen.native.tsx +29 -16
- package/src/Screen/types.ts +8 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@idealyst/components",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.44",
|
|
4
4
|
"description": "Shared component library for React and React Native",
|
|
5
5
|
"documentation": "https://github.com/IdealystIO/idealyst-framework/tree/main/packages/components#readme",
|
|
6
6
|
"readme": "README.md",
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
"publish:npm": "npm publish"
|
|
57
57
|
},
|
|
58
58
|
"peerDependencies": {
|
|
59
|
-
"@idealyst/theme": "^1.2.
|
|
59
|
+
"@idealyst/theme": "^1.2.44",
|
|
60
60
|
"@mdi/js": ">=7.0.0",
|
|
61
61
|
"@mdi/react": ">=1.0.0",
|
|
62
62
|
"@react-native-vector-icons/common": ">=12.0.0",
|
|
@@ -107,7 +107,7 @@
|
|
|
107
107
|
},
|
|
108
108
|
"devDependencies": {
|
|
109
109
|
"@idealyst/blur": "^1.2.40",
|
|
110
|
-
"@idealyst/theme": "^1.2.
|
|
110
|
+
"@idealyst/theme": "^1.2.44",
|
|
111
111
|
"@idealyst/tooling": "^1.2.30",
|
|
112
112
|
"@mdi/react": "^1.6.1",
|
|
113
113
|
"@types/react": "^19.1.0",
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { forwardRef } from 'react';
|
|
2
|
-
import { View as RNView, ScrollView as RNScrollView } from 'react-native';
|
|
2
|
+
import { View as RNView, ScrollView as RNScrollView, KeyboardAvoidingView, Platform } from 'react-native';
|
|
3
3
|
import { useSafeAreaInsets } from 'react-native-safe-area-context';
|
|
4
4
|
import { ScreenProps } from './types';
|
|
5
5
|
import { screenStyles } from './Screen.styles';
|
|
@@ -10,6 +10,7 @@ const Screen = forwardRef<IdealystElement, ScreenProps>(({
|
|
|
10
10
|
background = 'screen',
|
|
11
11
|
safeArea = true,
|
|
12
12
|
scrollable = true,
|
|
13
|
+
avoidKeyboard = true,
|
|
13
14
|
contentInset,
|
|
14
15
|
onLayout,
|
|
15
16
|
// Spacing variants from ContainerStyleProps
|
|
@@ -54,6 +55,13 @@ const Screen = forwardRef<IdealystElement, ScreenProps>(({
|
|
|
54
55
|
paddingRight: insets.right,
|
|
55
56
|
} : undefined;
|
|
56
57
|
|
|
58
|
+
// Wrapper component for keyboard avoidance
|
|
59
|
+
const KeyboardWrapper = avoidKeyboard ? KeyboardAvoidingView : RNView;
|
|
60
|
+
const keyboardWrapperProps = avoidKeyboard ? {
|
|
61
|
+
behavior: Platform.OS === 'ios' ? 'padding' as const : 'height' as const,
|
|
62
|
+
style: { flex: 1 },
|
|
63
|
+
} : { style: { flex: 1 } };
|
|
64
|
+
|
|
57
65
|
if (scrollable) {
|
|
58
66
|
// Content styles applied via View wrapper for Unistyles reactivity
|
|
59
67
|
// (contentContainerStyle isn't reactive, only style prop is)
|
|
@@ -65,25 +73,30 @@ const Screen = forwardRef<IdealystElement, ScreenProps>(({
|
|
|
65
73
|
} : safeAreaStyle;
|
|
66
74
|
|
|
67
75
|
return (
|
|
68
|
-
<
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
76
|
+
<KeyboardWrapper {...keyboardWrapperProps}>
|
|
77
|
+
<RNScrollView
|
|
78
|
+
ref={ref as any}
|
|
79
|
+
nativeID={id}
|
|
80
|
+
style={[screenStyle, style]}
|
|
81
|
+
contentContainerStyle={{ flexGrow: 1 }}
|
|
82
|
+
testID={testID}
|
|
83
|
+
onLayout={onLayout}
|
|
84
|
+
keyboardShouldPersistTaps="handled"
|
|
85
|
+
>
|
|
86
|
+
<RNView style={[contentInsetStyle, { flex: 1 }]}>
|
|
87
|
+
{children}
|
|
88
|
+
</RNView>
|
|
89
|
+
</RNScrollView>
|
|
90
|
+
</KeyboardWrapper>
|
|
80
91
|
);
|
|
81
92
|
}
|
|
82
93
|
|
|
83
94
|
return (
|
|
84
|
-
<
|
|
85
|
-
{
|
|
86
|
-
|
|
95
|
+
<KeyboardWrapper {...keyboardWrapperProps}>
|
|
96
|
+
<RNView ref={ref as any} nativeID={id} style={[screenStyle, safeAreaStyle, style]} testID={testID} onLayout={onLayout}>
|
|
97
|
+
{children}
|
|
98
|
+
</RNView>
|
|
99
|
+
</KeyboardWrapper>
|
|
87
100
|
);
|
|
88
101
|
});
|
|
89
102
|
|
package/src/Screen/types.ts
CHANGED
|
@@ -51,6 +51,14 @@ export interface ScreenProps extends ContainerStyleProps {
|
|
|
51
51
|
*/
|
|
52
52
|
scrollable?: boolean;
|
|
53
53
|
|
|
54
|
+
/**
|
|
55
|
+
* Whether to avoid the keyboard on native platforms (iOS/Android).
|
|
56
|
+
* When enabled, content will shift up when the keyboard appears.
|
|
57
|
+
* @default true
|
|
58
|
+
* @platform native
|
|
59
|
+
*/
|
|
60
|
+
avoidKeyboard?: boolean;
|
|
61
|
+
|
|
54
62
|
/**
|
|
55
63
|
* Called when the layout of the screen changes.
|
|
56
64
|
* Provides the new width, height, x, and y coordinates.
|