This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { useEffect, useRef, useCallback } from "react"; | |
const useIsMounted = () => { | |
const mountedRef = useRef(true); | |
useEffect(() => { | |
return () => { | |
mountedRef.current = false; | |
}; | |
}, []); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from "react"; | |
import Uploady from "@rpldy/uploady"; | |
import { usePasteUpload } from "@rpldy/upload-paste"; | |
const ElementPaste = (props) => { | |
const containerRef = useRef(null); | |
const onPasteUpload = useCallback(({ count }) => { | |
console.log("ELEMENT PASTE-TO-UPLOAD files: ", count); | |
}, []); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from "react"; | |
import styled from "styled-components"; | |
import Uploady from "@rpldy/uploady"; | |
import UploadDropZone from "@rpldy/upload-drop-zone"; | |
import withPasteUpload from "@rpldy/upload-paste"; | |
const StyledDropZone = styled(UploadDropZone)` | |
width: 400px; | |
height: 400px; | |
border: 1px solid #000; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const styles = StyleSheet.create({ | |
uploadedImage: { | |
width: 400, | |
height: 400, | |
resizeMode: 'cover', | |
}, | |
body: { | |
backgroundColor: "#ffffff", | |
}, | |
sectionContainer: { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const Upload = () => { | |
const [uploadUrl, setUploadUrl] = useState(false); | |
const uploadyContext = useContext(UploadyContext); | |
useItemFinishListener((item) => { | |
const response = JSON.parse(item.uploadResponse.data); | |
console.log(`item ${item.id} finished uploading, response was: `, response); | |
setUploadUrl(response.url); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { useState, useCallback, useContext } from "react"; | |
import { SafeAreaView, StyleSheet, ScrollView, View, Text, StatusBar, Button, ImageBackground, Image } from "react-native"; | |
import DocumentPicker from "react-native-document-picker/index"; | |
import NativeUploady, { | |
UploadyContext, | |
useItemFinishListener, | |
useItemStartListener, | |
useItemErrorListener, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import ReactCrop from "react-image-crop"; | |
import { withRequestPreSendUpdate, useItemFinalizeListener } from "@rpldy/uploady"; | |
import { PREVIEW_TYPES } from "@rpldy/upload-preview"; | |
import cropImage from "./image-crop-helper"; | |
const ItemPreviewWithCrop = withRequestPreSendUpdate(props => { | |
const { id, url, isFallback, type, updateRequest, requestData, previewMethods } = props; | |
const [finished, setFinished] = useState(false); | |
const [crop, setCrop] = useState(null); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Uploady from "@rpldy/uploady"; | |
import UploadButton from "@rpldy/upload-button"; | |
import UploadPreview from "@rpldy/upload-preview"; | |
export default function UploadWithCrop() { | |
const previewMethodsRef = useRef(); | |
return ( | |
<Uploady | |
destination={{ url: "[upload-url]" }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import UploadButton from "@rpldy/upload-button"; | |
import UploadPreview from "@rpldy/upload-preview"; | |
import CustomImagePreview from "./CustomImagePreview"; | |
const UploadWithProgressPreview = () => { | |
const getPreviewProps = useCallback(item => ({ id: item.id }), []); | |
return ( | |
<> | |
<UploadButton>Upload Files</UploadButton> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import styled from "styled-components" | |
import { useItemProgressListener } from "@rpldy/uploady"; | |
const PreviewImage = styled.img` | |
margin: 5px; | |
max-width: 200px; | |
height: auto; | |
transition: opacity 0.4s; | |
${({ completed }) => `opacity: ${completed / 100};`} |
NewerOlder