question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[IOS] reloading App crashes in Xcode

See original GitHub issue

Description

running on XCode 14.1

 const currState = useSharedValue<State>(State.UNDETERMINED);
const tapGesture = Gesture.Tap()
    .withTestId(`${testID}-tap`)
    .maxDistance(1)
    .onTouchesDown(() => {
      currState.value = State.BEGAN;
    })
    .onTouchesUp(() => {
      if (onPress) runOnJS(onPress)();
    })
    .onTouchesCancelled(() => {
      currState.value = State.UNDETERMINED;
    })
    .onEnd(() => {
      currState.value = State.UNDETERMINED;
    });

onRunJS is causing the issue can fully replicate it

on reload of the ios simulator xcode crashes Screenshot 2022-11-15 at 1 33 54 PM

Steps to reproduce

run Gesture function that access to shareValue variables reload app crash

Snack or a link to a repository

https://snack.expo.dev/JHArrUvUm

Gesture Handler version

2.8.0

React Native version

0.70.5

Platforms

iOS

JavaScript runtime

Hermes

Workflow

React Native (without Expo)

Architecture

No response

Build type

Debug mode

Device

iOS simulator

Device model

No response

Acknowledgements

Yes

Issue Analytics

  • State:open
  • Created 10 months ago
  • Reactions:8
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
j-piaseckicommented, Dec 8, 2022

It’s possible that this problem was fixed on the side of Reanimated with the recent rewrite of shareable values. You can try using Reanimated 3.0.0-rc.8 to see if it resolves the problem.

0reactions
davidpettcommented, Dec 23, 2022

I found the issue is with the new Gesture api and using runOnJS. a workaround is to use the old gesture api:

const onTapGesture = useAnimatedGestureHandler(
  {
    onTouchesDown: () => {
      currState.value = State.BEGAN;
    },
    onTouchesUp: () => {
      if (onPress) {
        runOnJS(onPress)();
      }
    },
    onTouchesCancelled: () => {
      currState.value = State.UNDETERMINED;
    },
    onEnd: () => {
      currState.value = State.UNDETERMINED;
    },
  },
  [onPress] 
);
//...
<TapGestureHandler onGestureEvent={onTapGesture} testID={`${testID}-tap`} maxDistance={1}>
Read more comments on GitHub >

github_iconTop Results From Across the Web

App.reload crashes the app | Apple Developer Forums
"App.reload" crashes the app with this error: The operation couldn't be completed. (TVMLKitErrorDomain error 3.) Xcode logs this in its console:.
Read more >
App crash when reload button is pressed - ios - Stack Overflow
i'm having some problems with my weather app for iOS. I'm new in programming in xCode, ...
Read more >
Fixed iPhone Apps Keep Crashing After iOS 16.2 Update in ...
Stop your iPhone keeps restarting over and over using the below troubleshooting steps for all-time fix iPhone Apps Keep Crashing After iOS ......
Read more >
iOS App crashes immediately after debug start - Microsoft Q&A
-try hitting breakpoints, but it is not even hitting the first line of iOS Main.cs -switching of Hot Reload -reinstall Xcode on the...
Read more >
How to Fix Crashing Apps on an iPhone or Android?
10 Solutions to fix App Crashes and Keep Apps Running: For Apple iPhone, Samsung Galaxy, LG, Lenovo and Sony Xperia smartphones · Why...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found