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

View File

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

View File

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