Expo Snack crashes when running my code in Android, but not in Web or iOS

Hi, all,
I am just starting out learning how to code in React Native, and I am planning to create a joystick for one of my future project. Can you help me out on identifying why my code crashes? Here’s what I am working on:

import React, { useRef, useState } from 'react';
import { View, Text, StyleSheet, Animated, PanResponder } from 'react-native';

const MyComponent = () => {
  const [myBorderColor, setBorderColor] = useState('white');
  const [myBorderWidth, setBorderWidth] = useState(10);

  const pan = useRef(new Animated.ValueXY()).current;

  const panResponder = useRef(
      onStartShouldSetPanResponder: () => true,
      onPanResponderGrant: () => {
      onPanResponderMove: Animated.event([null, { dx: pan.x, dy: pan.y }]),
      onPanResponderRelease: () => {
        Animated.spring(pan, { toValue: { x: 0, y: 0 } }).start();

  return (
    <View style={MyStyle.mainView}>
      <View style={MyStyle.steerArea}>
              height: 100,
              width: 100,
              backgroundColor: 'gray',
              borderWidth: myBorderWidth,
              borderColor: myBorderColor,
              borderRadius: 50,
              top: pan.y,
              left: pan.x,

export default MyComponent;

const MyStyle = StyleSheet.create({
  mainView: {
    flex: 1,
    borderWidth: 10,
    borderRadius: 10,
    justifyContent: 'center',
    backgroundColor: 'lightblue',
  steerArea: {
    height: 200,
    width: 200,
    backgroundColor: 'lightgray',
    borderRadius: 100,
    justifyContent: 'center',
    alignItems: 'center',
    left: 50,

It was working just fine until I added the part

const [myBorderWidth, setBorderWidth] = useState(10);

I apologize ahead of time if I happen to post my question on the wrong sub. And please pardon any novice mistake I committed. I’d appreciate if you can point them out so avoid them in the future.

I don’t see anything wrong there.

Do you get any error message?

Does it start working again if you remove the border width stuff?

No error at all. It tries to load then just closes on itself. Works just fine if I remove the 2nd useState from my code.

Edit: tested it again and it’s now giving me an error code

Hey @kaiserv

Did you manage to get to the bottom of this issue?

If I copy your code into a snack it works for me.

Hi! Thanks for checking this out. I just moved on and re-created my code. But based on your input, it might be an issue with my computer not having enough resources to run the code as I’m only using a very low-end PC for this project. But thanks anyway and more power to you.