expo / react-native-action-sheet

A cross-platform ActionSheet for React Native
MIT License
1.37k stars 224 forks source link

Can't apply dark theme for action sheet in iOS #325

Open Alexeichua opened 3 months ago

Alexeichua commented 3 months ago

userInterfaceStyle: "dark" doesn't work for iOS.

Styling code is as this:

const ShowActionSheetButton = ({ imageUrl, withTitle = false, withMessage = false, withIcons = false, withSeparators = false, withCancelButtonTintColor = false, useModal = false, onClose, }) => { const anchorRef = useRef(null); const { showActionSheetWithOptions } = useActionSheet();

const showActionSheet = () => { const options = ["Save", "Share", "Cancel"]; const icons = withIcons ? [icon("save"), icon("share"), icon("cancel")] : undefined; const titleOption = withTitle ? "Choose An Action" : undefined; const messageOption = withMessage ? "This library tries to mimic the native share sheets as close as possible." : undefined; const containerStyle = {backgroundColor: "black"}; const tintColor = "white"; showActionSheetWithOptions( { options, icons, title: titleOption, message: messageOption, userInterfaceStyle: "dark", //Here is setting the interface, but it doesn't work containerStyle, tintColor, cancelButtonIndex: 2, showSeparators: withSeparators, cancelButtonTintColor: withCancelButtonTintColor ? "#D93F0B" : undefined, useModal, }, ); };

useEffect(() => { if (imageUrl) { showActionSheet(); } }, [imageUrl]); };