From 3addec09c581d6fbbe3599cd27f6c55ee8891c7d Mon Sep 17 00:00:00 2001 From: noumantahir Date: Tue, 7 Dec 2021 23:31:17 +0500 Subject: [PATCH] added reblog setting support --- .../editor/children/editorSettingsModal.tsx | 25 ++++++++++++++----- src/screens/editor/screen/editorScreen.tsx | 2 ++ 2 files changed, 21 insertions(+), 6 deletions(-) diff --git a/src/screens/editor/children/editorSettingsModal.tsx b/src/screens/editor/children/editorSettingsModal.tsx index 6d41360cb..6ae9391ac 100644 --- a/src/screens/editor/children/editorSettingsModal.tsx +++ b/src/screens/editor/children/editorSettingsModal.tsx @@ -1,8 +1,8 @@ import React, { forwardRef, useEffect, useImperativeHandle, useState } from 'react'; import { useIntl } from 'react-intl'; -import { ScrollView, View } from 'react-native'; +import { View } from 'react-native'; -import { BeneficiaryModal, DateTimePicker, Modal, SettingsItem } from '../../../components'; +import { DateTimePicker, Modal, SettingsItem } from '../../../components'; import styles from './editorSettingsModalStyles'; import ThumbSelectionContent from './thumbSelectionContent'; import {View as AnimatedView} from 'react-native-animatable'; @@ -35,19 +35,23 @@ export interface EditorSettingsModalRef { interface EditorSettingsModalProps { body:string; draftId:string; + isCommunityPost:boolean; handleRewardChange:(rewardType:string)=>void; handleThumbSelection:(index:number)=>void; handleScheduleChange:(datetime:string|null)=>void; handleBeneficiariesChange:(beneficiaries:Beneficiary[])=>void; + handleShouldReblogChange:(shouldReblog:boolean)=>void; } const EditorSettingsModal = forwardRef(({ body, draftId, + isCommunityPost, handleRewardChange, handleThumbSelection, handleScheduleChange, handleBeneficiariesChange, + handleShouldReblogChange, }: EditorSettingsModalProps, ref) => { const intl = useIntl(); @@ -55,6 +59,7 @@ const EditorSettingsModal = forwardRef(({ const [rewardTypeIndex, setRewardTypeIndex] = useState(0); const [thumbIndex, setThumbIndex] = useState(0); const [scheduleLater, setScheduleLater] = useState(false) + const [shouldReblog, setShouldReblog] = useState(false); const [scheduledFor, setScheduledFor] = useState(''); useEffect(() => { @@ -71,6 +76,10 @@ const EditorSettingsModal = forwardRef(({ handleScheduleChange(scheduledFor) } }, [scheduleLater, scheduledFor]) + + useEffect(() => { + handleShouldReblogChange(shouldReblog) + }, [shouldReblog]) useImperativeHandle(ref, () => ({ @@ -134,15 +143,19 @@ const EditorSettingsModal = forwardRef(({ handleOnChange={_handleRewardChange} /> - {/* */} + isOn={shouldReblog} + handleOnChange={setShouldReblog} + /> + )} + (this.editorSettingsModalRef = componentRef)} body={fields.body} draftId={draftId} + isCommunityPost={false} handleThumbSelection={this._handleOnThumbSelection} handleRewardChange={handleRewardChange} handleScheduleChange={this._handleScheduleChange} handleBeneficiariesChange={handleBeneficiaries} + handleShouldReblogChange={()=>{}} /> );