added action menu

This commit is contained in:
u-e 2018-12-01 14:51:38 +03:00
parent fa8875e3e7
commit 0616c797e4
2 changed files with 16 additions and 4 deletions

View File

@ -1,6 +1,6 @@
import React, { Component } from 'react';
import {
View, KeyboardAvoidingView, ScrollView, FlatList, Text,
View, KeyboardAvoidingView, ScrollView, FlatList, Text, ActionSheetIOS
} from 'react-native';
import Markdown, { getUniqueID } from 'react-native-markdown-renderer';
// Components
@ -121,9 +121,21 @@ export default class MarkdownEditorView extends Component {
</View>
);
_renderEditorButtons = ({ getState, setState }) => {
_handleOnImageButtonPress = () => {
const { handleOpenImagePicker } = this.props;
ActionSheetIOS.showActionSheetWithOptions(
{
options: ['Cancel', 'Take Photo', 'Select From Gallery'],
cancelButtonIndex: 0,
},
(buttonIndex) => {
handleOpenImagePicker(buttonIndex === 1 ? 'camera' : buttonIndex === 2 && 'image');
},
);
}
_renderEditorButtons = ({ getState, setState }) => {
return (
<StickyBar>
<View style={styles.leftButtonsWrapper}>
@ -145,7 +157,7 @@ export default class MarkdownEditorView extends Component {
onPress={() => Formats[9].onPress({ getState, setState })}
/>
<IconButton
onPress={() => handleOpenImagePicker()}
onPress={() => this._handleOnImageButtonPress()}
style={styles.rightIcons}
size={20}
iconStyle={styles.icon}

View File

@ -239,7 +239,7 @@ class EditorContainer extends Component {
autoFocusText={autoFocusText}
draftPost={draftPost}
handleFormChanged={this._handleFormChanged}
handleOnImagePicker={this._handleOpenImagePicker}
handleOnImagePicker={this._handleRoutingAction}
handleOnSaveButtonPress={this._handleOnSaveButtonPress}
handleOnSubmit={this._handleSubmit}
isCameraOrPickerOpen={isCameraOrPickerOpen}