Skip to content

Commit 4e852d2

Browse files
committed
screenFooter - fix overflow in Fit mode, fix stretching in Stretch and Fixed modes
Replace row+centerH wrappers with column-direction wrappers where default alignItems: 'stretch' handles button stretching. Restore flexShrink wrapping for horizontal FIT mode lost during prior refactor. Users control centering via the 'center' modifier on their items. Made-with: Cursor
1 parent 2ce1421 commit 4e852d2

2 files changed

Lines changed: 13 additions & 4 deletions

File tree

demo/src/screens/componentScreens/ScreenFooterScreen.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ const ScreenFooterContent = () => {
200200
// Extra Text (Total price)
201201
if (showExtraText) {
202202
items.push(
203-
<View key="extra-text" centerV flexS marginB-s4={!isHorizontal}>
203+
<View key="extra-text" center flexS marginB-s4={!isHorizontal}>
204204
<Text {...{[textPreset.main]: true}} numberOfLines={1}>
205205
Total:{' '}
206206
<Text {...{[textPreset.main]: true}} style={{fontWeight: 'bold'}}>
@@ -217,7 +217,7 @@ const ScreenFooterContent = () => {
217217
// Image (Basket icon)
218218
if (showExtraText && showImage) {
219219
items.push(
220-
<View key="extra-image" centerV marginB-s4={!isHorizontal}>
220+
<View key="extra-image" center marginB-s4={!isHorizontal}>
221221
<Icon source={basketIcon} size={imageSize} tintColor={Colors.$iconDefault} />
222222
</View>
223223
);

packages/react-native-ui-lib/src/components/screenFooter/index.tsx

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ const ScreenFooter = (props: ScreenFooterProps) => {
199199
(child: React.ReactNode, index: number) => {
200200
if (itemsFit === ItemsFit.FIXED && itemWidth) {
201201
const fixedStyle: ViewStyle = isHorizontal
202-
? {width: itemWidth, flexShrink: 1, overflow: 'hidden', flexDirection: 'row', justifyContent: 'center'}
202+
? {width: itemWidth, flexShrink: 1, overflow: 'hidden'}
203203
: {width: itemWidth, maxWidth: '100%'};
204204
return (
205205
<View key={index} style={fixedStyle}>
@@ -210,11 +210,20 @@ const ScreenFooter = (props: ScreenFooterProps) => {
210210

211211
if (isHorizontal && React.isValidElement(child) && itemsFit === ItemsFit.STRETCH) {
212212
return (
213-
<View flex row centerH key={index}>
213+
<View flex key={index}>
214214
{child}
215215
</View>
216216
);
217217
}
218+
219+
if (isHorizontal) {
220+
return (
221+
<View flexS key={index}>
222+
{child}
223+
</View>
224+
);
225+
}
226+
218227
return child;
219228
},
220229
[itemsFit, itemWidth, isHorizontal]

0 commit comments

Comments
 (0)