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

fix(android): Incorrect mapping of svg files #529

Closed
wants to merge 1 commit into from

Conversation

msand
Copy link

@msand msand commented Mar 9, 2020

software-mansion/react-native-svg#1306
react-native-community/cli#1042
facebook/react-native#28266

Summary:

Fix mapping of svg files. They're currently bundled to the drawable folder incorrectly.

Test Plan:

LocalSvg.js

import React, {useState, useEffect} from 'react';
import {SvgCss} from 'react-native-svg';
import loadLocalResource from 'react-native-local-resource';

export function LocalSvg({asset, ...rest}) {
  const [xml, setXml] = useState(null);
  useEffect(() => {
    loadLocalResource(asset).then(setXml);
  }, [asset]);
  return <SvgCss xml={xml} {...rest} />;
}

App.js

import React from 'react';
import {LocalSvg} from './LocalSvg';
export default () => <LocalSvg asset={require('./test.svg')} />;

test.svg: any svg content

The develop branch of react-native-svg contains an optimized version of LocalSvg, waiting to be released once this set of pull requests are merged.

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Mar 9, 2020
@robhogan
Copy link
Contributor

Closing this as stale but for posterity:

  • The relevant extension list moved in 40f9f06#diff-a3434a8821631e3dd7c2b869d8f727233d95622bd866557201304b767e011ecc
  • I'm not sure what "bundled into the drawing folder" means in the context of Metro and how the different PRs mentioned in the summary are meant to relate - I'm not aware that Metro's asset list is causing a problem here (in Metro, an asset is a file that can be referenced from JS but isn't source).

@robhogan robhogan closed this Dec 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants