Merge pull request #2112 from ecency/nt/editor-replace

NT - Editor Replace
This commit is contained in:
Feruz M 2022-01-03 19:59:30 +02:00 committed by GitHub
commit a4682a4044
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 16 additions and 11 deletions

View File

@ -28,6 +28,8 @@ const DraftsContainer = ({ currentAccount, intl, navigation, dispatch }) => {
const [schedules, setSchedules] = useState([]); const [schedules, setSchedules] = useState([]);
const [isLoading, setIsLoading] = useState(false); const [isLoading, setIsLoading] = useState(false);
const [initialTabIndex] = useState(navigation.state?.params?.showSchedules ? 1 : 0);
useEffect(() => { useEffect(() => {
_getDrafts(); _getDrafts();
_getSchedules(); _getSchedules();
@ -145,6 +147,7 @@ const DraftsContainer = ({ currentAccount, intl, navigation, dispatch }) => {
removeDraft={_removeDraft} removeDraft={_removeDraft}
moveScheduleToDraft={_moveScheduleToDraft} moveScheduleToDraft={_moveScheduleToDraft}
removeSchedule={_removeSchedule} removeSchedule={_removeSchedule}
initialTabIndex={initialTabIndex}
/> />
); );
}; };

View File

@ -15,7 +15,6 @@ import { BasicHeader, TabBar, DraftListItem, PostCardPlaceHolder } from '../../.
import globalStyles from '../../../globalStyles'; import globalStyles from '../../../globalStyles';
import styles from './draftStyles'; import styles from './draftStyles';
import { OptionsModal } from '../../../components/atoms'; import { OptionsModal } from '../../../components/atoms';
import { jsonStringify } from '../../../utils/jsonUtils';
const DraftsScreen = ({ const DraftsScreen = ({
currentAccount, currentAccount,
@ -27,6 +26,7 @@ const DraftsScreen = ({
drafts, drafts,
schedules, schedules,
moveScheduleToDraft, moveScheduleToDraft,
initialTabIndex,
}) => { }) => {
const [selectedId, setSelectedId] = useState(null); const [selectedId, setSelectedId] = useState(null);
const ActionSheetRef = useRef(null); const ActionSheetRef = useRef(null);
@ -123,6 +123,7 @@ const DraftsScreen = ({
<ScrollableTabView <ScrollableTabView
style={[globalStyles.tabView, { paddingBottom: 40 }]} style={[globalStyles.tabView, { paddingBottom: 40 }]}
initialPage={initialTabIndex}
renderTabBar={() => ( renderTabBar={() => (
<TabBar <TabBar
style={styles.tabbar} style={styles.tabbar}

View File

@ -717,13 +717,14 @@ class EditorContainer extends Component {
this.setState({ this.setState({
isPostSending: false, isPostSending: false,
}); });
navigation.navigate({ navigation.replace(
routeName: ROUTES.SCREENS.PROFILE, ROUTES.SCREENS.PROFILE,
params: { {
username: get(currentAccount, 'name'), username: get(currentAccount, 'name'),
}, },{
key: get(currentAccount, 'name'), key:get(currentAccount, 'name')
}); }
);
}, 3000); }, 3000);
}) })
.catch((error) => { .catch((error) => {
@ -1058,10 +1059,10 @@ class EditorContainer extends Component {
); );
setTimeout(() => { setTimeout(() => {
navigation.navigate({ navigation.replace(ROUTES.SCREENS.DRAFTS,
routeName: ROUTES.SCREENS.DRAFTS, {
key: currentAccount.name, showSchedules:true
}); })
}, 3000); }, 3000);
}) })
.catch((error) => { .catch((error) => {