Skip to content
This repository was archived by the owner on Apr 15, 2025. It is now read-only.

Commit 97c1551

Browse files
committed
Change JSX.Element to ReactNode
1 parent 9954b93 commit 97c1551

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

src/index.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
*/
1515

1616
// Load dependencies.
17-
import React from 'react'
17+
import React, { ReactNode } from 'react'
1818
import PropTypes from 'prop-types'
1919
import FileSystemFactory, { CacheFileInfo, FileSystem } from './FileSystem'
2020
import traverse from 'traverse'
@@ -43,7 +43,7 @@ export interface ReactNativeImageCacheHocProps {
4343

4444
style?: StyleProp<ImageStyle>
4545

46-
placeholder?: JSX.Element
46+
placeholder?: ReactNode
4747
}
4848

4949
export interface ReactNativeImageCacheHocState {
@@ -56,7 +56,7 @@ export interface ReactNativeImageCacheHocOptions {
5656
fileHostWhitelist?: string[]
5757
cachePruneTriggerLimit?: number // Maximum size of image file cache in bytes before pruning occurs. Defaults to 15 MB.
5858
fileDirName?: string | null // Namespace local file writing to this directory. Defaults to 'react-native-image-cache-hoc'.
59-
defaultPlaceholder?: JSX.Element | null
59+
defaultPlaceholder?: ReactNode | null
6060
}
6161

6262
const imageCacheHoc = <P extends object>(
@@ -77,7 +77,7 @@ const imageCacheHoc = <P extends object>(
7777
throw new Error('fileDirName option must be string')
7878
}
7979
if (options.defaultPlaceholder && typeof options.defaultPlaceholder !== 'object') {
80-
throw new Error('defaultPlaceholder option must be a JSX.Element')
80+
throw new Error('defaultPlaceholder option must be a ReactNode')
8181
}
8282

8383
return class extends React.PureComponent<

tests/CacheableImage.test.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ describe('CacheableImage', function () {
4848
imageCacheHoc(Image, {
4949
defaultPlaceholder: 5478329 as any,
5050
}),
51-
).toThrow('defaultPlaceholder option must be a JSX.Element')
51+
).toThrow('defaultPlaceholder option must be a ReactNode')
5252

5353
const validOptions: ReactNativeImageCacheHocOptions = {
5454
validProtocols: ['http', 'https'],

0 commit comments

Comments
 (0)