Skip to content

Commit 196f6aa

Browse files
committed
Undeprecate spacer component
1 parent 8931b37 commit 196f6aa

File tree

3 files changed

+36
-1
lines changed

3 files changed

+36
-1
lines changed
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
import React from "react";
2+
import { View, StyleProp, ViewStyle } from "react-native";
3+
4+
interface SpacerProps {
5+
top?: number;
6+
right?: number;
7+
left?: number;
8+
bottom?: number;
9+
style?: StyleProp<ViewStyle>;
10+
}
11+
12+
const Spacer: React.FC<SpacerProps> = ({
13+
top = 8,
14+
right = 8,
15+
bottom = 8,
16+
left = 8,
17+
style,
18+
}) => {
19+
return (
20+
<View
21+
style={[
22+
style,
23+
{
24+
paddingRight: right,
25+
paddingTop: top,
26+
paddingLeft: left,
27+
paddingBottom: bottom,
28+
},
29+
]}
30+
/>
31+
);
32+
};
33+
34+
export default Spacer;

packages/core/src/components/Layout/index.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,5 @@ export { default as Center } from "./Center";
44
export { default as HStack } from "./HStack";
55
export { default as VStack } from "./VStack";
66
export { default as ZStack } from "./ZStack";
7+
export { default as Spacer } from "./Spacer";
78
export { default as Square } from "./Square";

packages/core/src/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ export {
7070
HStack,
7171
VStack,
7272
ZStack,
73+
Spacer,
7374
Square,
7475
} from "./components/Layout";
7576

@@ -89,7 +90,6 @@ export {
8990
Center as DeprecatedCenter,
9091
Circle as DeprecatedCircle,
9192
Square as DeprecatedSquare,
92-
Spacer,
9393
Row,
9494
Stack,
9595
} from "./deprecated-components/Layout";

0 commit comments

Comments
 (0)