Skip to content
Open
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
7 changes: 6 additions & 1 deletion packages/react-native/Libraries/Image/ImageTypes.flow.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@ export type ImageSize = {

export type ImageResolvedAssetSource = ResolvedAssetSource;

// Declared outside the object type below so that the generated TypeScript keeps
// `null`: `?T` on an object member is translated to `T | undefined`, while
// `resolveAssetSource` returns `null` for an asset that isn't registered.
type ResolveAssetSourceResult = ?ImageResolvedAssetSource;

type ImageComponentStaticsIOS = Readonly<{
getSize(uri: string): Promise<ImageSize>,
getSize(
Expand Down Expand Up @@ -59,7 +64,7 @@ type ImageComponentStaticsIOS = Readonly<{
/**
* @see https://reactnative.dev/docs/image#resolveassetsource
*/
resolveAssetSource(source: ImageSource): ?ImageResolvedAssetSource,
resolveAssetSource(source: ImageSource): ResolveAssetSourceResult,
}>;

type ImageComponentStaticsAndroid = Readonly<{
Expand Down
16 changes: 9 additions & 7 deletions packages/react-native/ReactNativeApi.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @generated SignedSource<<eda44383e13efcfb4f814115c4b44547>>
* @generated SignedSource<<f792da24f6e94acbcf8f33d00cc13968>>
*
* This file was generated by scripts/js-api/build-types/index.js.
*/
Expand Down Expand Up @@ -2466,7 +2466,7 @@ declare type ImageComponentStaticsIOS = {
queryCache(urls: Array<string>): Promise<{
[url: string]: "disk" | "disk/memory" | "memory"
}>
resolveAssetSource(source: ImageSource): ImageResolvedAssetSource | undefined
resolveAssetSource(source: ImageSource): ResolveAssetSourceResult
}
declare type ImageErrorEvent = NativeSyntheticEvent<
Readonly<ImageErrorEventData>
Expand Down Expand Up @@ -4116,6 +4116,8 @@ declare type RequiredVirtualizedSectionListProps<
sections: ReadonlyArray<SectionListData<ItemT, SectionT>>
}
declare type requireNativeComponent = typeof requireNativeComponent
declare type ResolveAssetSourceResult =
ImageResolvedAssetSource | null | undefined
declare type ResolvedAssetSource = {
readonly height: number | undefined
readonly scale: number
Expand Down Expand Up @@ -5791,7 +5793,7 @@ export {
AlertOptions, // 8a116d2a
AlertType, // 5ab91217
AndroidKeyboardEvent, // e03becc8
Animated, // 33fe7464
Animated, // 89733ea3
AppConfig, // 35c0ca70
AppRegistry, // edec2a30
AppState, // 12012be5
Expand Down Expand Up @@ -5856,10 +5858,10 @@ export {
IEventEmitter, // fbef6131
IOSKeyboardEvent, // e67bfe3a
IgnorePattern, // ec6f6ece
Image, // a24a5777
ImageBackground, // 1fbbacef
ImageBackgroundInstance, // 9c900a60
ImageBackgroundProps, // b078f0ac
Image, // de357ba4
ImageBackground, // fd50fdb6
ImageBackgroundInstance, // 61ab8daf
ImageBackgroundProps, // 49c3326d
ImageErrorEvent, // b6227714
ImageInstance, // df709524
ImageLoadEvent, // 31709c38
Expand Down
Loading