migrated editor screen

This commit is contained in:
Nouman Tahir 2022-08-07 17:11:13 +05:00
parent 60086c3b3a
commit 67c5b0867f
4 changed files with 15 additions and 15 deletions

View File

@ -34,7 +34,7 @@ const BottomTabBarView = ({
const _jumpTo = (route, isFocused) => {
if(route.name === ROUTES.TABBAR.POST_BUTTON){
navigation.navigate(ROUTES.SCREENS.POST, {key: 'editor_post'})
navigation.navigate(ROUTES.SCREENS.EDITOR, {key: 'editor_post'})
return;
}

View File

@ -55,7 +55,7 @@ export const StackNavigator = () => {
gestureResponseDistance: { horizontal: 70 },
}}
/>
{/* <Stack.Screen name={ROUTES.SCREENS.EDITOR} component={Editor} /> */}
<Stack.Screen name={ROUTES.SCREENS.EDITOR} component={Editor} />
<Stack.Screen name={ROUTES.SCREENS.VOTERS} component={Voters} />
<Stack.Screen name={ROUTES.SCREENS.FOLLOWS} component={Follows} />
<Stack.Screen name={ROUTES.SCREENS.SETTINGS} component={Settings} />

View File

@ -112,7 +112,7 @@ const DraftsContainer = ({ currentAccount, intl, navigation, dispatch, route })
const selectedDraft = drafts.find((draft) => draft._id === id);
navigation.navigate({
routeName: ROUTES.SCREENS.EDITOR,
name: ROUTES.SCREENS.EDITOR,
key: `editor_draft_${id}`,
params: {
draft: selectedDraft,

View File

@ -8,7 +8,7 @@ import AsyncStorage from '@react-native-community/async-storage';
// Services and Actions
import { Buffer } from 'buffer';
import ReceiveSharingIntent from 'react-native-receive-sharing-intent';
import {
uploadImage,
addDraft,
@ -88,7 +88,7 @@ class EditorContainer extends Component<any, any> {
// Component Life Cycle Functions
componentDidMount() {
this._isMounted = true;
const { currentAccount, navigation, dispatch } = this.props;
const { currentAccount, route } = this.props;
const username = currentAccount && currentAccount.name ? currentAccount.name : '';
let isReply;
let draftId;
@ -97,8 +97,8 @@ class EditorContainer extends Component<any, any> {
let _draft;
let hasSharedIntent = false;
if (navigation.state && navigation.state.params) {
const navigationParams = navigation.state.params;
if (route.params) {
const navigationParams = route.params;
hasSharedIntent = navigationParams.hasSharedIntent;
if (navigationParams.draft) {
@ -1023,14 +1023,14 @@ class EditorContainer extends Component<any, any> {
};
_handleSubmitSuccess = () => {
const { navigation } = this.props;
const { navigation, route } = this.props;
this.stateTimer = setTimeout(() => {
if (navigation) {
navigation.goBack();
}
if (navigation && navigation.state && navigation.state.params && navigation.state.params.fetchPost) {
navigation.state.params.fetchPost();
if (route.params?.fetchPost) {
route.params.fetchPost();
}
this.setState({
isPostSending: false,
@ -1040,11 +1040,11 @@ class EditorContainer extends Component<any, any> {
};
_navigationBackFetchDrafts = () => {
const { navigation } = this.props;
const { route } = this.props;
const { isDraft } = this.state;
if (isDraft && navigation.state.params) {
navigation.state.params.fetchPost();
if (isDraft && route.params?.fetchPost) {
route.params.fetchPost
}
};
@ -1249,7 +1249,7 @@ class EditorContainer extends Component<any, any> {
}
render() {
const { isLoggedIn, isDarkTheme, navigation, currentAccount } = this.props;
const { isLoggedIn, isDarkTheme, currentAccount, route } = this.props;
const {
autoFocusText,
draftPost,
@ -1273,7 +1273,7 @@ class EditorContainer extends Component<any, any> {
scheduledForDate,
} = this.state;
const tags = navigation.state.params && navigation.state.params.tags;
const tags = route.params?.tags;
return (
<EditorScreen
autoFocusText={autoFocusText}