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: do not crash when borderRadius is set on Android #2415

Merged
merged 4 commits into from
Sep 30, 2024

Conversation

jakex7
Copy link
Member

@jakex7 jakex7 commented Aug 20, 2024

Summary

Fixes #2462
Currently, on Android, when borderRadius style is applied to a Svg component an error occurs, stating Cannot cast Double to Float

This PR updates the codegen types, changing them from Double to Dynamic, aligning with the implementation with the ViewProps.

Test

Tested on

  • react-native@0.76.0-rc.1
  • react-native@0.75.1
  • react-native@0.74.2
  • react-native@0.73.9

Test case

<Svg
  width="60"
  height="60"
  viewBox="0 0 24 24"
  style={{
    borderRadius: 16.2,
    borderTopLeftRadius: 16.2,
    borderBottomRightRadius: 16.2,
    borderStartStartRadius: 16.2,
    borderStartEndRadius: 16.2,
    borderTopRightRadius: 16.2,
    borderBottomLeftRadius: 16.2,
    borderTopStartRadius: 16.2,
    borderTopEndRadius: 16.2,
    borderBottomStartRadius: 16.2,
    borderBottomEndRadius: 16.2,
    borderEndEndRadius: 16.2,
    borderEndStartRadius: 16.2,
  }}>
  <Rect x="0" y="0" width="24" height="24" fill="red" />
</Svg>

Compatibility

OS Implemented
Android

@jakex7 jakex7 marked this pull request as draft August 20, 2024 09:11
@bohdanprog
Copy link
Member

I guess that issue is related to that PR.

@jakex7 jakex7 closed this Sep 30, 2024
@jakex7 jakex7 force-pushed the @jakex7/preventCrashingWhenProvidedBorderRadius branch from 0d2c832 to aa7701d Compare September 30, 2024 10:22
@jakex7 jakex7 reopened this Sep 30, 2024
@jakex7 jakex7 marked this pull request as ready for review September 30, 2024 10:27
@jakex7
Copy link
Member Author

jakex7 commented Sep 30, 2024

I guess that issue is related to that PR.

It's not

@jakex7 jakex7 merged commit cc96177 into main Sep 30, 2024
11 of 12 checks passed
@jakex7 jakex7 deleted the @jakex7/preventCrashingWhenProvidedBorderRadius branch September 30, 2024 11:02
jakex7 added a commit that referenced this pull request Sep 30, 2024
# Summary

Formatting and rename variable committed in #2415
@Avestas-dev
Copy link

I'm experiencing the same issue after upgrading from React Native 0.74.3 to 0.75.4. This error also occurs on both newer and older versions of react-native-svg. This is currently blocking me from upgrading React Native. Do you have any plans to release a new version with this fix soon, @jakex7?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Float to Double conversion bug for Radius values on Android
3 participants