diff --git a/components/RefreshControl.test.tsx b/components/RefreshControl.test.tsx new file mode 100644 index 0000000..f803f62 --- /dev/null +++ b/components/RefreshControl.test.tsx @@ -0,0 +1,66 @@ +import React from 'react' +import { render } from '@testing-library/react-native' +import { ScrollView } from 'react-native' +import RefreshControl from './RefreshControl' + +describe('RefreshControl Component', () => { + describe('Basic Rendering', () => { + it('should render with refreshing false', () => { + const mockOnRefresh = jest.fn() + const { UNSAFE_root } = render( + + } + > + <> + + ) + expect(UNSAFE_root).toBeTruthy() + }) + + it('should render with refreshing true', () => { + const mockOnRefresh = jest.fn() + const { UNSAFE_root } = render( + + } + > + <> + + ) + expect(UNSAFE_root).toBeTruthy() + }) + }) + + describe('Props', () => { + it('should accept refreshing prop', () => { + const mockOnRefresh = jest.fn() + const { UNSAFE_root } = render( + + } + > + <> + + ) + expect(UNSAFE_root).toBeTruthy() + }) + + it('should accept onRefresh callback prop', () => { + const mockOnRefresh = jest.fn() + const { UNSAFE_root } = render( + + } + > + <> + + ) + expect(UNSAFE_root).toBeTruthy() + }) + }) +}) diff --git a/components/RefreshControl.tsx b/components/RefreshControl.tsx new file mode 100644 index 0000000..113883a --- /dev/null +++ b/components/RefreshControl.tsx @@ -0,0 +1,21 @@ +import React from 'react' +import { RefreshControl as RNRefreshControl } from 'react-native' + +interface RefreshControlProps { + refreshing: boolean + onRefresh: () => void +} + +export default function RefreshControl({ + refreshing, + onRefresh, +}: RefreshControlProps) { + return ( + + ) +}