Skip to content

Commit 46490f7

Browse files
committed
feat: create nativeComponent spec
1 parent 34e1b6b commit 46490f7

File tree

1 file changed

+42
-0
lines changed

1 file changed

+42
-0
lines changed
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent';
2+
import type { ViewProps, ColorValue } from 'react-native';
3+
import type {
4+
Float,
5+
WithDefault,
6+
BubblingEventHandler,
7+
} from 'react-native/Libraries/Types/CodegenTypes';
8+
9+
type Headers = Readonly<{}>
10+
type Priority = WithDefault< 'low' | 'normal' | 'high', 'normal'>
11+
type CacheControl = WithDefault< 'immutable' | 'web' | 'cacheOnly', 'web'>
12+
13+
type FastImageSource = Readonly<{
14+
uri?: string,
15+
headers?: Headers,
16+
priority?: Priority,
17+
cache?: CacheControl,
18+
}>
19+
20+
type OnLoadEvent = Readonly<{
21+
width: Float,
22+
height: Float,
23+
}>
24+
25+
type OnProgressEvent = Readonly<{
26+
loaded: Float,
27+
total: Float,
28+
}>
29+
30+
interface NativeProps extends ViewProps {
31+
onFastImageError?: BubblingEventHandler<Readonly<{}>>,
32+
onFastImageLoad?: BubblingEventHandler<OnLoadEvent>,
33+
onFastImageLoadEnd?: BubblingEventHandler<Readonly<{}>>,
34+
onFastImageLoadStart?: BubblingEventHandler<Readonly<{}>>,
35+
onFastImageProgress?: BubblingEventHandler<OnProgressEvent>,
36+
source?: FastImageSource,
37+
defaultSource?: string,
38+
resizeMode?: WithDefault<'contain' | 'cover' | 'stretch' | 'center', 'cover'>,
39+
tintColor?: ColorValue,
40+
}
41+
42+
export default codegenNativeComponent<NativeProps>('FastImageView');

0 commit comments

Comments
 (0)