Skip to content
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

Svg images not shown with dynamic link on react-native 65 #838

Open
Aggroid opened this issue Oct 10, 2021 · 4 comments
Open

Svg images not shown with dynamic link on react-native 65 #838

Aggroid opened this issue Oct 10, 2021 · 4 comments
Labels

Comments

@Aggroid
Copy link

Aggroid commented Oct 10, 2021

Hey guys, I'm trying to show SVG images from s3 public bucket. No headers required or anything. I want to try to show them with react-native-fast-image because when I use react-native-SVG there is a huge performance issue on android. I have proximately 10-12 SVG images per screen and sometimes it takes 1-2 seconds to load them.

What I'm trying with react-native-fast-image is :

import React, { useRef } from 'react';
import { View } from 'react-native';
import {
Svg,
G,
Circle,
Defs,
LinearGradient,
Mask,
Rect,
Stop,
} from 'react-native-svg';
import FastImage from 'react-native-fast-image';

const YourImage = (props) => (
<FastImage
// eslint-disable-next-line react/prop-types
onLoad={props.onLoad}
style={{ width: props.svgSilkWidth, height: props.svgSilkHeight }}
source={{
uri: props.silkUrl,
priority: FastImage.priority.normal,
cache: FastImage.cacheControl.web,
}}
resizeMode={FastImage.resizeMode.contain}
/>
);

// eslint-disable-next-line react/display-name
export default (silkUrl) => {
const svg = useRef(null);
return (
<View style={{ flex: 1, justifyContent: 'center' }}>














<YourImage
silkUrl={silkUrl.silkUrl}
svgSilkWidth={silkUrl.svgSilkWidth}
svgSilkHeight={silkUrl.svgSilkHeight}
onLoad={() => {
svg?.current?.forceUpdate?.();
}}
/>

                    </View>
                </G>
            </G>
        </Svg>
    </View>
);

};

But nothing is showing. I did try to get an SVG URL from google just to try still not showing. All other formats like png, jpeg and etc are working.

Can I get a hand with that pleases?

Thanks!

@Aggroid Aggroid added the bug label Oct 10, 2021
@lorran-xo
Copy link

Did you get any solution for this? SVG takes way too long to load and react-native-fast-image does not support .svg from what I know.

@mayankpandav
Copy link

any update?

@Aggroid
Copy link
Author

Aggroid commented Feb 4, 2023

Not yet

@ogbodo
Copy link

ogbodo commented Apr 1, 2024

No update yet on this issue???

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
4 participants