Skip to content

Commit fe55bb5

Browse files
authored
fix(TMCU-539): add horizontal padding to NFT skeleton in full view (#27077)
## **Description** The NFT grid skeleton loading state had minimal padding (`p-1`) regardless of context, while the actual NFT grid `FlatList` uses `px-4` horizontal padding in full view mode. This caused an inconsistent layout jump when loading finished and the skeleton was replaced by real content. The fix threads `isFullView` from `NftGrid` through `NftGridContent` to `NftGridSkeleton`, so the skeleton conditionally applies `px-4` in full view and `px-1` in tab/homepage view -- matching the padding of the content it replaces in each context. ## **Changelog** CHANGELOG entry: Fixed missing horizontal padding on NFT skeleton loading state in full view ## **Related issues** Fixes: https://consensyssoftware.atlassian.net/browse/TMCU-539 ## **Manual testing steps** ```gherkin Feature: NFT skeleton padding in full view Scenario: user sees skeleton with correct padding in NFTs full view Given user navigates to the NFTs full view And NFTs are being fetched When the skeleton loading state is displayed Then the skeleton has the same horizontal padding as the NFT grid content Scenario: skeleton padding is unchanged in tab/homepage view Given user is on the homepage with the NFTs section visible And NFTs are being fetched When the skeleton loading state is displayed Then the skeleton retains minimal horizontal padding (matching tab layout) ``` ## **Screenshots/Recordings** N/A -- padding-only fix, verified via tests. ### **Before** <img width="300" src="https://github.com/user-attachments/assets/1fb110de-ed76-4a41-8c8f-be1202db4e12" /> ### **After** <img width="300" src="https://github.com/user-attachments/assets/3c7730bd-76ca-4973-a11a-d8eedf53d1c7" /> ## **Pre-merge author checklist** - [x] I've followed [MetaMask Contributor Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Mobile Coding Standards](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/CODING_GUIDELINES.md). - [x] I've completed the PR template to the best of my ability - [x] I've included tests if applicable - [x] I've documented my code using [JSDoc](https://jsdoc.app/) format if applicable - [x] I've applied the right labels on the PR (see [labeling guidelines](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/LABELING_GUIDELINES.md)). Not required for external contributors. ## **Pre-merge reviewer checklist** - [ ] I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed). - [ ] I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots. <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Low Risk** > Low risk UI-only change that adjusts loading-state layout; no business logic, data handling, or navigation behavior is modified. > > **Overview** > Fixes a layout jump in the NFT grid loading state by **matching `NftGridSkeleton` horizontal padding to the rendered grid**. > > Threads `isFullView` from `NftGrid` through `NftGridContent` into `NftGridSkeleton`, where the container now applies `px-4` in full view and `px-1` otherwise (replacing the previous fixed `p-1`). > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit afdbe36. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY -->
1 parent 1a22eb4 commit fe55bb5

2 files changed

Lines changed: 6 additions & 3 deletions

File tree

app/components/UI/NftGrid/NftGrid.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,11 +54,13 @@ const NftGridContent = ({
5454
nftRowList,
5555
goToAddCollectible,
5656
isAddNFTEnabled,
57+
isFullView = false,
5758
}: {
5859
allFilteredCollectibles: Nft[];
5960
nftRowList: React.ReactNode;
6061
goToAddCollectible: () => void;
6162
isAddNFTEnabled: boolean;
63+
isFullView?: boolean;
6264
}) => {
6365
const isNftFetchingProgress = useSelector(isNftFetchingProgressSelector);
6466

@@ -67,7 +69,7 @@ const NftGridContent = ({
6769
}
6870

6971
if (isNftFetchingProgress) {
70-
return <NftGridSkeleton />;
72+
return <NftGridSkeleton isFullView={isFullView} />;
7173
}
7274

7375
return (
@@ -300,6 +302,7 @@ const NftGrid = forwardRef<TabRefreshHandle, NftGridProps>(
300302
nftRowList={nftRowList}
301303
goToAddCollectible={goToAddCollectible}
302304
isAddNFTEnabled={isAddNFTEnabled}
305+
isFullView={isFullView}
303306
/>
304307

305308
{/* View all NFTs button - shown when there are more items than maxItems */}

app/components/UI/NftGrid/NftGridSkeleton.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@ import SkeletonPlaceholder from 'react-native-skeleton-placeholder';
44
import { useTheme } from '../../../util/theme';
55
import { useTailwind } from '@metamask/design-system-twrnc-preset';
66

7-
const NftGridSkeleton = () => {
7+
const NftGridSkeleton = ({ isFullView = false }: { isFullView?: boolean }) => {
88
const { colors } = useTheme();
99
const tw = useTailwind();
1010

1111
return (
12-
<View style={tw.style('flex-1 p-1')}>
12+
<View style={tw.style('flex-1 pt-1', isFullView ? 'px-4' : 'px-1')}>
1313
<SkeletonPlaceholder
1414
backgroundColor={colors.background.section}
1515
highlightColor={colors.background.subsection}

0 commit comments

Comments
 (0)