Skip to content

Pressable doesn't work on android but works on ios and web #3945

@Mancitiss

Description

@Mancitiss

Description

Pressable doesn't work on android (works in ios and web). see snack below
https://snack.expo.dev/@mancitiss/react-native-gesture-handler-pressable-not-working-on-android?platform=android

Steps to reproduce

  1. npx create-expo --example blank
  2. cd blank
  3. npm install
  4. edit blank/app/(tabs)/index.tsx, replace everything with just this
import { Text } from 'react-native';
import React from 'react';
import { GestureHandlerRootView, Pressable } from 'react-native-gesture-handler';

export default function HomeScreen() {
  const [count, setCount] = React.useState(0);
  return (
      <GestureHandlerRootView style={{ flex: 1 }}>
        <Pressable onPress={() => setCount((c) => c + 1)} style={{ flex: 1, alignItems: 'center', justifyContent: 'center' }}>
          <Text>{count}</Text>
        </Pressable>
      </GestureHandlerRootView>
  );
}
  1. npm run start
  2. open expo go on android phone and connect to the app
  3. tap the screen.

expected behavior: the number goes up
ios, web: the number goes up
android: the number doesn't go up

  1. test with react-native Pressable:
import { Text } from 'react-native';
import React from 'react';
import { Pressable } from 'react-native';

export default function HomeScreen() {
  const [count, setCount] = React.useState(0);
  return (
        <Pressable onPress={() => setCount((c) => c + 1)} style={{ flex: 1, alignItems: 'center', justifyContent: 'center' }}>
          <Text>{count}</Text>
        </Pressable>
  );
}

all platforms work.

A link to a Gist, an Expo Snack or a link to a repository based on this template that reproduces the bug.

https://snack.expo.dev/@mancitiss/react-native-gesture-handler-pressable-not-working-on-android?platform=android

Gesture Handler version

~2.28.0

React Native version

0.79.0 + 0.81.5

Platforms

Android

JavaScript runtime

None

Workflow

Using Expo Go

Architecture

None

Build type

None

Device

Real device

Device model

Galaxy A13 (Android 12)

Acknowledgements

Yes

Metadata

Metadata

Assignees

Labels

Platform: AndroidThis issue is specific to AndroidRepro providedA reproduction with a snack or repo is provided

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions