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

multiple action sheets opens

Open arham-anees opened this issue 2 years ago • 2 comments

I am showing Flatlist and tapping on each item shows detail on action sheet, the problem is that when I tap on Flatlist item, 2 or 3 action sheets open on android, it is working fine with iOS. here is my code for item

  return (
        <TouchableOpacity key={item.id} style={styles.container} onPress={()=>{SheetManager.show(SheetNames.Transaction,{item:item})}}>
           ...
        </TouchableOpacity>

debugging same in android studio. I get some logcat when opening the sheet. I am not a full time mobile developer that is why I may not get the error correctly but I can bring it to sight of mature android and react native developers

com.leewsafe E/unknown:ReactModalHost: Creating new dialog from context: com.leewsafe.MainActivity@9f6e4cf@167175375
2022-06-15 10:20:26.330 7499-7499/com.leewsafe E/unknown:ReactModalHost: Updating existing dialog with context: com.leewsafe.MainActivity@9f6e4cf@167175375

arham-anees avatar Jun 15 '22 05:06 arham-anees

Move the sheet out of your FlatList items and render it at one place in the App. Then open it so it will open one sheet at a time. You are facing problem because you have added the sheet to every component but you are using same id to open it with SheetManager. You can also make the Sheet id unique based on component. For example "my_sheet_" + item.id etc and then open it with same id using SheetManager.

ammarahm-ed avatar Jun 15 '22 18:06 ammarahm-ed

my folder structure is something like

src
|--app
    |--action-sheets
    |    |--transaction.sheet.jsx
    |    |--action-sheets.jsx.   -- imported all action sheets
    |--home
    |    |-- home.jsx
    |    |--transaction-item.jsx -- item of Flatlist 

looking at your comment, I have already placed action sheets at one place outside Flatlist. and also, it work fine with iOS, the problem is only on android platform

arham-anees avatar Jun 16 '22 03:06 arham-anees

Fixed in v0.8.0

ammarahm-ed avatar Aug 21 '22 06:08 ammarahm-ed

I have the issue on Android. Works just fine on iOS. "react-native-actions-sheet": "^0.8.3"

mehdinourollah avatar Feb 20 '23 15:02 mehdinourollah