@idealyst/components 1.2.46 → 1.2.47

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,6 +1,6 @@
1
1
  {
2
2
  "name": "@idealyst/components",
3
- "version": "1.2.46",
3
+ "version": "1.2.47",
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.46",
59
+ "@idealyst/theme": "^1.2.47",
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.46",
110
+ "@idealyst/theme": "^1.2.47",
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 { useEffect, forwardRef, useMemo } from 'react';
2
- import { Modal, View, Text, TouchableOpacity, TouchableWithoutFeedback, BackHandler, GestureResponderEvent } from 'react-native';
2
+ import { Modal, View, Text, TouchableOpacity, TouchableWithoutFeedback, BackHandler, GestureResponderEvent, KeyboardAvoidingView, Platform } from 'react-native';
3
3
  import Animated, { useSharedValue, useAnimatedStyle, withTiming, Easing } from 'react-native-reanimated';
4
4
  import { DialogProps } from './types';
5
5
  import { dialogStyles } from './Dialog.styles';
@@ -15,6 +15,7 @@ const Dialog = forwardRef<View, DialogProps>(({
15
15
  showCloseButton = true,
16
16
  closeOnBackdropClick = true,
17
17
  animationType: _animationType = 'fade',
18
+ avoidKeyboard = false,
18
19
  style,
19
20
  testID,
20
21
  id,
@@ -175,6 +176,23 @@ const Dialog = forwardRef<View, DialogProps>(({
175
176
  </TouchableWithoutFeedback>
176
177
  );
177
178
 
179
+ const modalContent = (
180
+ <TouchableWithoutFeedback onPress={handleBackdropPress}>
181
+ {BackdropComponent ? (
182
+ <View style={customBackdropWrapperStyle}>
183
+ <Animated.View style={[customBackdropContainerStyle, backdropAnimatedStyle]}>
184
+ <BackdropComponent isVisible={open} />
185
+ </Animated.View>
186
+ {dialogContainer}
187
+ </View>
188
+ ) : (
189
+ <Animated.View style={[backdropStyle, backdropAnimatedStyle]}>
190
+ {dialogContainer}
191
+ </Animated.View>
192
+ )}
193
+ </TouchableWithoutFeedback>
194
+ );
195
+
178
196
  return (
179
197
  <Modal
180
198
  visible={open}
@@ -184,20 +202,16 @@ const Dialog = forwardRef<View, DialogProps>(({
184
202
  statusBarTranslucent
185
203
  testID={testID}
186
204
  >
187
- <TouchableWithoutFeedback onPress={handleBackdropPress}>
188
- {BackdropComponent ? (
189
- <View style={customBackdropWrapperStyle}>
190
- <Animated.View style={[customBackdropContainerStyle, backdropAnimatedStyle]}>
191
- <BackdropComponent isVisible={open} />
192
- </Animated.View>
193
- {dialogContainer}
194
- </View>
195
- ) : (
196
- <Animated.View style={[backdropStyle, backdropAnimatedStyle]}>
197
- {dialogContainer}
198
- </Animated.View>
199
- )}
200
- </TouchableWithoutFeedback>
205
+ {avoidKeyboard ? (
206
+ <KeyboardAvoidingView
207
+ style={{ flex: 1 }}
208
+ behavior={Platform.OS === 'ios' ? 'padding' : 'height'}
209
+ >
210
+ {modalContent}
211
+ </KeyboardAvoidingView>
212
+ ) : (
213
+ modalContent
214
+ )}
201
215
  </Modal>
202
216
  );
203
217
  });
@@ -89,4 +89,11 @@ export interface DialogProps extends BaseProps, InteractiveAccessibilityProps {
89
89
  * It receives isVisible for animation coordination.
90
90
  */
91
91
  BackdropComponent?: ComponentType<BackdropComponentProps>;
92
+
93
+ /**
94
+ * Whether the dialog should avoid the keyboard on mobile (native only).
95
+ * When true, the dialog content will shift up when the keyboard is shown.
96
+ * @default false
97
+ */
98
+ avoidKeyboard?: boolean;
92
99
  }