react-native-actions-sheet icon indicating copy to clipboard operation
react-native-actions-sheet copied to clipboard

Action sheet opens only once on android if "animated" set to false

Open AlexTaran opened this issue 3 years ago • 0 comments

Steps to reproduce:

  1. Init an empty react-native app
  2. npm install react-native-actions-sheet
  3. Put the following code to App.tsx :
import React from 'react';
import {SafeAreaView, Text, TouchableOpacity, View} from 'react-native';

import ActionSheet, {SheetManager} from 'react-native-actions-sheet';

const App = () => {
  return (
    <SafeAreaView>
      <TouchableOpacity
        onPress={() => {
          SheetManager.show('action-sheet');
        }}>
        <Text>Open action sheet</Text>
      </TouchableOpacity>

      <ActionSheet id={'action-sheet'} animated={false}>
        <View>
          <Text style={{color: 'black', margin: 20}}>Action sheet</Text>
        </View>
      </ActionSheet>
    </SafeAreaView>
  );
};

export default App;
  1. Press on text to open action sheet, then press anywhere to close it. Then press on the text again - Nothing shown, but the screen became just darker. Press on the screen again and the darkness disappears. Then you can infinitely try to open ActionSheet - no success. It's shown again only on app restart (strictly speaking, it works again when component is recreated, e.g. you can put it inside a Screen in react-navigation and when the screen is removed and then created again - ActionSheet starts working, but anyway just once).

If we remove animated={false} - everything works. OS Version: Android 12 Device: Samsung Galaxy S20 FE

AlexTaran avatar May 09 '22 12:05 AlexTaran