react-native-actions-sheet
react-native-actions-sheet copied to clipboard
multiple action sheets opens
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
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.
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
Fixed in v0.8.0
I have the issue on Android. Works just fine on iOS.
"react-native-actions-sheet": "^0.8.3"