mirror of
https://github.com/ecency/ecency-mobile.git
synced 2024-11-25 21:53:04 +03:00
added action sheet for android supoort
This commit is contained in:
parent
8f01c62a69
commit
654683056b
@ -36,6 +36,7 @@
|
||||
"react": "^16.6.0-alpha.8af6728",
|
||||
"react-intl": "^2.7.2",
|
||||
"react-native": "^0.57.5",
|
||||
"react-native-actionsheet": "^2.4.2",
|
||||
"react-native-config": "^0.11.5",
|
||||
"react-native-extended-stylesheet": "^0.10.0",
|
||||
"react-native-fast-image": "^4.0.14",
|
||||
|
@ -1,8 +1,9 @@
|
||||
import React, { Component } from 'react';
|
||||
import {
|
||||
View, KeyboardAvoidingView, ScrollView, FlatList, Text, ActionSheetIOS
|
||||
View, KeyboardAvoidingView, ScrollView, FlatList, Text,
|
||||
} from 'react-native';
|
||||
import Markdown, { getUniqueID } from 'react-native-markdown-renderer';
|
||||
import ActionSheet from 'react-native-actionsheet';
|
||||
|
||||
// Components
|
||||
import { DropdownButton } from '../../dropdownButton';
|
||||
@ -123,63 +124,49 @@ export default class MarkdownEditorView extends Component {
|
||||
</View>
|
||||
);
|
||||
|
||||
_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}>
|
||||
<FlatList
|
||||
data={Formats}
|
||||
keyboardShouldPersistTaps="always"
|
||||
renderItem={({ item, index }) => index !== 9 && this._renderMarkupButton({ item, getState, setState })
|
||||
}
|
||||
horizontal
|
||||
/>
|
||||
</View>
|
||||
<View style={styles.rightButtonsWrapper}>
|
||||
<IconButton
|
||||
size={20}
|
||||
style={styles.rightIcons}
|
||||
iconStyle={styles.icon}
|
||||
iconType="FontAwesome"
|
||||
name="link"
|
||||
onPress={() => Formats[9].onPress({ getState, setState })}
|
||||
/>
|
||||
<IconButton
|
||||
onPress={() => this._handleOnImageButtonPress()}
|
||||
style={styles.rightIcons}
|
||||
size={20}
|
||||
iconStyle={styles.icon}
|
||||
iconType="FontAwesome"
|
||||
name="image"
|
||||
/>
|
||||
<DropdownButton
|
||||
style={styles.dropdownStyle}
|
||||
options={['option1', 'option2', 'option3', 'option4']}
|
||||
iconName="md-more"
|
||||
iconStyle={styles.dropdownIconStyle}
|
||||
isHasChildIcon
|
||||
/>
|
||||
</View>
|
||||
</StickyBar>
|
||||
);
|
||||
};
|
||||
_renderEditorButtons = ({ getState, setState }) => (
|
||||
<StickyBar>
|
||||
<View style={styles.leftButtonsWrapper}>
|
||||
<FlatList
|
||||
data={Formats}
|
||||
keyboardShouldPersistTaps="always"
|
||||
renderItem={({ item, index }) => index !== 9 && this._renderMarkupButton({ item, getState, setState })
|
||||
}
|
||||
horizontal
|
||||
/>
|
||||
</View>
|
||||
<View style={styles.rightButtonsWrapper}>
|
||||
<IconButton
|
||||
size={20}
|
||||
style={styles.rightIcons}
|
||||
iconStyle={styles.icon}
|
||||
iconType="FontAwesome"
|
||||
name="link"
|
||||
onPress={() => Formats[9].onPress({ getState, setState })}
|
||||
/>
|
||||
<IconButton
|
||||
onPress={() => this.ActionSheet.show()}
|
||||
style={styles.rightIcons}
|
||||
size={20}
|
||||
iconStyle={styles.icon}
|
||||
iconType="FontAwesome"
|
||||
name="image"
|
||||
/>
|
||||
<DropdownButton
|
||||
style={styles.dropdownStyle}
|
||||
options={['option1', 'option2', 'option3', 'option4']}
|
||||
iconName="md-more"
|
||||
iconStyle={styles.dropdownIconStyle}
|
||||
isHasChildIcon
|
||||
/>
|
||||
</View>
|
||||
</StickyBar>
|
||||
);
|
||||
|
||||
render() {
|
||||
const { intl, isPreviewActive, isReply } = this.props;
|
||||
const {
|
||||
intl, isPreviewActive, isReply, handleOpenImagePicker,
|
||||
} = this.props;
|
||||
const { text, selection } = this.state;
|
||||
|
||||
return (
|
||||
@ -210,6 +197,14 @@ export default class MarkdownEditorView extends Component {
|
||||
this.setState(state, callback);
|
||||
},
|
||||
})}
|
||||
<ActionSheet
|
||||
ref={o => (this.ActionSheet = o)}
|
||||
options={['Open Gallery', 'Take a photo', 'Cancel']}
|
||||
cancelButtonIndex={2}
|
||||
onPress={(index) => {
|
||||
handleOpenImagePicker(index === 0 ? 'image' : index === 1 && 'camera');
|
||||
}}
|
||||
/>
|
||||
</KeyboardAvoidingView>
|
||||
);
|
||||
}
|
||||
|
@ -6406,6 +6406,11 @@ react-lifecycles-compat@^3, react-lifecycles-compat@^3.0.0, react-lifecycles-com
|
||||
resolved "https://registry.yarnpkg.com/react-lifecycles-compat/-/react-lifecycles-compat-3.0.4.tgz#4f1a273afdfc8f3488a8c516bfda78f872352362"
|
||||
integrity sha512-fBASbA6LnOU9dOU2eW7aQ8xmYBSXUIWr+UmF9b1efZBazGNO+rcXT/icdKnYm2pTwcRylVUYwW7H1PHfLekVzA==
|
||||
|
||||
react-native-actionsheet@^2.4.2:
|
||||
version "2.4.2"
|
||||
resolved "https://registry.yarnpkg.com/react-native-actionsheet/-/react-native-actionsheet-2.4.2.tgz#6a00dd51a75ef2c8974312130e405af73191500f"
|
||||
integrity sha512-DBoWIvVwuWXuptF4t46pBqkFxaUxS+rsIdHiA05t0n4BdTIDV2R4s9bLEUVOGzb94D7VxIamsXZPA/3mmw+SXg==
|
||||
|
||||
react-native-animatable@^1.2.4:
|
||||
version "1.3.0"
|
||||
resolved "https://registry.yarnpkg.com/react-native-animatable/-/react-native-animatable-1.3.0.tgz#b5c3940fc758cfd9b2fe54613a457c4b6962b46e"
|
||||
|
Loading…
Reference in New Issue
Block a user