Merge pull request #2127 from ecency/nt/post-options-scroll

Nt/post options scroll
This commit is contained in:
Feruz M 2022-01-06 17:06:25 +02:00 committed by GitHub
commit c339ac6eb4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 17 additions and 15 deletions

View File

@ -3,7 +3,7 @@ import { useIntl } from 'react-intl';
import { View } from 'react-native'; import { View } from 'react-native';
import { DateTimePicker, MainButton, Modal, SettingsItem } from '../../../components'; import { DateTimePicker, MainButton, Modal, SettingsItem } from '../../../components';
import styles from './editorSettingsModalStyles'; import styles from './postOptionsModalStyles';
import ThumbSelectionContent from './thumbSelectionContent'; import ThumbSelectionContent from './thumbSelectionContent';
import {View as AnimatedView} from 'react-native-animatable'; import {View as AnimatedView} from 'react-native-animatable';
import { KeyboardAwareScrollView } from 'react-native-keyboard-aware-scroll-view'; import { KeyboardAwareScrollView } from 'react-native-keyboard-aware-scroll-view';
@ -27,12 +27,12 @@ const REWARD_TYPES = [
export interface EditorSettingsModalRef { export interface PostOptionsModalRef {
showModal:()=>void; showModal:()=>void;
} }
interface EditorSettingsModalProps { interface PostOptionsModalProps {
body:string; body:string;
draftId:string; draftId:string;
thumbIndex:number, thumbIndex:number,
@ -44,7 +44,7 @@ interface EditorSettingsModalProps {
handleShouldReblogChange:(shouldReblog:boolean)=>void; handleShouldReblogChange:(shouldReblog:boolean)=>void;
} }
const EditorSettingsModal = forwardRef(({ const PostOptionsModal = forwardRef(({
body, body,
draftId, draftId,
thumbIndex, thumbIndex,
@ -54,7 +54,7 @@ const EditorSettingsModal = forwardRef(({
handleThumbSelection, handleThumbSelection,
handleScheduleChange, handleScheduleChange,
handleShouldReblogChange, handleShouldReblogChange,
}: EditorSettingsModalProps, ref) => { }: PostOptionsModalProps, ref) => {
const intl = useIntl(); const intl = useIntl();
const [showModal, setShowModal] = useState(false); const [showModal, setShowModal] = useState(false);
@ -115,8 +115,8 @@ const EditorSettingsModal = forwardRef(({
} }
const _renderContent = ( const _renderContent = (
<View style={{flex:1}}> <View style={styles.fillSpace}>
<KeyboardAwareScrollView contentContainerStyle={{flex:1}} > <KeyboardAwareScrollView style={styles.fillSpace} >
<View style={styles.container}> <View style={styles.container}>
{!isEdit && ( {!isEdit && (
<> <>
@ -220,4 +220,4 @@ const EditorSettingsModal = forwardRef(({
); );
}); });
export default EditorSettingsModal export default PostOptionsModal

View File

@ -12,8 +12,10 @@ export default EStyleSheet.create({
paddingTop: 32, paddingTop: 32,
paddingBottom: 16, paddingBottom: 16,
}, },
fillSpace:{
flex:1
},
container: { container: {
flex: 1,
paddingVertical: 8, paddingVertical: 8,
paddingHorizontal: 32, paddingHorizontal: 32,
}, },

View File

@ -32,7 +32,7 @@ import { isCommunity } from '../../../utils/communityValidation';
import styles from './editorScreenStyles'; import styles from './editorScreenStyles';
import ThumbSelectionModal from '../children/thumbSelectionModal'; import ThumbSelectionModal from '../children/thumbSelectionModal';
import EditorSettingsModal from '../children/editorSettingsModal'; import PostOptionsModal from '../children/postOptionsModal';
class EditorScreen extends Component { class EditorScreen extends Component {
/* Props /* Props
@ -40,7 +40,7 @@ class EditorScreen extends Component {
* @prop { type } name - Description.... * @prop { type } name - Description....
*/ */
thumbSelectionModalRef = null; thumbSelectionModalRef = null;
editorSettingsModalRef = null; postOptionsModalRef = null;
constructor(props) { constructor(props) {
super(props); super(props);
@ -201,8 +201,8 @@ class EditorScreen extends Component {
} }
_handleSettingsPress = () => { _handleSettingsPress = () => {
if(this.editorSettingsModalRef){ if(this.postOptionsModalRef){
this.editorSettingsModalRef.show(); this.postOptionsModalRef.show();
} }
} }
@ -458,8 +458,8 @@ class EditorScreen extends Component {
thumbIndex={thumbIndex} thumbIndex={thumbIndex}
onThumbSelection={this._handleOnThumbSelection} onThumbSelection={this._handleOnThumbSelection}
/> />
<EditorSettingsModal <PostOptionsModal
ref={(componentRef) => (this.editorSettingsModalRef = componentRef)} ref={(componentRef) => (this.postOptionsModalRef = componentRef)}
body={fields.body} body={fields.body}
draftId={draftId} draftId={draftId}
thumbIndex={thumbIndex} thumbIndex={thumbIndex}