mirror of
https://github.com/laurent22/joplin.git
synced 2024-11-24 08:12:24 +02:00
Fixed Clipboard and remove image-picker package
This commit is contained in:
parent
1077ad8f16
commit
040261abfa
@ -2,7 +2,7 @@ import FileViewer from 'react-native-file-viewer';
|
||||
import AsyncActionQueue from '../../AsyncActionQueue';
|
||||
|
||||
const React = require('react');
|
||||
const { Platform, Clipboard, Keyboard, View, TextInput, StyleSheet, Linking, Image, Share } = require('react-native');
|
||||
const { Platform, Keyboard, View, TextInput, StyleSheet, Linking, Image, Share } = require('react-native');
|
||||
const { connect } = require('react-redux');
|
||||
const uuid = require('lib/uuid').default;
|
||||
const { MarkdownEditor } = require('../../../MarkdownEditor/index.js');
|
||||
@ -13,6 +13,7 @@ const BaseItem = require('lib/models/BaseItem.js');
|
||||
const Setting = require('lib/models/Setting').default;
|
||||
const Resource = require('lib/models/Resource.js');
|
||||
const Folder = require('lib/models/Folder.js');
|
||||
const Clipboard = require('@react-native-community/clipboard').default;
|
||||
const md5 = require('md5');
|
||||
const { BackButtonService } = require('lib/services/back-button.js');
|
||||
const NavService = require('lib/services/NavService.js');
|
||||
@ -36,7 +37,7 @@ const { NoteBodyViewer } = require('lib/components/note-body-viewer.js');
|
||||
const { DocumentPicker, DocumentPickerUtil } = require('react-native-document-picker');
|
||||
const ImageResizer = require('react-native-image-resizer').default;
|
||||
const shared = require('lib/components/shared/note-screen-shared.js');
|
||||
const ImagePicker = require('react-native-image-picker');
|
||||
// const ImagePicker = require('react-native-image-picker');
|
||||
const SelectDateTimeDialog = require('lib/components/SelectDateTimeDialog').default;
|
||||
const ShareExtension = require('lib/ShareExtension.js').default;
|
||||
const CameraView = require('lib/components/CameraView');
|
||||
@ -507,13 +508,13 @@ class NoteScreenComponent extends BaseScreenComponent {
|
||||
});
|
||||
}
|
||||
|
||||
showImagePicker(options) {
|
||||
return new Promise((resolve) => {
|
||||
ImagePicker.launchImageLibrary(options, response => {
|
||||
resolve(response);
|
||||
});
|
||||
});
|
||||
}
|
||||
// showImagePicker(options) {
|
||||
// return new Promise((resolve) => {
|
||||
// ImagePicker.launchImageLibrary(options, response => {
|
||||
// resolve(response);
|
||||
// });
|
||||
// });
|
||||
// }
|
||||
|
||||
async resizeImage(localFilePath, targetPath, mimeType) {
|
||||
const maxSize = Resource.IMAGE_MAX_DIMENSION;
|
||||
@ -665,10 +666,10 @@ class NoteScreenComponent extends BaseScreenComponent {
|
||||
this.scheduleSave();
|
||||
}
|
||||
|
||||
async attachPhoto_onPress() {
|
||||
const response = await this.showImagePicker({ mediaType: 'photo', noData: true });
|
||||
await this.attachFile(response, 'image');
|
||||
}
|
||||
// async attachPhoto_onPress() {
|
||||
// const response = await this.showImagePicker({ mediaType: 'photo', noData: true });
|
||||
// await this.attachFile(response, 'image');
|
||||
// }
|
||||
|
||||
takePhoto_onPress() {
|
||||
this.setState({ showCamera: true });
|
||||
@ -811,17 +812,26 @@ class NoteScreenComponent extends BaseScreenComponent {
|
||||
|
||||
// The file attachement modules only work in Android >= 5 (Version 21)
|
||||
// https://github.com/react-community/react-native-image-picker/issues/606
|
||||
|
||||
// As of 2020-10-13, support for attaching images from the gallery is removed
|
||||
// as the package react-native-image-picker has permission issues. It's still
|
||||
// possible to attach files, which has often a similar UI, with thumbnails for
|
||||
// images so normally it should be enough.
|
||||
let canAttachPicture = true;
|
||||
if (Platform.OS === 'android' && Platform.Version < 21) canAttachPicture = false;
|
||||
if (canAttachPicture) {
|
||||
output.push({
|
||||
title: _('Attach...'),
|
||||
onPress: async () => {
|
||||
const buttonId = await dialogs.pop(this, _('Choose an option'), [{ text: _('Take photo'), id: 'takePhoto' }, { text: _('Attach photo'), id: 'attachPhoto' }, { text: _('Attach any file'), id: 'attachFile' }]);
|
||||
const buttonId = await dialogs.pop(this, _('Choose an option'), [
|
||||
{ text: _('Attach file'), id: 'attachFile' },
|
||||
{ text: _('Take photo'), id: 'takePhoto' },
|
||||
// { text: _('Attach photo'), id: 'attachPhoto' },
|
||||
]);
|
||||
|
||||
if (buttonId === 'takePhoto') this.takePhoto_onPress();
|
||||
if (buttonId === 'attachPhoto') this.attachPhoto_onPress();
|
||||
if (buttonId === 'attachFile') this.attachFile_onPress();
|
||||
// if (buttonId === 'attachPhoto') this.attachPhoto_onPress();
|
||||
},
|
||||
});
|
||||
}
|
||||
|
@ -1,48 +0,0 @@
|
||||
// TODO: NOT USED ANYMORE, BUT COPY CONTENT BELOW TO index.js
|
||||
|
||||
// Note about the application structure:
|
||||
// - The user interface and its state is managed by React/Redux.
|
||||
// - Persistent storage to SQLite and Web API is handled outside of React/Redux using regular JavaScript (no middleware, no thunk, etc.).
|
||||
// - Communication from React to SQLite is done by calling model methods (note.save, etc.)
|
||||
// - Communication from SQLite to Redux is done via dispatcher.
|
||||
|
||||
// So there's basically still a one way flux: React => SQLite => Redux => React
|
||||
|
||||
// console.disableYellowBox = true
|
||||
|
||||
// import {YellowBox, AppRegistry} from 'react-native';
|
||||
// YellowBox.ignoreWarnings([
|
||||
// 'Require cycle: node_modules/react-native-',
|
||||
// 'Require cycle: node_modules/rn-fetch-blob',
|
||||
// 'Warning: componentWillReceiveProps has been renamed',
|
||||
// 'Warning: componentWillUpdate has been renamed',
|
||||
// 'Warning: componentWillMount has been renamed',
|
||||
// ]);
|
||||
// const {Root} = require('./root.js');
|
||||
|
||||
// // Disable buggy Fast Refresh
|
||||
// // NOTE: not working - can make the app go into an infinite crash/restart loop
|
||||
// // if (__DEV__) {
|
||||
// // const { DevSettings } = NativeModules;
|
||||
// // DevSettings.setHotLoadingEnabled(false);
|
||||
// // DevSettings.setLiveReloadEnabled(false);
|
||||
// // }
|
||||
|
||||
// function main() {
|
||||
// AppRegistry.registerComponent('Joplin', () => Root);
|
||||
// console.ignoredYellowBox = ['Remote debugger'];
|
||||
// // Note: The final part of the initialization process is in
|
||||
// // AppComponent.componentDidMount(), when the application is ready.
|
||||
// }
|
||||
|
||||
// module.exports = {main};
|
||||
|
||||
|
||||
|
||||
|
||||
// import {AppRegistry} from 'react-native';
|
||||
// const {Root} = require('./root.js');
|
||||
// // import App from './App';
|
||||
// // import {name as appName} from './app.json';
|
||||
|
||||
// AppRegistry.registerComponent('Joplin', () => Root);
|
10
ReactNativeClient/package-lock.json
generated
10
ReactNativeClient/package-lock.json
generated
@ -1435,6 +1435,11 @@
|
||||
"resolved": "https://registry.npmjs.org/@react-native-community/cli-types/-/cli-types-4.10.1.tgz",
|
||||
"integrity": "sha512-ael2f1onoPF3vF7YqHGWy7NnafzGu+yp88BbFbP0ydoCP2xGSUzmZVw0zakPTC040Id+JQ9WeFczujMkDy6jYQ=="
|
||||
},
|
||||
"@react-native-community/clipboard": {
|
||||
"version": "1.5.0",
|
||||
"resolved": "https://registry.npmjs.org/@react-native-community/clipboard/-/clipboard-1.5.0.tgz",
|
||||
"integrity": "sha512-XoujTQuXhPgQLVLn7HPt7615jBEGzJm1Nhos0COdreBIz3qWIi5noYZth8jBFctf8FG5tpe24XTZNDz5udgqQQ=="
|
||||
},
|
||||
"@react-native-community/datetimepicker": {
|
||||
"version": "3.0.3",
|
||||
"resolved": "https://registry.npmjs.org/@react-native-community/datetimepicker/-/datetimepicker-3.0.3.tgz",
|
||||
@ -10851,11 +10856,6 @@
|
||||
"utf8": "^3.0.0"
|
||||
}
|
||||
},
|
||||
"react-native-image-picker": {
|
||||
"version": "2.3.4",
|
||||
"resolved": "https://registry.npmjs.org/react-native-image-picker/-/react-native-image-picker-2.3.4.tgz",
|
||||
"integrity": "sha512-4UHu+zOyDT570r5mIbjH6h1iMrKIq/qfsKiAVUEZwncVegh0usJiEYNyJw4CEVwNeehmye/ia5sLDsa+kzIE4g=="
|
||||
},
|
||||
"react-native-image-resizer": {
|
||||
"version": "1.3.0",
|
||||
"resolved": "https://registry.npmjs.org/react-native-image-resizer/-/react-native-image-resizer-1.3.0.tgz",
|
||||
|
@ -10,6 +10,7 @@
|
||||
"lint": "eslint ."
|
||||
},
|
||||
"dependencies": {
|
||||
"@react-native-community/clipboard": "^1.5.0",
|
||||
"@react-native-community/datetimepicker": "^3.0.3",
|
||||
"@react-native-community/geolocation": "^2.0.2",
|
||||
"@react-native-community/slider": "^3.0.3",
|
||||
@ -63,7 +64,6 @@
|
||||
"react-native-dropdownalert": "^3.1.2",
|
||||
"react-native-file-viewer": "^2.1.4",
|
||||
"react-native-fs": "^2.16.6",
|
||||
"react-native-image-picker": "^2.3.4",
|
||||
"react-native-image-resizer": "^1.3.0",
|
||||
"react-native-modal-datetime-picker": "^9.0.0",
|
||||
"react-native-popup-dialog": "^0.9.41",
|
||||
|
Loading…
Reference in New Issue
Block a user