-
-
Notifications
You must be signed in to change notification settings - Fork 345
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Compatibility with react-modal on iOS #219
Comments
Hi, are you running this on a mobile phone from a server by any chance? |
The demo? Yep, I'm using serve to open the demo on a mobile phone:
And then using my local IP and port |
Then please pull the latest master and npm install, otherwise you don't get ReactCrop.css because the relative path to it |
I did have that problem initially because I used Regardless, we first noticed these issues in our app which uses create-react-app. |
Hm strange, your fork works fine for me if I npm start and then open demo/index.html (without a server), even after moving, resizing etc |
Did you try it on an iPhone with Safari? It works fine everywhere else, as is usually the case with Safari... 😢 |
Hmm, interesting... It's true I tested it with 6.0.7 earlier when I was still in the office but now I don't have an iPhone with me. I will check again tomorrow morning, thanks! We can close this for now. |
To follow up, I have it working as expected in the demo. The popup in our app still behaves strangely on small screen (iPhone) even though it works as in the demo on large screen (iPad). I will have to investigate it further in our setup. |
I've finally gotten to the bottom of this... The weird behavior was in fact due to 2 issues:
const getImageDimensions = (imageFile) => {
return new Promise((resolve) => {
loadImage(
imageFile,
(img) => {
resolve({ width: img.width, height: img.height });
},
{
orientation: true
}
);
});
}; @dominictobias thanks for this library and thanks for your help! |
Ok great glad you got it working 👍
…On Thu, 15 Nov 2018 at 15:02, Tudor Pavel ***@***.***> wrote:
I've finally gotten to the bottom of this... The weird behavior was in
fact due to 2 issues:
1.
My mistake from #220
<#220>: I was
setting all width, height and crop. The solution was to set initial
values only for width and crop, while setting height: null.
2.
Issues with EXIF orientation discussed in #205
<#205> and
mentioned in the README (I should've RTFD
<https://www.urbandictionary.com/define.php?term=RTFD>), I was
calculating the image width and height in memory with the uploaded
File/Blob <https://developer.mozilla.org/en-US/docs/Web/API/Blob>
using this naive approach
<https://gist.github.com/schabluk/808f8691720d3a0e0e200a333bc61ecc>. I
needed to do this before rendering ReactCrop. My photo was landscape
in memory and portrait in ReactCrop due to EXIF orientation. The solution
was to use blueimp-load-image
<https://github.com/blueimp/JavaScript-Load-Image/> to load the image
in memory with orientation: true:
const getImageDimensions = (imageFile) => {
return new Promise((resolve) => {
loadImage(
imageFile,
(img) => {
resolve({ width: img.width, height: img.height });
},
{
orientation: true
}
);
});
};
@dominictobias <https://github.com/DominicTobias> thanks for this library
and thanks for your help!
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#219 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAuZ-ugwA7GKkEfJXBYE5yDFPkwkrOygks5uvYIOgaJpZM4YeOfW>
.
|
Ps I’m thinking about maybe making the drag handles slightly larger for
touch devices, if you have trouble dragging them let me know. Another guy
was saying his users in user eating found it hard (they are only 9x9 atm I
think)
On Thu, 15 Nov 2018 at 15:08, dominic tobias <dominic.tobias@gmail.com>
wrote:
… Ok great glad you got it working 👍
On Thu, 15 Nov 2018 at 15:02, Tudor Pavel ***@***.***>
wrote:
> I've finally gotten to the bottom of this... The weird behavior was in
> fact due to 2 issues:
>
> 1.
>
> My mistake from #220
> <#220>: I was
> setting all width, height and crop. The solution was to set initial
> values only for width and crop, while setting height: null.
> 2.
>
> Issues with EXIF orientation discussed in #205
> <#205> and
> mentioned in the README (I should've RTFD
> <https://www.urbandictionary.com/define.php?term=RTFD>), I was
> calculating the image width and height in memory with the uploaded
> File/Blob <https://developer.mozilla.org/en-US/docs/Web/API/Blob>
> using this naive approach
> <https://gist.github.com/schabluk/808f8691720d3a0e0e200a333bc61ecc>.
> I needed to do this before rendering ReactCrop. My photo was
> landscape in memory and portrait in ReactCrop due to EXIF orientation. The
> solution was to use blueimp-load-image
> <https://github.com/blueimp/JavaScript-Load-Image/> to load the image
> in memory with orientation: true:
>
> const getImageDimensions = (imageFile) => {
> return new Promise((resolve) => {
> loadImage(
> imageFile,
> (img) => {
> resolve({ width: img.width, height: img.height });
> },
> {
> orientation: true
> }
> );
> });
> };
>
> @dominictobias <https://github.com/DominicTobias> thanks for this
> library and thanks for your help!
>
> —
> You are receiving this because you were mentioned.
>
>
> Reply to this email directly, view it on GitHub
> <#219 (comment)>,
> or mute the thread
> <https://github.com/notifications/unsubscribe-auth/AAuZ-ugwA7GKkEfJXBYE5yDFPkwkrOygks5uvYIOgaJpZM4YeOfW>
> .
>
|
Sure, I guess it couldn't hurt to have them larger to improve the UX on touch devices. 👍 |
@dominictobias assuming drag handles aren't larger yet, is there a way to configure them to be larger? |
They are larger now but if you want to adjust them further the easiest way is to set some sass variables before? importing the file - https://github.com/DominicTobias/react-image-crop/blob/master/lib/ReactCrop.scss#L11 but you can also just override in CSS too. Probably the experience can be optimised further for mobile as discussed here - #201 |
I couldn't find any previous discussion on this, so I will start one here.
Our use case involves adding ReactCrop inside a react-modal and we noticed that ReactCrop does not work properly on iOS when placed inside a modal. Basically, the crop rectangle disappears.
I'm not sure what could be causing this, but my guess is that on iOS Safari the
getElementOffset
code works unexpectedly because of the way the modal is positioned? I'm going to try to debug this further tomorrow.I've modified the demo to include a modal for debugging purposes:
https://github.com/Camversity/react-image-crop/tree/debug-modal
Any thoughts on this?
The text was updated successfully, but these errors were encountered: