using optionsModel in draftsScreen

This commit is contained in:
noumantahir 2021-10-03 02:36:32 +05:00
parent 9b7cc73453
commit 4e50ba7225

View File

@ -1,8 +1,7 @@
import React, { useState, useRef, useEffect } from 'react'; import React, { useState, useRef } from 'react';
import { injectIntl } from 'react-intl'; import { injectIntl } from 'react-intl';
import { View, FlatList, Text } from 'react-native'; import { View, FlatList, Text } from 'react-native';
import ScrollableTabView from 'react-native-scrollable-tab-view'; import ScrollableTabView from 'react-native-scrollable-tab-view';
import ActionSheet from 'react-native-actionsheet';
// Utils // Utils
import { postBodySummary } from '@ecency/render-helper'; import { postBodySummary } from '@ecency/render-helper';
@ -15,6 +14,7 @@ import { BasicHeader, TabBar, DraftListItem, PostCardPlaceHolder } from '../../.
// Styles // Styles
import globalStyles from '../../../globalStyles'; import globalStyles from '../../../globalStyles';
import styles from './draftStyles'; import styles from './draftStyles';
import { OptionsModal } from '../../../components/atoms';
const DraftsScreen = ({ const DraftsScreen = ({
currentAccount, currentAccount,
@ -29,16 +29,10 @@ const DraftsScreen = ({
}) => { }) => {
const [selectedId, setSelectedId] = useState(null); const [selectedId, setSelectedId] = useState(null);
const ActionSheetRef = useRef(null); const ActionSheetRef = useRef(null);
const firstMount = useRef(true);
const selectedIdRef = useRef();
useEffect(() => {
selectedIdRef.current = selectedId;
}, [selectedId]);
const _onActionPress = (index) => { const _onActionPress = (index) => {
if (index === 0) { if (index === 0) {
moveScheduleToDraft(selectedIdRef.current); moveScheduleToDraft(selectedId);
} }
}; };
@ -148,7 +142,7 @@ const DraftsScreen = ({
{_getTabItem(schedules, 'schedules')} {_getTabItem(schedules, 'schedules')}
</View> </View>
</ScrollableTabView> </ScrollableTabView>
<ActionSheet <OptionsModal
ref={ActionSheetRef} ref={ActionSheetRef}
title={intl.formatMessage({ title={intl.formatMessage({
id: 'alert.move_question', id: 'alert.move_question',