-
Notifications
You must be signed in to change notification settings - Fork 3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #31296 from JKobrynski/migrateImageToTypeScript
[TS Migration] Migrate Image to TypeScript
- Loading branch information
Showing
14 changed files
with
116 additions
and
133 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
import type {ImageSource} from 'expo-image'; | ||
import type {ImageRequireSource, ImageResizeMode, ImageStyle, ImageURISource, StyleProp} from 'react-native'; | ||
import type {OnyxEntry} from 'react-native-onyx'; | ||
import type {Session} from '@src/types/onyx'; | ||
|
||
type ExpoImageSource = ImageSource | number | ImageSource[]; | ||
|
||
type ImageOnyxProps = { | ||
/** Session info for the currently logged in user. */ | ||
session: OnyxEntry<Session>; | ||
}; | ||
|
||
type ImageOnLoadEvent = { | ||
nativeEvent: { | ||
width: number; | ||
height: number; | ||
}; | ||
}; | ||
|
||
type ImageOwnProps = { | ||
/** Styles for the Image */ | ||
style?: StyleProp<ImageStyle>; | ||
|
||
/** The static asset or URI source of the image */ | ||
source: ExpoImageSource | Omit<ImageURISource, 'cache'> | ImageRequireSource | undefined; | ||
|
||
/** Should an auth token be included in the image request */ | ||
isAuthTokenRequired?: boolean; | ||
|
||
/** How should the image fit within its container */ | ||
resizeMode?: ImageResizeMode; | ||
|
||
/** Event for when the image begins loading */ | ||
onLoadStart?: () => void; | ||
|
||
/** Event for when the image finishes loading */ | ||
onLoadEnd?: () => void; | ||
|
||
/** Error handler */ | ||
onError?: () => void; | ||
|
||
/** Event for when the image is fully loaded and returns the natural dimensions of the image */ | ||
onLoad?: (event: ImageOnLoadEvent) => void; | ||
|
||
/** Progress events while the image is downloading */ | ||
onProgress?: () => void; | ||
}; | ||
|
||
type ImageProps = ImageOnyxProps & ImageOwnProps; | ||
|
||
export type {ImageOwnProps, ImageOnyxProps, ImageProps, ExpoImageSource, ImageOnLoadEvent}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.