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

when i use svg file in iOS ,erverthing is ok,but got an error in Android.Error while updating property 'name' of a view managed by :RNSVGGroup Value for name cannot be cast from Double to String #1077

Closed
sanqi-med opened this issue Aug 21, 2019 · 5 comments

Comments

@sanqi-med
Copy link

my svg file is:

<title>icon/yy_02</title> Created with Sketch.

I notice that when id = "1", I got this error , I change the id = "svg_1", everthing is ok.I think that in Android SDK cannot transform number to string ?

@sanqi-med
Copy link
Author

sanqi-med commented Aug 21, 2019

my svg file:

<?xml version="1.0" encoding="UTF-8"?>
<svg width="48px" height="48px" viewBox="0 0 48 48" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
    <!-- Generator: Sketch 55.2 (78181) - https://sketchapp.com -->
    <title>icon/yy_02</title>
    <desc>Created with Sketch.</desc>
    <g id="icon/yy_02" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
        <g id="1">
            <rect id="矩形" fill="#F99100" x="0" y="0" width="48" height="48" rx="24"></rect>
            <g id="huodong" transform="translate(12.000000, 15.000000)" fill="#FFFFFF" fill-rule="nonzero">
                <path d="M1.88894731,2.05169094 C3.32598435,1.62206131 4.73339175,1.13317242 6.14079916,0.777616869 C8.40746583,0.199839091 10.6148732,0.644283535 12.7630214,1.38502428 C15.1778362,2.21465391 17.5778362,2.54057983 20.0222806,1.56280205 C20.8963547,1.22206131 21.6815399,0.629468721 22.5111695,0.229468721 C22.8519103,0.0665057577 23.355614,-0.0816423905 23.6519103,0.0516909428 C23.8593177,0.140579832 23.992651,0.733172424 23.9630214,1.07391317 C23.7704288,3.99243168 23.5185769,6.9109502 23.3259843,9.82946872 C23.2815399,10.4665058 23.0889473,10.9109502 22.555614,11.2665058 C20.0963547,13.0294687 17.355614,13.7850243 14.3482066,13.4590984 C12.2593177,13.2368761 10.2445029,13.3998391 8.39265101,14.4516909 C8.05191027,14.6442835 7.71116953,14.8813206 7.41487323,15.1479872 C6.67413249,15.7850243 6.34820657,16.4516909 6.74820657,17.488728 C7.40005842,19.1628021 7.85931768,20.9109502 8.43709546,22.6294687 C8.62968805,23.2368761 8.58524361,23.6961354 7.96302138,23.888728 C7.32598435,24.0665058 7.08894731,23.6368761 6.91116953,23.1035428 C4.92598435,16.8220613 2.94079916,10.5553946 0.940799161,4.28872798 C0.674132494,3.42946872 0.363021383,2.57020946 0.0963547163,1.72576502 C-0.0517934318,1.26650576 -0.0962378763,0.807246498 0.466725087,0.614653906 C1.07413249,0.407246498 1.41487323,0.71835761 1.60746583,1.26650576 C1.74079916,1.54798724 1.81487323,1.82946872 1.88894731,2.05169094 Z" id="路径"></path>
            </g>
        </g>
    </g>
</svg>

@sanqi-med sanqi-med changed the title when i use svg in Android,I got an error "Value canot transform from Double to String",but is fine in iOS Error while updating property 'name' of a view managed by :RNSVGGroup Value for name cannot be cast from Double to String Aug 21, 2019
@sanqi-med sanqi-med changed the title Error while updating property 'name' of a view managed by :RNSVGGroup Value for name cannot be cast from Double to String when i use svg file in iOS ,erverthing is ok,but got an error in Android.Error while updating property 'name' of a view managed by :RNSVGGroup Value for name cannot be cast from Double to String Aug 21, 2019
@fhugoduarte
Copy link

Same problem here!

@fhugoduarte
Copy link

@MrZhaoCn Fix this issue after removing title and desc tags and removing id property from internal g tags. So, try this:

<?xml version="1.0" encoding="UTF-8"?>
<svg width="48px" height="48px" viewBox="0 0 48 48" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
    <!-- Generator: Sketch 55.2 (78181) - https://sketchapp.com -->

    <g id="icon/yy_02" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
        <g>
            <rect id="矩形" fill="#F99100" x="0" y="0" width="48" height="48" rx="24"></rect>
            <g transform="translate(12.000000, 15.000000)" fill="#FFFFFF" fill-rule="nonzero">
                <path d="M1.88894731,2.05169094 C3.32598435,1.62206131 4.73339175,1.13317242 6.14079916,0.777616869 C8.40746583,0.199839091 10.6148732,0.644283535 12.7630214,1.38502428 C15.1778362,2.21465391 17.5778362,2.54057983 20.0222806,1.56280205 C20.8963547,1.22206131 21.6815399,0.629468721 22.5111695,0.229468721 C22.8519103,0.0665057577 23.355614,-0.0816423905 23.6519103,0.0516909428 C23.8593177,0.140579832 23.992651,0.733172424 23.9630214,1.07391317 C23.7704288,3.99243168 23.5185769,6.9109502 23.3259843,9.82946872 C23.2815399,10.4665058 23.0889473,10.9109502 22.555614,11.2665058 C20.0963547,13.0294687 17.355614,13.7850243 14.3482066,13.4590984 C12.2593177,13.2368761 10.2445029,13.3998391 8.39265101,14.4516909 C8.05191027,14.6442835 7.71116953,14.8813206 7.41487323,15.1479872 C6.67413249,15.7850243 6.34820657,16.4516909 6.74820657,17.488728 C7.40005842,19.1628021 7.85931768,20.9109502 8.43709546,22.6294687 C8.62968805,23.2368761 8.58524361,23.6961354 7.96302138,23.888728 C7.32598435,24.0665058 7.08894731,23.6368761 6.91116953,23.1035428 C4.92598435,16.8220613 2.94079916,10.5553946 0.940799161,4.28872798 C0.674132494,3.42946872 0.363021383,2.57020946 0.0963547163,1.72576502 C-0.0517934318,1.26650576 -0.0962378763,0.807246498 0.466725087,0.614653906 C1.07413249,0.407246498 1.41487323,0.71835761 1.60746583,1.26650576 C1.74079916,1.54798724 1.81487323,1.82946872 1.88894731,2.05169094 Z" id="路径"></path>
            </g>
        </g>
    </g>
</svg>

@msand
Copy link
Collaborator

msand commented Sep 27, 2019

I think id has to start with a letter, numbers can only come as the second character in the string.

@msand msand closed this as completed in 2fb39f5 Sep 28, 2019
msand pushed a commit that referenced this issue Sep 28, 2019
## [9.9.9](v9.9.8...v9.9.9) (2019-09-28)

### Bug Fixes

* handling of numeric id ([2fb39f5](2fb39f5)), closes [#1077](#1077)
@msand
Copy link
Collaborator

msand commented Sep 28, 2019

🎉 This issue has been resolved in version 9.9.9 🎉

The release is available on:

Your semantic-release bot 📦🚀

@msand msand added the released label Sep 28, 2019
JackWillie added a commit to JackWillie/react-native-svg that referenced this issue Nov 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants