@xaui/native 0.2.1 → 0.2.3

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.
@@ -18,8 +18,8 @@ var _reactnative = require('react-native');
18
18
 
19
19
 
20
20
 
21
-
22
21
  var _reactnativereanimated = require('react-native-reanimated'); var _reactnativereanimated2 = _interopRequireDefault(_reactnativereanimated);
22
+ var _reactnativeworklets = require('react-native-worklets');
23
23
 
24
24
  // src/components/alert/alert.style.ts
25
25
 
@@ -254,7 +254,7 @@ var Alert = ({
254
254
  opacity.value = _reactnativereanimated.withTiming.call(void 0, 0, { duration: 250 });
255
255
  scale.value = _reactnativereanimated.withTiming.call(void 0, 0.95, { duration: 250 }, (finished) => {
256
256
  if (finished) {
257
- _reactnativereanimated.runOnJS.call(void 0, finishClosing)();
257
+ _reactnativeworklets.scheduleOnRN.call(void 0, finishClosing);
258
258
  }
259
259
  });
260
260
  }, [finishClosing, opacity, scale, visible]);
@@ -15,11 +15,11 @@ import React2, {
15
15
  } from "react";
16
16
  import { Pressable, Text, View } from "react-native";
17
17
  import Animated, {
18
- useSharedValue,
19
18
  useAnimatedStyle,
20
- withTiming,
21
- runOnJS
19
+ useSharedValue,
20
+ withTiming
22
21
  } from "react-native-reanimated";
22
+ import { scheduleOnRN } from "react-native-worklets";
23
23
 
24
24
  // src/components/alert/alert.style.ts
25
25
  import { StyleSheet } from "react-native";
@@ -254,7 +254,7 @@ var Alert = ({
254
254
  opacity.value = withTiming(0, { duration: 250 });
255
255
  scale.value = withTiming(0.95, { duration: 250 }, (finished) => {
256
256
  if (finished) {
257
- runOnJS(finishClosing)();
257
+ scheduleOnRN(finishClosing);
258
258
  }
259
259
  });
260
260
  }, [finishClosing, opacity, scale, visible]);
@@ -19,8 +19,8 @@ var _reactnative = require('react-native');
19
19
 
20
20
 
21
21
 
22
-
23
22
  var _reactnativereanimated = require('react-native-reanimated'); var _reactnativereanimated2 = _interopRequireDefault(_reactnativereanimated);
23
+ var _reactnativeworklets = require('react-native-worklets');
24
24
  var _core = require('@xaui/core');
25
25
  var _icons = require('@xaui/icons');
26
26
 
@@ -263,7 +263,7 @@ var Dialog = ({
263
263
  },
264
264
  (finished) => {
265
265
  if (finished) {
266
- _reactnativereanimated.runOnJS.call(void 0, finishClosing)();
266
+ _reactnativeworklets.scheduleOnRN.call(void 0, finishClosing);
267
267
  }
268
268
  }
269
269
  );
@@ -16,11 +16,11 @@ import React, {
16
16
  import { Modal, Pressable, Text, View } from "react-native";
17
17
  import Animated, {
18
18
  Easing,
19
- runOnJS,
20
19
  useAnimatedStyle,
21
20
  useSharedValue,
22
21
  withTiming
23
22
  } from "react-native-reanimated";
23
+ import { scheduleOnRN } from "react-native-worklets";
24
24
  import { withOpacity } from "@xaui/core";
25
25
  import { CloseIcon } from "@xaui/icons";
26
26
 
@@ -263,7 +263,7 @@ var Dialog = ({
263
263
  },
264
264
  (finished) => {
265
265
  if (finished) {
266
- runOnJS(finishClosing)();
266
+ scheduleOnRN(finishClosing);
267
267
  }
268
268
  }
269
269
  );
@@ -39,7 +39,8 @@ var Column = ({
39
39
  spacing,
40
40
  reverse = false,
41
41
  fullWidth,
42
- style
42
+ style,
43
+ noGrowth = false
43
44
  }) => {
44
45
  const gapStyle = spacing === void 0 ? void 0 : { gap: spacing };
45
46
  const fullWidthStyle = fullWidth ? { width: "100%" } : void 0;
@@ -48,7 +49,7 @@ var Column = ({
48
49
  {
49
50
  style: [
50
51
  {
51
- flex: 1,
52
+ flex: noGrowth ? void 0 : 1,
52
53
  flexDirection: reverse ? "column-reverse" : "column",
53
54
  justifyContent: resolveMainAxisAlignment(mainAxisAlignment),
54
55
  alignItems: resolveCrossAxisAlignment(crossAxisAlignment)
@@ -127,7 +128,8 @@ var Padding = ({
127
128
  bottom,
128
129
  left,
129
130
  fullWidth,
130
- style
131
+ style,
132
+ noGrowth = false
131
133
  }) => {
132
134
  const fullWidthStyle = fullWidth ? { width: "100%" } : void 0;
133
135
  return /* @__PURE__ */ _react2.default.createElement(
@@ -135,7 +137,7 @@ var Padding = ({
135
137
  {
136
138
  style: [
137
139
  {
138
- flex: 1,
140
+ flex: noGrowth ? void 0 : 1,
139
141
  padding: all,
140
142
  paddingHorizontal: horizontal,
141
143
  paddingVertical: vertical,
@@ -166,7 +168,8 @@ var Margin = ({
166
168
  bottom,
167
169
  left,
168
170
  fullWidth,
169
- style
171
+ style,
172
+ noGrowth = false
170
173
  }) => {
171
174
  const fullWidthStyle = fullWidth ? { width: "100%" } : void 0;
172
175
  return /* @__PURE__ */ _react2.default.createElement(
@@ -174,7 +177,7 @@ var Margin = ({
174
177
  {
175
178
  style: [
176
179
  {
177
- flex: 1,
180
+ flex: noGrowth ? void 0 : 1,
178
181
  margin: all,
179
182
  marginHorizontal: horizontal,
180
183
  marginVertical: vertical,
@@ -347,7 +350,8 @@ var RoundedView = ({
347
350
  bottomRight,
348
351
  fullWidth = false,
349
352
  backgroundColor,
350
- style
353
+ style,
354
+ noGrowth = false
351
355
  }) => {
352
356
  const borderRadiusStyle = useRoundedViewStyle({
353
357
  all,
@@ -365,7 +369,8 @@ var RoundedView = ({
365
369
  {
366
370
  style: [
367
371
  borderRadiusStyle,
368
- fullWidth && styles2.fullWidth,
372
+ fullWidth && { width: "100%" },
373
+ noGrowth ? void 0 : { flex: 1 },
369
374
  backgroundColor && { backgroundColor },
370
375
  style
371
376
  ]
@@ -373,14 +378,6 @@ var RoundedView = ({
373
378
  children
374
379
  );
375
380
  };
376
- var styles2 = _reactnative.StyleSheet.create({
377
- fullWidth: {
378
- flexGrow: 1,
379
- flexShrink: 1,
380
- flexBasis: "auto",
381
- width: "100%"
382
- }
383
- });
384
381
 
385
382
  // src/components/view/aspect-ratio/aspect-ratio.tsx
386
383
 
@@ -433,17 +430,53 @@ var Surface = ({
433
430
  };
434
431
  Surface.displayName = "Surface";
435
432
 
433
+ // src/components/view/screen/screen.tsx
434
+
435
+
436
+ var _reactnativesafeareacontext = require('react-native-safe-area-context');
437
+ var Screen = ({
438
+ children,
439
+ padding,
440
+ backgroundColor,
441
+ safeArea = false,
442
+ style
443
+ }) => {
444
+ const theme = _chunk7UFBLUMVcjs.useXUITheme.call(void 0, );
445
+ const resolvedBackgroundColor = _nullishCoalesce(backgroundColor, () => ( theme.colors.background));
446
+ const Container = safeArea ? _reactnativesafeareacontext.SafeAreaView : _reactnative.View;
447
+ return /* @__PURE__ */ _react2.default.createElement(
448
+ Container,
449
+ {
450
+ style: [
451
+ {
452
+ flex: 1,
453
+ backgroundColor: resolvedBackgroundColor,
454
+ padding
455
+ },
456
+ style
457
+ ]
458
+ },
459
+ children
460
+ );
461
+ };
462
+ Screen.displayName = "Screen";
463
+
436
464
  // src/components/view/center/center.tsx
437
465
 
438
466
 
439
- var Center = ({ children, fullWidth, style }) => {
467
+ var Center = ({
468
+ children,
469
+ fullWidth,
470
+ style,
471
+ noGrowth = false
472
+ }) => {
440
473
  const fullWidthStyle = fullWidth ? { width: "100%" } : void 0;
441
474
  return /* @__PURE__ */ _react2.default.createElement(
442
475
  _reactnative.View,
443
476
  {
444
477
  style: [
445
478
  {
446
- flex: 1,
479
+ flex: noGrowth ? void 0 : 1,
447
480
  alignItems: "center",
448
481
  justifyContent: "center"
449
482
  },
@@ -1092,4 +1125,5 @@ MasonryGridBuilder.displayName = "MasonryGridBuilder";
1092
1125
 
1093
1126
 
1094
1127
 
1095
- exports.AspectRatio = AspectRatio; exports.BlurView = BlurView; exports.Center = Center; exports.Column = Column; exports.ConditionalView = ConditionalView; exports.Grid = Grid; exports.GridBuilder = GridBuilder; exports.GridItem = GridItem; exports.Margin = Margin; exports.MasonryGrid = MasonryGrid; exports.MasonryGridBuilder = MasonryGridBuilder; exports.MasonryGridItem = MasonryGridItem; exports.Padding = Padding; exports.PositionedView = PositionedView; exports.RoundedView = RoundedView; exports.Row = Row; exports.SizedBox = SizedBox; exports.Spacer = Spacer; exports.Surface = Surface;
1128
+
1129
+ exports.AspectRatio = AspectRatio; exports.BlurView = BlurView; exports.Center = Center; exports.Column = Column; exports.ConditionalView = ConditionalView; exports.Grid = Grid; exports.GridBuilder = GridBuilder; exports.GridItem = GridItem; exports.Margin = Margin; exports.MasonryGrid = MasonryGrid; exports.MasonryGridBuilder = MasonryGridBuilder; exports.MasonryGridItem = MasonryGridItem; exports.Padding = Padding; exports.PositionedView = PositionedView; exports.RoundedView = RoundedView; exports.Row = Row; exports.Screen = Screen; exports.SizedBox = SizedBox; exports.Spacer = Spacer; exports.Surface = Surface;
@@ -1,5 +1,5 @@
1
1
  import React, { ReactNode, ReactElement, ComponentType } from 'react';
2
- import { ViewStyle, StyleProp, ColorValue, ScrollViewProps } from 'react-native';
2
+ import { StyleProp, ViewStyle, ColorValue, ScrollViewProps } from 'react-native';
3
3
  import { T as ThemeColor, R as Radius } from '../index-BOw6tbkc.cjs';
4
4
 
5
5
  type MainAxisAlignment = 'start' | 'center' | 'end' | 'space-between' | 'space-around' | 'space-evenly';
@@ -36,9 +36,15 @@ type RowProps = {
36
36
  /**
37
37
  * Custom style for the row container.
38
38
  */
39
- style?: ViewStyle;
39
+ style?: StyleProp<ViewStyle>;
40
+ };
41
+ type ColumnProps = RowProps & {
42
+ /**
43
+ * If true, the container will grow to fill available space.
44
+ * @default false
45
+ */
46
+ noGrowth?: boolean;
40
47
  };
41
- type ColumnProps = RowProps;
42
48
 
43
49
  declare const Column: React.FC<ColumnProps>;
44
50
 
@@ -96,6 +102,11 @@ type PaddingProps = {
96
102
  * @default false
97
103
  */
98
104
  fullWidth?: boolean;
105
+ /**
106
+ * If true, the padding container will grow to fill available space.
107
+ * @default false
108
+ */
109
+ noGrowth?: boolean;
99
110
  /**
100
111
  * Custom style for the padding container.
101
112
  */
@@ -142,6 +153,11 @@ type MarginProps = {
142
153
  * @default false
143
154
  */
144
155
  fullWidth?: boolean;
156
+ /**
157
+ * If true, the margin container will grow to fill available space.
158
+ * @default false
159
+ */
160
+ noGrowth?: boolean;
145
161
  /**
146
162
  * Custom style for the margin container.
147
163
  */
@@ -269,6 +285,11 @@ type RoundedViewProps = {
269
285
  * Background color of the view
270
286
  */
271
287
  backgroundColor?: string;
288
+ /**
289
+ * If true, the view will NOT automatically grow to fill available space (e.g., via flex: 1).
290
+ * @default false
291
+ */
292
+ noGrowth?: boolean;
272
293
  /**
273
294
  * Custom style for the view
274
295
  */
@@ -330,6 +351,33 @@ type SurfaceProps = {
330
351
 
331
352
  declare const Surface: React.FC<SurfaceProps>;
332
353
 
354
+ type ScreenProps = {
355
+ /**
356
+ * Content rendered inside the screen container.
357
+ */
358
+ children: ReactNode;
359
+ /**
360
+ * Uniform padding applied to the screen.
361
+ */
362
+ padding?: number;
363
+ /**
364
+ * Optional custom background color.
365
+ * Uses theme background by default.
366
+ */
367
+ backgroundColor?: string;
368
+ /**
369
+ * Wrap content in a SafeAreaView.
370
+ * @default false
371
+ */
372
+ safeArea?: boolean;
373
+ /**
374
+ * Additional container styles.
375
+ */
376
+ style?: StyleProp<ViewStyle>;
377
+ };
378
+
379
+ declare const Screen: React.FC<ScreenProps>;
380
+
333
381
  type CenterProps = {
334
382
  /**
335
383
  * Content to render inside the centered container.
@@ -340,6 +388,11 @@ type CenterProps = {
340
388
  * @default false
341
389
  */
342
390
  fullWidth?: boolean;
391
+ /**
392
+ * If true, disables automatic growth (e.g. prevents using flex: 1 to fill available space).
393
+ * @default false
394
+ */
395
+ noGrowth?: boolean;
343
396
  /**
344
397
  * Additional style for the container.
345
398
  */
@@ -659,4 +712,4 @@ declare const MasonryGridBuilder: {
659
712
  displayName: string;
660
713
  };
661
714
 
662
- export { AspectRatio, type AspectRatioProps, BlurView, type BlurViewProps, Center, type CenterProps, Column, type ColumnProps, ConditionalView, type ConditionalViewAnimation, type ConditionalViewProps, type CrossAxisAlignment, Grid, GridBuilder, type GridBuilderProps, GridItem, type GridItemProps, type GridProps, type MainAxisAlignment, Margin, type MarginProps, MasonryGrid, MasonryGridBuilder, type MasonryGridBuilderProps, MasonryGridItem, type MasonryGridItemProps, type MasonryGridProps, Padding, type PaddingProps, PositionedView, type PositionedViewProps, RoundedView, type RoundedViewProps, Row, type RowProps, SizedBox, type SizedBoxProps, Spacer, type SpacerProps, Surface, type SurfaceProps, type SurfaceThemeColor };
715
+ export { AspectRatio, type AspectRatioProps, BlurView, type BlurViewProps, Center, type CenterProps, Column, type ColumnProps, ConditionalView, type ConditionalViewAnimation, type ConditionalViewProps, type CrossAxisAlignment, Grid, GridBuilder, type GridBuilderProps, GridItem, type GridItemProps, type GridProps, type MainAxisAlignment, Margin, type MarginProps, MasonryGrid, MasonryGridBuilder, type MasonryGridBuilderProps, MasonryGridItem, type MasonryGridItemProps, type MasonryGridProps, Padding, type PaddingProps, PositionedView, type PositionedViewProps, RoundedView, type RoundedViewProps, Row, type RowProps, Screen, type ScreenProps, SizedBox, type SizedBoxProps, Spacer, type SpacerProps, Surface, type SurfaceProps, type SurfaceThemeColor };
@@ -1,5 +1,5 @@
1
1
  import React, { ReactNode, ReactElement, ComponentType } from 'react';
2
- import { ViewStyle, StyleProp, ColorValue, ScrollViewProps } from 'react-native';
2
+ import { StyleProp, ViewStyle, ColorValue, ScrollViewProps } from 'react-native';
3
3
  import { T as ThemeColor, R as Radius } from '../index-BOw6tbkc.js';
4
4
 
5
5
  type MainAxisAlignment = 'start' | 'center' | 'end' | 'space-between' | 'space-around' | 'space-evenly';
@@ -36,9 +36,15 @@ type RowProps = {
36
36
  /**
37
37
  * Custom style for the row container.
38
38
  */
39
- style?: ViewStyle;
39
+ style?: StyleProp<ViewStyle>;
40
+ };
41
+ type ColumnProps = RowProps & {
42
+ /**
43
+ * If true, the container will grow to fill available space.
44
+ * @default false
45
+ */
46
+ noGrowth?: boolean;
40
47
  };
41
- type ColumnProps = RowProps;
42
48
 
43
49
  declare const Column: React.FC<ColumnProps>;
44
50
 
@@ -96,6 +102,11 @@ type PaddingProps = {
96
102
  * @default false
97
103
  */
98
104
  fullWidth?: boolean;
105
+ /**
106
+ * If true, the padding container will grow to fill available space.
107
+ * @default false
108
+ */
109
+ noGrowth?: boolean;
99
110
  /**
100
111
  * Custom style for the padding container.
101
112
  */
@@ -142,6 +153,11 @@ type MarginProps = {
142
153
  * @default false
143
154
  */
144
155
  fullWidth?: boolean;
156
+ /**
157
+ * If true, the margin container will grow to fill available space.
158
+ * @default false
159
+ */
160
+ noGrowth?: boolean;
145
161
  /**
146
162
  * Custom style for the margin container.
147
163
  */
@@ -269,6 +285,11 @@ type RoundedViewProps = {
269
285
  * Background color of the view
270
286
  */
271
287
  backgroundColor?: string;
288
+ /**
289
+ * If true, the view will NOT automatically grow to fill available space (e.g., via flex: 1).
290
+ * @default false
291
+ */
292
+ noGrowth?: boolean;
272
293
  /**
273
294
  * Custom style for the view
274
295
  */
@@ -330,6 +351,33 @@ type SurfaceProps = {
330
351
 
331
352
  declare const Surface: React.FC<SurfaceProps>;
332
353
 
354
+ type ScreenProps = {
355
+ /**
356
+ * Content rendered inside the screen container.
357
+ */
358
+ children: ReactNode;
359
+ /**
360
+ * Uniform padding applied to the screen.
361
+ */
362
+ padding?: number;
363
+ /**
364
+ * Optional custom background color.
365
+ * Uses theme background by default.
366
+ */
367
+ backgroundColor?: string;
368
+ /**
369
+ * Wrap content in a SafeAreaView.
370
+ * @default false
371
+ */
372
+ safeArea?: boolean;
373
+ /**
374
+ * Additional container styles.
375
+ */
376
+ style?: StyleProp<ViewStyle>;
377
+ };
378
+
379
+ declare const Screen: React.FC<ScreenProps>;
380
+
333
381
  type CenterProps = {
334
382
  /**
335
383
  * Content to render inside the centered container.
@@ -340,6 +388,11 @@ type CenterProps = {
340
388
  * @default false
341
389
  */
342
390
  fullWidth?: boolean;
391
+ /**
392
+ * If true, disables automatic growth (e.g. prevents using flex: 1 to fill available space).
393
+ * @default false
394
+ */
395
+ noGrowth?: boolean;
343
396
  /**
344
397
  * Additional style for the container.
345
398
  */
@@ -659,4 +712,4 @@ declare const MasonryGridBuilder: {
659
712
  displayName: string;
660
713
  };
661
714
 
662
- export { AspectRatio, type AspectRatioProps, BlurView, type BlurViewProps, Center, type CenterProps, Column, type ColumnProps, ConditionalView, type ConditionalViewAnimation, type ConditionalViewProps, type CrossAxisAlignment, Grid, GridBuilder, type GridBuilderProps, GridItem, type GridItemProps, type GridProps, type MainAxisAlignment, Margin, type MarginProps, MasonryGrid, MasonryGridBuilder, type MasonryGridBuilderProps, MasonryGridItem, type MasonryGridItemProps, type MasonryGridProps, Padding, type PaddingProps, PositionedView, type PositionedViewProps, RoundedView, type RoundedViewProps, Row, type RowProps, SizedBox, type SizedBoxProps, Spacer, type SpacerProps, Surface, type SurfaceProps, type SurfaceThemeColor };
715
+ export { AspectRatio, type AspectRatioProps, BlurView, type BlurViewProps, Center, type CenterProps, Column, type ColumnProps, ConditionalView, type ConditionalViewAnimation, type ConditionalViewProps, type CrossAxisAlignment, Grid, GridBuilder, type GridBuilderProps, GridItem, type GridItemProps, type GridProps, type MainAxisAlignment, Margin, type MarginProps, MasonryGrid, MasonryGridBuilder, type MasonryGridBuilderProps, MasonryGridItem, type MasonryGridItemProps, type MasonryGridProps, Padding, type PaddingProps, PositionedView, type PositionedViewProps, RoundedView, type RoundedViewProps, Row, type RowProps, Screen, type ScreenProps, SizedBox, type SizedBoxProps, Spacer, type SpacerProps, Surface, type SurfaceProps, type SurfaceThemeColor };
@@ -39,7 +39,8 @@ var Column = ({
39
39
  spacing,
40
40
  reverse = false,
41
41
  fullWidth,
42
- style
42
+ style,
43
+ noGrowth = false
43
44
  }) => {
44
45
  const gapStyle = spacing === void 0 ? void 0 : { gap: spacing };
45
46
  const fullWidthStyle = fullWidth ? { width: "100%" } : void 0;
@@ -48,7 +49,7 @@ var Column = ({
48
49
  {
49
50
  style: [
50
51
  {
51
- flex: 1,
52
+ flex: noGrowth ? void 0 : 1,
52
53
  flexDirection: reverse ? "column-reverse" : "column",
53
54
  justifyContent: resolveMainAxisAlignment(mainAxisAlignment),
54
55
  alignItems: resolveCrossAxisAlignment(crossAxisAlignment)
@@ -127,7 +128,8 @@ var Padding = ({
127
128
  bottom,
128
129
  left,
129
130
  fullWidth,
130
- style
131
+ style,
132
+ noGrowth = false
131
133
  }) => {
132
134
  const fullWidthStyle = fullWidth ? { width: "100%" } : void 0;
133
135
  return /* @__PURE__ */ React4.createElement(
@@ -135,7 +137,7 @@ var Padding = ({
135
137
  {
136
138
  style: [
137
139
  {
138
- flex: 1,
140
+ flex: noGrowth ? void 0 : 1,
139
141
  padding: all,
140
142
  paddingHorizontal: horizontal,
141
143
  paddingVertical: vertical,
@@ -166,7 +168,8 @@ var Margin = ({
166
168
  bottom,
167
169
  left,
168
170
  fullWidth,
169
- style
171
+ style,
172
+ noGrowth = false
170
173
  }) => {
171
174
  const fullWidthStyle = fullWidth ? { width: "100%" } : void 0;
172
175
  return /* @__PURE__ */ React5.createElement(
@@ -174,7 +177,7 @@ var Margin = ({
174
177
  {
175
178
  style: [
176
179
  {
177
- flex: 1,
180
+ flex: noGrowth ? void 0 : 1,
178
181
  margin: all,
179
182
  marginHorizontal: horizontal,
180
183
  marginVertical: vertical,
@@ -307,7 +310,7 @@ BlurView.displayName = "BlurView";
307
310
 
308
311
  // src/components/view/rounded-view/rounded-view.tsx
309
312
  import React9 from "react";
310
- import { View as View9, StyleSheet as StyleSheet2 } from "react-native";
313
+ import { View as View9 } from "react-native";
311
314
 
312
315
  // src/components/view/rounded-view/rounded-view.hook.ts
313
316
  import { useMemo } from "react";
@@ -347,7 +350,8 @@ var RoundedView = ({
347
350
  bottomRight,
348
351
  fullWidth = false,
349
352
  backgroundColor,
350
- style
353
+ style,
354
+ noGrowth = false
351
355
  }) => {
352
356
  const borderRadiusStyle = useRoundedViewStyle({
353
357
  all,
@@ -365,7 +369,8 @@ var RoundedView = ({
365
369
  {
366
370
  style: [
367
371
  borderRadiusStyle,
368
- fullWidth && styles2.fullWidth,
372
+ fullWidth && { width: "100%" },
373
+ noGrowth ? void 0 : { flex: 1 },
369
374
  backgroundColor && { backgroundColor },
370
375
  style
371
376
  ]
@@ -373,14 +378,6 @@ var RoundedView = ({
373
378
  children
374
379
  );
375
380
  };
376
- var styles2 = StyleSheet2.create({
377
- fullWidth: {
378
- flexGrow: 1,
379
- flexShrink: 1,
380
- flexBasis: "auto",
381
- width: "100%"
382
- }
383
- });
384
381
 
385
382
  // src/components/view/aspect-ratio/aspect-ratio.tsx
386
383
  import React10 from "react";
@@ -433,17 +430,53 @@ var Surface = ({
433
430
  };
434
431
  Surface.displayName = "Surface";
435
432
 
436
- // src/components/view/center/center.tsx
433
+ // src/components/view/screen/screen.tsx
437
434
  import React12 from "react";
438
435
  import { View as View12 } from "react-native";
439
- var Center = ({ children, fullWidth, style }) => {
440
- const fullWidthStyle = fullWidth ? { width: "100%" } : void 0;
436
+ import { SafeAreaView } from "react-native-safe-area-context";
437
+ var Screen = ({
438
+ children,
439
+ padding,
440
+ backgroundColor,
441
+ safeArea = false,
442
+ style
443
+ }) => {
444
+ const theme = useXUITheme();
445
+ const resolvedBackgroundColor = backgroundColor ?? theme.colors.background;
446
+ const Container = safeArea ? SafeAreaView : View12;
441
447
  return /* @__PURE__ */ React12.createElement(
442
- View12,
448
+ Container,
443
449
  {
444
450
  style: [
445
451
  {
446
452
  flex: 1,
453
+ backgroundColor: resolvedBackgroundColor,
454
+ padding
455
+ },
456
+ style
457
+ ]
458
+ },
459
+ children
460
+ );
461
+ };
462
+ Screen.displayName = "Screen";
463
+
464
+ // src/components/view/center/center.tsx
465
+ import React13 from "react";
466
+ import { View as View13 } from "react-native";
467
+ var Center = ({
468
+ children,
469
+ fullWidth,
470
+ style,
471
+ noGrowth = false
472
+ }) => {
473
+ const fullWidthStyle = fullWidth ? { width: "100%" } : void 0;
474
+ return /* @__PURE__ */ React13.createElement(
475
+ View13,
476
+ {
477
+ style: [
478
+ {
479
+ flex: noGrowth ? void 0 : 1,
447
480
  alignItems: "center",
448
481
  justifyContent: "center"
449
482
  },
@@ -457,16 +490,16 @@ var Center = ({ children, fullWidth, style }) => {
457
490
  Center.displayName = "Center";
458
491
 
459
492
  // src/components/view/grid/grid.tsx
460
- import React14, { useMemo as useMemo2, useState } from "react";
493
+ import React15, { useMemo as useMemo2, useState } from "react";
461
494
  import {
462
- View as View14
495
+ View as View15
463
496
  } from "react-native";
464
497
 
465
498
  // src/components/view/grid/grid-item.tsx
466
- import React13 from "react";
467
- import { View as View13 } from "react-native";
499
+ import React14 from "react";
500
+ import { View as View14 } from "react-native";
468
501
  var GridItem = ({ children, style }) => {
469
- return /* @__PURE__ */ React13.createElement(View13, { style }, children);
502
+ return /* @__PURE__ */ React14.createElement(View14, { style }, children);
470
503
  };
471
504
  GridItem.displayName = "GridItem";
472
505
 
@@ -480,7 +513,7 @@ var getSafeSpan = (span, columns) => {
480
513
  return Math.min(Math.floor(span), columns);
481
514
  };
482
515
  var isGridItemElement = (child) => {
483
- if (!React14.isValidElement(child)) return false;
516
+ if (!React15.isValidElement(child)) return false;
484
517
  if (child.type === GridItem) return true;
485
518
  const displayName = child.type.displayName;
486
519
  return displayName === "GridItem";
@@ -499,15 +532,15 @@ var Grid = ({
499
532
  const resolvedRowSpacing = rowSpacing ?? spacing ?? 0;
500
533
  const resolvedColumnSpacing = columnSpacing ?? spacing ?? 0;
501
534
  const itemWidth = `${100 / safeColumns}%`;
502
- const items = React14.Children.toArray(children);
535
+ const items = React15.Children.toArray(children);
503
536
  const totalColumnGap = resolvedColumnSpacing * (safeColumns - 1);
504
537
  const baseItemWidth = useMemo2(() => {
505
538
  if (!containerWidth) return void 0;
506
539
  return (containerWidth - totalColumnGap) / safeColumns;
507
540
  }, [containerWidth, safeColumns, totalColumnGap]);
508
541
  let currentColumn = 0;
509
- return /* @__PURE__ */ React14.createElement(
510
- View14,
542
+ return /* @__PURE__ */ React15.createElement(
543
+ View15,
511
544
  {
512
545
  style: [
513
546
  {
@@ -524,7 +557,7 @@ var Grid = ({
524
557
  }
525
558
  },
526
559
  items.map((child, index) => {
527
- const key = React14.isValidElement(child) && child.key ? child.key : `grid-${index}`;
560
+ const key = React15.isValidElement(child) && child.key ? child.key : `grid-${index}`;
528
561
  const span = isGridItemElement(child) ? getSafeSpan(child.props.span, safeColumns) : 1;
529
562
  const spanWidth = baseItemWidth === void 0 ? `${100 / safeColumns * span}%` : baseItemWidth * span + resolvedColumnSpacing * (span - 1);
530
563
  if (currentColumn + span > safeColumns) {
@@ -544,7 +577,7 @@ var Grid = ({
544
577
  itemStyle,
545
578
  child.props.style
546
579
  ];
547
- const element2 = React14.cloneElement(child, {
580
+ const element2 = React15.cloneElement(child, {
548
581
  key,
549
582
  style: mergedStyle
550
583
  });
@@ -552,8 +585,8 @@ var Grid = ({
552
585
  return element2;
553
586
  }
554
587
  const defaultItemWidth = baseItemWidth === void 0 ? itemWidth : baseItemWidth;
555
- const element = /* @__PURE__ */ React14.createElement(
556
- View14,
588
+ const element = /* @__PURE__ */ React15.createElement(
589
+ View15,
557
590
  {
558
591
  key,
559
592
  style: [
@@ -576,11 +609,11 @@ var Grid = ({
576
609
  };
577
610
 
578
611
  // src/components/view/grid/grid-builder.tsx
579
- import React15, { useMemo as useMemo3 } from "react";
612
+ import React16, { useMemo as useMemo3 } from "react";
580
613
  import {
581
614
  FlatList,
582
- StyleSheet as StyleSheet3,
583
- View as View15
615
+ StyleSheet as StyleSheet2,
616
+ View as View16
584
617
  } from "react-native";
585
618
  var getSafeColumns2 = (columns) => {
586
619
  if (!columns || columns <= 0) return 1;
@@ -667,7 +700,7 @@ var GridBuilder = ({
667
700
  },
668
701
  itemStyle
669
702
  ];
670
- return /* @__PURE__ */ React15.createElement(View15, { style: placeholderStyle, pointerEvents: "none" });
703
+ return /* @__PURE__ */ React16.createElement(View16, { style: placeholderStyle, pointerEvents: "none" });
671
704
  }
672
705
  const element = resolvedRenderer({ item: item.item, index: item.index });
673
706
  if (element === null) return null;
@@ -683,9 +716,9 @@ var GridBuilder = ({
683
716
  },
684
717
  itemStyle
685
718
  ];
686
- return /* @__PURE__ */ React15.createElement(View15, { style: wrapperStyle }, element);
719
+ return /* @__PURE__ */ React16.createElement(View16, { style: wrapperStyle }, element);
687
720
  };
688
- const flattenedStyle = StyleSheet3.flatten(style) ?? {};
721
+ const flattenedStyle = StyleSheet2.flatten(style) ?? {};
689
722
  const {
690
723
  alignItems,
691
724
  justifyContent,
@@ -704,7 +737,7 @@ var GridBuilder = ({
704
737
  ...columnGap !== void 0 ? { columnGap } : {}
705
738
  };
706
739
  const hasLayoutStyle = Object.keys(layoutStyle).length > 0;
707
- return /* @__PURE__ */ React15.createElement(
740
+ return /* @__PURE__ */ React16.createElement(
708
741
  FlatList,
709
742
  {
710
743
  data: paddedData,
@@ -724,7 +757,7 @@ var GridBuilder = ({
724
757
  GridBuilder.displayName = "GridBuilder";
725
758
 
726
759
  // src/components/view/conditional/conditional-view.tsx
727
- import React16, { useEffect as useEffect2, useMemo as useMemo4, useRef as useRef2, useState as useState2 } from "react";
760
+ import React17, { useEffect as useEffect2, useMemo as useMemo4, useRef as useRef2, useState as useState2 } from "react";
728
761
  import { Animated as Animated3 } from "react-native";
729
762
 
730
763
  // src/components/view/conditional/conditional-view.utils.ts
@@ -876,18 +909,18 @@ var ConditionalView = ({
876
909
  if (!shouldRender) {
877
910
  return null;
878
911
  }
879
- return /* @__PURE__ */ React16.createElement(Animated3.View, { style: animatedStyle }, children);
912
+ return /* @__PURE__ */ React17.createElement(Animated3.View, { style: animatedStyle }, children);
880
913
  };
881
914
 
882
915
  // src/components/view/masonry-grid/masonry-grid.tsx
883
- import React17, { useMemo as useMemo5, useRef as useRef3, useState as useState3 } from "react";
884
- import { View as View16 } from "react-native";
916
+ import React18, { useMemo as useMemo5, useRef as useRef3, useState as useState3 } from "react";
917
+ import { View as View17 } from "react-native";
885
918
  var getSafeColumns3 = (columns) => {
886
919
  if (!columns || columns <= 0) return 1;
887
920
  return Math.floor(columns);
888
921
  };
889
922
  var getItemKey = (child, index) => {
890
- return React17.isValidElement(child) && child.key ? String(child.key) : `masonry-${index}`;
923
+ return React18.isValidElement(child) && child.key ? String(child.key) : `masonry-${index}`;
891
924
  };
892
925
  var MasonryGrid = ({
893
926
  children,
@@ -910,7 +943,7 @@ var MasonryGrid = ({
910
943
  return (containerWidth - totalColumnGap) / safeColumns;
911
944
  }, [containerWidth, safeColumns, totalColumnGap]);
912
945
  const items = useMemo5(
913
- () => React17.Children.toArray(children).map((child, index) => ({
946
+ () => React18.Children.toArray(children).map((child, index) => ({
914
947
  key: getItemKey(child, index),
915
948
  element: child
916
949
  })),
@@ -927,8 +960,8 @@ var MasonryGrid = ({
927
960
  });
928
961
  return buckets;
929
962
  }, [items, layoutVersion, resolvedRowSpacing, safeColumns]);
930
- return /* @__PURE__ */ React17.createElement(
931
- View16,
963
+ return /* @__PURE__ */ React18.createElement(
964
+ View17,
932
965
  {
933
966
  style: [
934
967
  {
@@ -951,10 +984,10 @@ var MasonryGrid = ({
951
984
  },
952
985
  columnStyle
953
986
  ];
954
- return /* @__PURE__ */ React17.createElement(View16, { key: `masonry-col-${columnIndex}`, style: columnStyles }, column.map((item, index) => {
987
+ return /* @__PURE__ */ React18.createElement(View17, { key: `masonry-col-${columnIndex}`, style: columnStyles }, column.map((item, index) => {
955
988
  const isLastRow = index === column.length - 1;
956
- return /* @__PURE__ */ React17.createElement(
957
- View16,
989
+ return /* @__PURE__ */ React18.createElement(
990
+ View17,
958
991
  {
959
992
  key: item.key,
960
993
  style: { marginBottom: isLastRow ? 0 : resolvedRowSpacing },
@@ -973,18 +1006,18 @@ var MasonryGrid = ({
973
1006
  };
974
1007
 
975
1008
  // src/components/view/masonry-grid/masonry-grid-item.tsx
976
- import React18 from "react";
977
- import { View as View17 } from "react-native";
1009
+ import React19 from "react";
1010
+ import { View as View18 } from "react-native";
978
1011
  var MasonryGridItem = ({
979
1012
  children,
980
1013
  style
981
1014
  }) => {
982
- return /* @__PURE__ */ React18.createElement(View17, { style }, children);
1015
+ return /* @__PURE__ */ React19.createElement(View18, { style }, children);
983
1016
  };
984
1017
  MasonryGridItem.displayName = "MasonryGridItem";
985
1018
 
986
1019
  // src/components/view/masonry-grid/masonry-grid-builder.tsx
987
- import React19, { useMemo as useMemo6, useRef as useRef4 } from "react";
1020
+ import React20, { useMemo as useMemo6, useRef as useRef4 } from "react";
988
1021
  import {
989
1022
  ScrollView
990
1023
  } from "react-native";
@@ -1044,7 +1077,7 @@ var MasonryGridBuilder = ({
1044
1077
  onEndReached();
1045
1078
  }
1046
1079
  };
1047
- return /* @__PURE__ */ React19.createElement(
1080
+ return /* @__PURE__ */ React20.createElement(
1048
1081
  ScrollView,
1049
1082
  {
1050
1083
  scrollEventThrottle: 16,
@@ -1056,7 +1089,7 @@ var MasonryGridBuilder = ({
1056
1089
  onScroll: handleScroll
1057
1090
  },
1058
1091
  header,
1059
- /* @__PURE__ */ React19.createElement(
1092
+ /* @__PURE__ */ React20.createElement(
1060
1093
  MasonryGrid,
1061
1094
  {
1062
1095
  columns,
@@ -1066,7 +1099,7 @@ var MasonryGridBuilder = ({
1066
1099
  style: [{ width: "100%" }, style],
1067
1100
  columnStyle
1068
1101
  },
1069
- resolvedData.map((item, index) => /* @__PURE__ */ React19.createElement(MasonryGridItem, { key: resolvedKeyExtractor(item, index) }, resolvedRenderer({ item, index })))
1102
+ resolvedData.map((item, index) => /* @__PURE__ */ React20.createElement(MasonryGridItem, { key: resolvedKeyExtractor(item, index) }, resolvedRenderer({ item, index })))
1070
1103
  ),
1071
1104
  footer
1072
1105
  );
@@ -1089,6 +1122,7 @@ export {
1089
1122
  PositionedView,
1090
1123
  RoundedView,
1091
1124
  Row,
1125
+ Screen,
1092
1126
  SizedBox,
1093
1127
  Spacer,
1094
1128
  Surface
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xaui/native",
3
- "version": "0.2.1",
3
+ "version": "0.2.3",
4
4
  "description": "Flutter-inspired React Native UI components with native animations powered by React Native Reanimated",
5
5
  "keywords": [
6
6
  "react-native",
@@ -276,6 +276,8 @@
276
276
  "react-native": ">=0.70.0",
277
277
  "react-native-gesture-handler": ">=2.0.0",
278
278
  "react-native-reanimated": ">=4.0.0",
279
+ "react-native-safe-area-context": ">=4.0.0",
280
+ "react-native-worklets": ">=0.5.0",
279
281
  "react-native-svg": ">=15.0.0"
280
282
  },
281
283
  "devDependencies": {
@@ -285,6 +287,8 @@
285
287
  "react-native": "^0.81.5",
286
288
  "react-native-gesture-handler": "^2.28.0",
287
289
  "react-native-reanimated": "^4.0.0",
290
+ "react-native-safe-area-context": "^5.6.0",
291
+ "react-native-worklets": "^0.5.1",
288
292
  "react-native-svg": "^15.8.0",
289
293
  "tsup": "^8.5.1",
290
294
  "typescript": "^5.9.3"