Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
46 changes: 46 additions & 0 deletions example/__tests__/ios/positioning.harness.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
import { screen } from '@react-native-harness/ui'
import { ComponentType } from 'react'
import { View } from 'react-native'
import { describe, expect, render, test } from 'react-native-harness'

import {
AbsolutePositioningBasicExample,
AbsolutePositioningCornersExample,
BadgeOverlayExample,
RelativePositioningBasicExample,
RelativePositioningNegativeExample,
StaticPositioningExample,
ZIndexLayeringExample,
} from '../../screens/testing-grounds/positioning/PositioningExamples'

const snapshotTest = (name: string, Component: ComponentType<{ testID?: string }>) => {
return test(`should match snapshot for ${name}`, async () => {
await render(
<View style={{ width: '100%', height: '100%', alignItems: 'center', justifyContent: 'center' }}>
<Component testID="preview" />
</View>
)

const previewElement = await screen.findByTestId('preview')
const screenshot = await screen.screenshot(previewElement)
await expect(screenshot).toMatchImageSnapshot({
name: name.toLowerCase().replace(/\s+/g, '-'),
})
})
}

describe('Positioning snapshots', () => {
snapshotTest('Static Positioning', StaticPositioningExample)

snapshotTest('Relative Positioning Basic', RelativePositioningBasicExample)

snapshotTest('Relative Positioning Negative', RelativePositioningNegativeExample)

snapshotTest('Absolute Positioning Basic', AbsolutePositioningBasicExample)

snapshotTest('Absolute Positioning Corners', AbsolutePositioningCornersExample)

snapshotTest('Z-Index Layering', ZIndexLayeringExample)

snapshotTest('Badge Overlay', BadgeOverlayExample)
})
5 changes: 5 additions & 0 deletions example/app/testing-grounds/positioning.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import PositioningScreen from '~/screens/testing-grounds/positioning/PositioningScreen'

export default function PositioningIndex() {
return <PositioningScreen />
}
7 changes: 7 additions & 0 deletions example/screens/testing-grounds/TestingGroundsScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,13 @@ const TESTING_GROUNDS_SECTIONS = [
'Explore Voltra styling properties including padding, margins, colors, borders, shadows, and typography.',
route: '/testing-grounds/styling',
},
{
id: 'positioning',
title: 'Positioning',
description:
'Learn about static, relative, and absolute positioning modes. See how left, top, and zIndex properties work with visual examples.',
route: '/testing-grounds/positioning',
},
{
id: 'components',
title: 'Components',
Expand Down
Loading
Loading