import React, {Component} from 'react'; import {StyleSheet, ScrollView, LayoutAnimation} from 'react-native'; import {Assets, Colors, Typography, View, Drawer, Text, Button, Avatar, Badge, DrawerProps} from 'react-native-ui-lib'; import conversations from '../../data/conversations'; import {renderBooleanOption, renderSliderOption, renderColorOption} from '../ExampleScreenPresenter'; const ITEMS = { read: { icon: require('../../assets/icons/mail.png'), text: 'Read', background: Colors.green30, testID: 'left_item_read' }, archive: { icon: require('../../assets/icons/archive.png'), text: 'Archive', background: Colors.blue30, testID: 'right_item_archive' }, delete: { icon: require('../../assets/icons/delete.png'), text: 'Delete', background: Colors.red30, testID: 'right_item_delete' } }; class DrawerScreen extends Component { state = { hideItem: false, showRightItems: true, fullSwipeRight: true, showLeftItem: true, fullSwipeLeft: true, unread: true, itemsTintColor: undefined, bounciness: undefined, itemsIconSize: undefined }; ref: React.Ref = null; componentDidUpdate(_prevProps: any, prevState: typeof this.state) { if (this.state.hideItem && prevState.hideItem) { this.showItem(); } } deleteItem = () => { // TODO: consider including this functionality as part of the drawer component setTimeout(() => { LayoutAnimation.configureNext({ update: { type: LayoutAnimation.Types.easeInEaseOut, property: LayoutAnimation.Properties.scaleY }, delete: { type: LayoutAnimation.Types.easeInEaseOut, property: LayoutAnimation.Properties.scaleY, duration: 2000 }, duration: 120 }); this.setState({hideItem: true}); }, 200); }; toggleReadState = () => { this.setState({unread: !this.state.unread}); }; showItem = () => { this.setState({hideItem: false}); }; openLeftDrawer = () => { if (this.ref) { // @ts-expect-error this.ref.openLeft(); } }; openLeftDrawerFull = () => { if (this.ref) { // @ts-expect-error this.ref.openLeftFull(); } }; toggleLeftDrawer = () => { if (this.ref) { // @ts-expect-error this.ref.toggleLeft(); } }; openRightDrawer = () => { if (this.ref) { // @ts-expect-error this.ref.openRight(); } }; openRightDrawerFull = () => { if (this.ref) { // @ts-expect-error this.ref.openRightFull(); } }; closeDrawer = () => { if (this.ref) { // @ts-expect-error this.ref.closeDrawer(); } }; renderActions() { return ( Actions