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

UIImage imageWithSize (UIGraphicsBeginImageContext) causing crash on iOS 17 (XCode 15) #7790

Open
1 task done
OskarEichler opened this issue Sep 25, 2023 · 4 comments
Open
1 task done

Comments

@OskarEichler
Copy link

What happened?

On the latest version of react-native-navigation and react-native, when we are trying to run our app on iOS 17, we are receiving the following main thread crash:

Exception	NSException *	"UIGraphicsBeginImageContext() failed to allocate CGBitampContext: size={1, 0}, scale=1.000000, bitmapInfo=0x2002. Use UIGraphicsImageRenderer to avoid this assert."	0x0000600000d35170

It seems to be cause by UIGraphicsBeginImageContext(size); inside the imageWithSize method in UIImage+utils.m

When commenting out the line it works. I assume it's because it's passing the height as 0, but not sure where this is coming from as the stack-trace is incomplete. This should definitely be handled.

Potentially some more useful information here: https://developer.apple.com/forums/thread/733326

What was the expected behaviour?

No response

Was it tested on latest react-native-navigation?

  • I have tested this issue on the latest react-native-navigation release and it still reproduces.

Help us reproduce this issue!

No response

In what environment did this happen?

React Native Navigation version: 7.37.0-hotfix.1
React Native version: 0.72.5
Has Fabric (React Native's new rendering system) enabled: no
Device model: iPhone 15 Pro
iOS version: 17.0

@OskarEichler
Copy link
Author

OskarEichler commented Sep 25, 2023

It seems to happen when we set

  bottomTabs: {
    backgroundColor: globalStyles.colors.base,
    borderColor: globalStyles.colors.gray2,
    borderWidth: Platform.OS === 'ios' ? 0 : 1,
  },

Setting it to 0 or to null both causes the crash... - setting it to undefined fixed it.

Would still be good to handle the 0 case.

@vincentzierigen
Copy link

@OskarEichler you are a live saver! And indeed, it should accept 0 or even null

@yogevbd yogevbd self-assigned this Sep 27, 2023
@Spxc
Copy link

Spxc commented Nov 12, 2023

Anyone able to solve this? Setting the options did not solve it for me.

Edit: Solved by setting the following:

Navigation.setDefaultOptions({
  bottomTabs: {
          borderWidth: undefined,
      }
})

Before i had Platform.OS === 'ios' ? 0 : 1 for theborderWidth. Should support null or 0

@AJV2018
Copy link

AJV2018 commented Jul 20, 2024

in my case it happened when tintColor was passed in FastImage
<FastImage tintColor={'#000000'} style={styles.iconStyle1} source={require('../../assets/close.png')} />

this fixed the issue
<Image style={[styles.iconStyle1, { tintColor: '#000000' }]} source={require('../../assets/close.png')} />

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

5 participants