Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use proper type for children #21

Merged
merged 1 commit into from
Apr 24, 2023
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
6 changes: 2 additions & 4 deletions src/components/Settings/shared/ToggleSettings.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
import React, { ReactNode, useState } from 'react'
import React, { PropsWithChildren, useState } from 'react'
import { Pressable, StyleSheet, View } from 'react-native'
import CustomIcon from '../../shared/CustomIcon'
import SettingsItemLabel, { SettingsItemLabelProps } from './SettingsItemLabel'
import { settingItemButtonRippleConfig } from './values'

type Props = SettingsItemLabelProps & {
children: ReactNode
}
type Props = PropsWithChildren<SettingsItemLabelProps>

const ToggleSettings = ({ title, description, children }: Props) => {
const [renderSettings, setRenderSettings] = useState(false)
Expand Down
8 changes: 2 additions & 6 deletions src/contexts/SearchContextWrapper.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
import React, { ReactNode, RefObject, useMemo, useRef } from 'react'
import React, { PropsWithChildren, RefObject, useMemo, useRef } from 'react'
import { TextInput } from 'react-native'
import SearchContext, { SearchContextType } from './SearchContext'

type Props = {
children: ReactNode
}

const SearchContextWrapper = ({ children }: Props) => {
const SearchContextWrapper = ({ children }: PropsWithChildren) => {
const searchInputRef: RefObject<TextInput> | null = useRef(null)

const clearSearchInput = () => {
Expand Down
6 changes: 3 additions & 3 deletions utils/test/utils.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { configureStore, PreloadedState, Store } from '@reduxjs/toolkit'
import { render, RenderOptions } from '@testing-library/react-native'
import React, { ReactElement, ReactNode } from 'react'
import React, { PropsWithChildren, ReactElement } from 'react'
import { Provider as PaperProvider } from 'react-native-paper'
import { Provider as StoreProvider } from 'react-redux'
import SearchContext, { SearchContextType } from '../../src/contexts/SearchContext'
Expand All @@ -22,7 +22,7 @@ export const renderWithProvider = (
...renderOptions
}: ExtendedRenderOptions = {}
) => {
const wrapper = ({ children }: { children: ReactNode }): JSX.Element => {
const wrapper = ({ children }: PropsWithChildren): JSX.Element => {
return (
<StoreProvider store={store}>
<PaperProvider>{children}</PaperProvider>
Expand All @@ -43,7 +43,7 @@ export const renderWithProviderAndContexts = (
...renderOptions
}: ExtendedRenderOptions = {}
) => {
const wrapper = ({ children }: { children: ReactNode }): JSX.Element => {
const wrapper = ({ children }: PropsWithChildren): JSX.Element => {
return (
<StoreProvider store={store}>
<SearchContext.Provider value={searchContextValue}>
Expand Down