Skip to content

Maybe fix assets 2 #2856

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

Merged
merged 45 commits into from
Dec 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
5ecca10
fix image svg
mendyEdri Aug 28, 2023
7c7b0f5
check for svg closing tag instead of checking only for string type
mendyEdri Aug 29, 2023
d1ed4b2
lint
mendyEdri Aug 29, 2023
c2ec347
Fix TS errors
ethanshar Aug 29, 2023
d51c723
check for svg data as well
mendyEdri Aug 29, 2023
e8e91ff
ts
mendyEdri Aug 29, 2023
9d6d5ca
support both svg and image
mendyEdri Aug 29, 2023
307f60d
lint
mendyEdri Aug 29, 2023
750eba0
lint
mendyEdri Aug 29, 2023
655173e
split web and mobile
mendyEdri Aug 30, 2023
690828d
overlay
mendyEdri Aug 30, 2023
6847a10
dynamic aspect-ratio
mendyEdri Aug 30, 2023
1ba6557
image fit
mendyEdri Aug 30, 2023
124b7a4
remove old web implementation
mendyEdri Sep 4, 2023
25e4214
Merge branch 'master' into maybe-fix-assets
mendyEdri Nov 8, 2023
7428120
Merge branch 'master' into maybe-fix-assets
mendyEdri Nov 22, 2023
26610c2
remove default alt image
mendyEdri Nov 27, 2023
192201c
Merge branch 'master' into maybe-fix-assets
mendyEdri Nov 27, 2023
8336244
revert lint
mendyEdri Nov 27, 2023
898f7c8
remove default alt
mendyEdri Nov 27, 2023
efd62a3
handle missing asset - alt
mendyEdri Nov 29, 2023
3ff826b
remove lint autofix
mendyEdri Nov 29, 2023
4c7b3cb
remove unsued
mendyEdri Nov 29, 2023
24effc7
maybe fix assets
mendyEdri Dec 17, 2023
4da2874
trying to fix build fails
mendyEdri Dec 17, 2023
6862c37
fix lint
mendyEdri Dec 17, 2023
90fac56
try fix ci
mendyEdri Dec 17, 2023
ff05ffc
remove comment
mendyEdri Dec 17, 2023
ba4bc1f
try again
mendyEdri Dec 17, 2023
fb99efa
maybe without the specifc change in web
mendyEdri Dec 17, 2023
912cca5
remove unused
mendyEdri Dec 17, 2023
7e8b31b
source fix
mendyEdri Dec 17, 2023
edabeda
added default size same as Icon
mendyEdri Dec 19, 2023
b8e0ec8
replace default size with aspectRatio
mendyEdri Dec 19, 2023
23b0b11
default aspect ratio only for web
mendyEdri Dec 19, 2023
b6ce407
aspectRatio by defaut and strech
mendyEdri Dec 20, 2023
02f6159
fix build
mendyEdri Dec 20, 2023
2c2975b
trying to fix ci
mendyEdri Dec 20, 2023
869e22b
maybe fix ci
mendyEdri Dec 20, 2023
b7189ba
Remove strech
mendyEdri Dec 20, 2023
878ec1b
lint
mendyEdri Dec 20, 2023
d7b1f00
lint 2
mendyEdri Dec 20, 2023
fe4eb53
check svg only for web
mendyEdri Dec 25, 2023
889e55f
PR review
mendyEdri Dec 25, 2023
09fc87b
lint
mendyEdri Dec 25, 2023
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
1 change: 1 addition & 0 deletions src/components/image/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,7 @@ class Image extends PureComponent<Props, State> {
renderImage = (useImageInsideContainer: boolean) => {
const {error} = this.state;
const source = error ? this.getVerifiedSource(this.props.errorSource) : this.getImageSource();

const {
tintColor,
style,
Expand Down
7 changes: 6 additions & 1 deletion src/utils/imageUtils.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
import get from 'lodash/get';
import {ImageProps} from 'react-native';
import Assets from '../assets';
import {Constants} from '../commons/new';

export function isSvgUri(source?: ImageProps['source']) {
// @ts-expect-error
return typeof source === 'object' && source?.uri?.endsWith?.('.svg');
}

export function isSvg(source?: ImageProps['source']) {
return typeof source === 'string' || typeof source === 'function' || isSvgUri(source);
return typeof source === 'function' || isSvgUri(source) || (Constants.isWeb && isSvgData(source));
}

export function isBase64ImageContent(data: string) {
Expand All @@ -21,3 +22,7 @@ export function getAsset(assetName = '', assetGroup = '') {
return get(Assets, `${assetGroup}.${assetName}`);
}

function isSvgData(source?: ImageProps['source']) {
const sourceString = (source as string);
return typeof source === 'string' && (sourceString.includes('</svg>') || sourceString.includes('data:image/svg'));
}