Using ViroButton or ViroImage+onClick crashes AR Scene
[1] Previously reported issue on Discord: https://discord.com/channels/774471080713781259/942014767571292200/1216793041118171136 [2] Previous Github issue with same exact behavior: https://github.com/ReactVision/viro/issues/272 [3] Previous attempt at a solution that was closed: https://github.com/ReactVision/viro/pull/320
Development Platform: with Mac, MacOS Sequoia 15.5 Device: iPhone 16 Pro, iOS 18.5 React Native Version: ^0.76.9 Expo Version: ~52.0.42 @reactvision/react-viro: ^2.43.0
Problem: When using a ViroButton, AR scene automatically crashes upon start. When using a ViroImage, AR scene DOESN'T automatically crash upon start... however, adding onClick to the ViroImage causes the scene to automatically crash upon start. Same exact problem with exact errors/crash messages linked in [1] and [2]
Current Workaround: use onClickState, as mentioned in [2]
Example Usage:
function InitialScene() {
const onTrackingUpdated = (state: ViroConstants) => {
if (state === ViroConstants.TRACKING_NORMAL) {
setText('AR tracking is normal');
} else if (state === ViroConstants.TRACKING_LIMITED) {
setText('AR tracking is limited');
} else if (state === ViroConstants.TRACKING_UNAVAILABLE) {
setText('AR tracking is not available');
}
};
return(
<ViroARScene onTrackingUpdated={onTrackingUpdated}>
<ViroText
text={text}
scale={[0.3, 0.3, 0.3]}
position={[0.5, 1, -2]}
style={styles.statusTextStyle}
/>
<ViroImage
source={BUTTON_PLUS_SRC.default}
position={[0, 0, -1]}
height={0.5}
width={0.5}
onClickState={handleAddButtonClick}
transformBehaviors={['billboard']}
/>
<ViroButton {...literallyAnyPropsCausesCrash} />
</ViroARScene>
);
}
Thanks for reporting and flagging this - we'll take a look!