-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
updated SDWebImage version to 5.15.5 #1001
Open
mowaisch
wants to merge
2
commits into
DylanVann:main
Choose a base branch
from
mowaisch:feature/fixed-gif-speed
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 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,144 @@ | ||
'use strict'; | ||
|
||
var _extends = require('@babel/runtime/helpers/extends'); | ||
var React = require('react'); | ||
var reactNative = require('react-native'); | ||
|
||
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; } | ||
|
||
var _extends__default = /*#__PURE__*/_interopDefaultLegacy(_extends); | ||
var React__default = /*#__PURE__*/_interopDefaultLegacy(React); | ||
|
||
const resizeMode = { | ||
contain: 'contain', | ||
cover: 'cover', | ||
stretch: 'stretch', | ||
center: 'center' | ||
}; | ||
const priority = { | ||
low: 'low', | ||
normal: 'normal', | ||
high: 'high' | ||
}; | ||
const cacheControl = { | ||
// Ignore headers, use uri as cache key, fetch only if not in cache. | ||
immutable: 'immutable', | ||
// Respect http headers, no aggressive caching. | ||
web: 'web', | ||
// Only load from cache. | ||
cacheOnly: 'cacheOnly' | ||
}; | ||
|
||
const resolveDefaultSource = defaultSource => { | ||
if (!defaultSource) { | ||
return null; | ||
} | ||
|
||
if (reactNative.Platform.OS === 'android') { | ||
// Android receives a URI string, and resolves into a Drawable using RN's methods. | ||
const resolved = reactNative.Image.resolveAssetSource(defaultSource); | ||
|
||
if (resolved) { | ||
return resolved.uri; | ||
} | ||
|
||
return null; | ||
} // iOS or other number mapped assets | ||
// In iOS the number is passed, and bridged automatically into a UIImage | ||
|
||
|
||
return defaultSource; | ||
}; | ||
|
||
function FastImageBase({ | ||
source, | ||
defaultSource, | ||
tintColor, | ||
onLoadStart, | ||
onProgress, | ||
onLoad, | ||
onError, | ||
onLoadEnd, | ||
style, | ||
fallback, | ||
children, | ||
// eslint-disable-next-line no-shadow | ||
resizeMode = 'cover', | ||
forwardedRef, | ||
...props | ||
}) { | ||
if (fallback) { | ||
const cleanedSource = { ...source | ||
}; | ||
delete cleanedSource.cache; | ||
const resolvedSource = reactNative.Image.resolveAssetSource(cleanedSource); | ||
return /*#__PURE__*/React__default['default'].createElement(reactNative.View, { | ||
style: [styles.imageContainer, style], | ||
ref: forwardedRef | ||
}, /*#__PURE__*/React__default['default'].createElement(reactNative.Image, _extends__default['default']({}, props, { | ||
style: [reactNative.StyleSheet.absoluteFill, { | ||
tintColor | ||
}], | ||
source: resolvedSource, | ||
defaultSource: defaultSource, | ||
onLoadStart: onLoadStart, | ||
onProgress: onProgress, | ||
onLoad: onLoad, | ||
onError: onError, | ||
onLoadEnd: onLoadEnd, | ||
resizeMode: resizeMode | ||
})), children); | ||
} | ||
|
||
const resolvedSource = reactNative.Image.resolveAssetSource(source); | ||
const resolvedDefaultSource = resolveDefaultSource(defaultSource); | ||
return /*#__PURE__*/React__default['default'].createElement(reactNative.View, { | ||
style: [styles.imageContainer, style], | ||
ref: forwardedRef | ||
}, /*#__PURE__*/React__default['default'].createElement(FastImageView, _extends__default['default']({}, props, { | ||
tintColor: tintColor, | ||
style: reactNative.StyleSheet.absoluteFill, | ||
source: resolvedSource, | ||
defaultSource: resolvedDefaultSource, | ||
onFastImageLoadStart: onLoadStart, | ||
onFastImageProgress: onProgress, | ||
onFastImageLoad: onLoad, | ||
onFastImageError: onError, | ||
onFastImageLoadEnd: onLoadEnd, | ||
resizeMode: resizeMode | ||
})), children); | ||
} | ||
|
||
const FastImageMemo = /*#__PURE__*/React.memo(FastImageBase); | ||
const FastImageComponent = /*#__PURE__*/React.forwardRef((props, ref) => /*#__PURE__*/React__default['default'].createElement(FastImageMemo, _extends__default['default']({ | ||
forwardedRef: ref | ||
}, props))); | ||
FastImageComponent.displayName = 'FastImage'; | ||
const FastImage = FastImageComponent; | ||
FastImage.resizeMode = resizeMode; | ||
FastImage.cacheControl = cacheControl; | ||
FastImage.priority = priority; | ||
|
||
FastImage.preload = sources => reactNative.NativeModules.FastImageView.preload(sources); | ||
|
||
FastImage.clearMemoryCache = () => reactNative.NativeModules.FastImageView.clearMemoryCache(); | ||
|
||
FastImage.clearDiskCache = () => reactNative.NativeModules.FastImageView.clearDiskCache(); | ||
|
||
const styles = reactNative.StyleSheet.create({ | ||
imageContainer: { | ||
overflow: 'hidden' | ||
} | ||
}); // Types of requireNativeComponent are not correct. | ||
|
||
const FastImageView = reactNative.requireNativeComponent('FastImageView', FastImage, { | ||
nativeOnly: { | ||
onFastImageLoadStart: true, | ||
onFastImageProgress: true, | ||
onFastImageLoad: true, | ||
onFastImageError: true, | ||
onFastImageLoadEnd: true | ||
} | ||
}); | ||
|
||
module.exports = FastImage; |
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,75 @@ | ||
// @flow | ||
|
||
import type { ViewProps } from 'react-native/Libraries/Components/View/ViewPropTypes' | ||
import type { SyntheticEvent } from 'react-native/Libraries/Types/CoreEventTypes' | ||
|
||
export type OnLoadEvent = SyntheticEvent< | ||
$ReadOnly<{ | ||
width: number, | ||
height: number, | ||
}>, | ||
> | ||
|
||
export type OnProgressEvent = SyntheticEvent< | ||
$ReadOnly<{| | ||
loaded: number, | ||
total: number, | ||
|}>, | ||
> | ||
|
||
export type ResizeMode = $ReadOnly<{| | ||
contain: 'contain', | ||
cover: 'cover', | ||
stretch: 'stretch', | ||
center: 'center', | ||
|}> | ||
|
||
export type Priority = $ReadOnly<{| | ||
low: 'low', | ||
normal: 'normal', | ||
high: 'high', | ||
|}> | ||
|
||
export type CacheControl = $ReadOnly<{| | ||
immutable: 'immutable', | ||
web: 'web', | ||
cacheOnly: 'cacheOnly', | ||
|}> | ||
|
||
export type ResizeModes = $Values<ResizeMode> | ||
export type Priorities = $Values<Priority> | ||
export type CacheControls = $Values<CacheControl> | ||
|
||
export type PreloadFn = (sources: Array<FastImageSource>) => void | ||
export type FastImageSource = { | ||
uri?: string, | ||
headers?: Object, | ||
priority?: Priorities, | ||
cache?: CacheControls, | ||
} | ||
|
||
export type FastImageProps = $ReadOnly<{| | ||
...ViewProps, | ||
onError?: ?() => void, | ||
onLoad?: ?(event: OnLoadEvent) => void, | ||
onLoadEnd?: ?() => void, | ||
onLoadStart?: ?() => void, | ||
onProgress?: ?(event: OnProgressEvent) => void, | ||
|
||
source?: ?(FastImageSource | number), | ||
defaultSource?: ?number, | ||
|
||
tintColor?: number | string, | ||
resizeMode?: ?ResizeModes, | ||
fallback?: ?boolean, | ||
testID?: ?string, | ||
|}> | ||
|
||
declare export default class FastImage extends React$Component<FastImageProps> { | ||
static resizeMode: ResizeMode; | ||
static priority: Priority; | ||
static cacheControl: CacheControl; | ||
static preload: PreloadFn; | ||
static clearMemoryCache: () => Promise<void>; | ||
static clearDiskCache: () => Promise<void>; | ||
} |
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,103 @@ | ||
import React from 'react'; | ||
import { FlexStyle, LayoutChangeEvent, ShadowStyleIOS, StyleProp, TransformsStyle, ImageRequireSource, AccessibilityProps, ViewProps, ColorValue } from 'react-native'; | ||
export declare type ResizeMode = 'contain' | 'cover' | 'stretch' | 'center'; | ||
declare const resizeMode: { | ||
readonly contain: "contain"; | ||
readonly cover: "cover"; | ||
readonly stretch: "stretch"; | ||
readonly center: "center"; | ||
}; | ||
export declare type Priority = 'low' | 'normal' | 'high'; | ||
declare const priority: { | ||
readonly low: "low"; | ||
readonly normal: "normal"; | ||
readonly high: "high"; | ||
}; | ||
declare type Cache = 'immutable' | 'web' | 'cacheOnly'; | ||
declare const cacheControl: { | ||
readonly immutable: "immutable"; | ||
readonly web: "web"; | ||
readonly cacheOnly: "cacheOnly"; | ||
}; | ||
export declare type Source = { | ||
uri?: string; | ||
headers?: { | ||
[key: string]: string; | ||
}; | ||
priority?: Priority; | ||
cache?: Cache; | ||
}; | ||
export interface OnLoadEvent { | ||
nativeEvent: { | ||
width: number; | ||
height: number; | ||
}; | ||
} | ||
export interface OnProgressEvent { | ||
nativeEvent: { | ||
loaded: number; | ||
total: number; | ||
}; | ||
} | ||
export interface ImageStyle extends FlexStyle, TransformsStyle, ShadowStyleIOS { | ||
backfaceVisibility?: 'visible' | 'hidden'; | ||
borderBottomLeftRadius?: number; | ||
borderBottomRightRadius?: number; | ||
backgroundColor?: string; | ||
borderColor?: string; | ||
borderWidth?: number; | ||
borderRadius?: number; | ||
borderTopLeftRadius?: number; | ||
borderTopRightRadius?: number; | ||
overlayColor?: string; | ||
opacity?: number; | ||
} | ||
export interface FastImageProps extends AccessibilityProps, ViewProps { | ||
source?: Source | ImageRequireSource; | ||
defaultSource?: ImageRequireSource; | ||
resizeMode?: ResizeMode; | ||
fallback?: boolean; | ||
onLoadStart?(): void; | ||
onProgress?(event: OnProgressEvent): void; | ||
onLoad?(event: OnLoadEvent): void; | ||
onError?(): void; | ||
onLoadEnd?(): void; | ||
/** | ||
* onLayout function | ||
* | ||
* Invoked on mount and layout changes with | ||
* | ||
* {nativeEvent: { layout: {x, y, width, height}}}. | ||
*/ | ||
onLayout?: (event: LayoutChangeEvent) => void; | ||
/** | ||
* | ||
* Style | ||
*/ | ||
style?: StyleProp<ImageStyle>; | ||
/** | ||
* TintColor | ||
* | ||
* If supplied, changes the color of all the non-transparent pixels to the given color. | ||
*/ | ||
tintColor?: ColorValue; | ||
/** | ||
* A unique identifier for this element to be used in UI Automation testing scripts. | ||
*/ | ||
testID?: string; | ||
/** | ||
* Render children within the image. | ||
*/ | ||
children?: React.ReactNode; | ||
} | ||
export interface FastImageStaticProperties { | ||
resizeMode: typeof resizeMode; | ||
priority: typeof priority; | ||
cacheControl: typeof cacheControl; | ||
preload: (sources: Source[]) => void; | ||
clearMemoryCache: () => Promise<void>; | ||
clearDiskCache: () => Promise<void>; | ||
} | ||
declare const FastImage: React.ComponentType<FastImageProps> & FastImageStaticProperties; | ||
export default FastImage; | ||
//# sourceMappingURL=index.d.ts.map |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.