Giter Site home page Giter Site logo

[Android] SvgFromUri doesn't work RN 0.74, New Arch + bridgelessMode ON. Jest tests failed. Patch is provided about react-native-svg HOT 7 OPEN

AptypTheKing avatar AptypTheKing commented on June 25, 2024
[Android] SvgFromUri doesn't work RN 0.74, New Arch + bridgelessMode ON. Jest tests failed. Patch is provided

from react-native-svg.

Comments (7)

AptypTheKing avatar AptypTheKing commented on June 25, 2024 1

@bohdanprog

I'm not mocking react-native-svg library, cause I'm testing if my custom Icon component is working as expected.

function Icon({ style, source, size = IconSizes.medium, testID }: Props): React.JSX.Element | null {
  if (!source) return null

  if (isURL(source)) {
    return (
      <SvgFromUri
        fill={style?.color}
        height={ICON[size].fontSize}
        testID={testID}
        uri={source}
        width={ICON[size].fontSize}
      />
    )
  }

  const FontelloIcon = createIconSetFromFontello(fontelloConfig)

  return (
    <FontelloIcon
      name={source}
      style={[style, ICON[size]]}
      testID={testID}
    />
  )
}

Everything is working fine on bridglessMode OFF, it's just crashing after I switch it on.

from react-native-svg.

bohdanprog avatar bohdanprog commented on June 25, 2024

@AptypTheKing Hey, can you share your test case with the reproduction of that bug? We would appreciate that.
We checked that in New Arch and Old Arch but didn't get that error.

from react-native-svg.

AptypTheKing avatar AptypTheKing commented on June 25, 2024

@AptypTheKing Hey, can you share your test case with the reproduction of that bug? We would appreciate that.

We checked that in New Arch and Old Arch but didn't get that error.

Yes sure, I will provide it. It's very simple actually. Did you check it on bridglessMode ON? It's throwing this error only when it's on. It's ON by default in RN 0.74, but in previous versions it should be done manually.

from react-native-svg.

bohdanprog avatar bohdanprog commented on June 25, 2024

@AptypTheKing Hey, can you share your test case with the reproduction of that bug? We would appreciate that.
We checked that in New Arch and Old Arch but didn't get that error.

Yes sure, I will provide it. It's very simple actually. Did you check it on bridglessMode ON? It's throwing this error only when it's on. It's ON by default in RN 0.74, but in previous versions it should be done manually.

Yes, I tested that with bridglessMode ON, on Android and IOS platforms :)

from react-native-svg.

AptypTheKing avatar AptypTheKing commented on June 25, 2024

@bohdanprog

it('Snapshot source from link', () => {
  const component = renderComponent(
   <SvgFromUri
      height={16}
      uri='https://www.svgrepo.com/show/22031/home-icon-silhouette.svg'
      width={16},
/>
  )

  setTimeout(() => {
    const tree = component.toJSON()

    expect(tree).toMatchSnapshot()
  }, 2000)
})

During jest test I have same error in console, which is on screenshot. But with my patch it's fixed.

from react-native-svg.

bohdanprog avatar bohdanprog commented on June 25, 2024

@AptypTheKing can you share how you mocked react-native-svg library, please
I want to reproduce the same steps as you :)

from react-native-svg.

bohdanprog avatar bohdanprog commented on June 25, 2024

After talking with @AptypTheKing, we found that the problem he encountered is related to the TypeScript configuration, not the library.

from react-native-svg.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.