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

Doesn't work with react-native version 0.72.6 with fabric enabled on Android physical device #318

Open
fractalscape13 opened this issue Jan 19, 2024 · 1 comment

Comments

@fractalscape13
Copy link

fractalscape13 commented Jan 19, 2024

ISSUE: On react-native version 0.72.6 with fabric enabled, action sheet on Android physical device doesn't open reliably and the onPress events are never triggered. The package works with the latest version of RN (currently 0.73.2) but does not work with RN version 0.72.6.

SETUP:
npx [email protected] init TestProject --version 0.72.6

Enable new architecture (for android, in gradle.properties set newArchEnabled=true)

In package.json, your versions should look like:
"react-native": "0.72.6"
"@expo/react-native-action-sheet": "^4.0.1",

Sample code for App.tsx:

import React from 'react';
import {SafeAreaView, Text, TouchableOpacity} from 'react-native';
import {
  ActionSheetProvider,
  useActionSheet,
} from '@expo/react-native-action-sheet';

const ActionSheetComponent = () => {
  const {showActionSheetWithOptions} = useActionSheet();
  const onPress = () => {
    const options = ['Delete', 'Save', 'Cancel'];
    const destructiveButtonIndex = 0;
    const cancelButtonIndex = 2;
    showActionSheetWithOptions(
      {
        options,
        cancelButtonIndex,
        destructiveButtonIndex,
      },
      selectedIndex => {
        switch (selectedIndex) {
          case 1:
            console.log('Save--->>>>>>');
            break;
          case destructiveButtonIndex:
            console.log('Delete--->>>>>>');
            break;
          case cancelButtonIndex:
            console.log('Cancel--->>>>>>');
        }
      },
    );
  };
  return (
    <TouchableOpacity
      onPress={onPress}
      style={{
        borderWidth: 5,
        borderColor: 'darkred',
        borderRadius: 14,
        padding: 10,
      }}>
      <Text>Open Action Sheet</Text>
    </TouchableOpacity>
  );
};

function App(): React.JSX.Element {
  return (
    <ActionSheetProvider>
        <SafeAreaView
          style={{
            flex: 1,
            backgroundColor: 'lightblue',
            justifyContent: 'center',
            alignItems: 'center',
          }}>
          <ActionSheetComponent />
        </SafeAreaView>
    </ActionSheetProvider>
  );
}

export default App;
@fractalscape13 fractalscape13 changed the title Doesn't work with react-native version 0.72.6 with fabric enabled Doesn't work with react-native version 0.72.6 with fabric enabled on Android physical device Jan 19, 2024
@cozmoc
Copy link

cozmoc commented Nov 18, 2024

@fractalscape13 make sure to set useModal: false

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants