-
Notifications
You must be signed in to change notification settings - Fork 4.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Mobile] Image height #13096
[Mobile] Image height #13096
Conversation
Beside the minor comments I had, this LGTM 👍 Great work here! |
Thanks @Tug for the review! |
This looks good now 👍 |
c46abbd
to
556b29b
Compare
556b29b
to
b72c99b
Compare
class ImageEdit extends Component { | ||
constructor() { | ||
super( ...arguments ); | ||
this.onMediaLibraryPress = this.onMediaLibraryPress.bind( this ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @Tug ! I had to add this bind back since it was giving an error accessing this.props.setAttributes
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, usually onSomething
methods need to be bound to this
👍
Thank you @Tug ! Everything should be fixed now. Ready for another look 👍 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍
Thank you! |
@@ -0,0 +1,9 @@ | |||
|
|||
export function calculatePreferedImageSize( image, container ) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would be good to add some JSDocs :)
* [rnmobile]: Convert image-block into class * [rnmobile]: Creating mobile version of `image-size`. * [rnmobile]: Adding util to image-block to share math between image-size components. * [rnmobile]: Adding newline at the end of image-size.native.js file * [rnmobile]: Replace wrong tabs characters * [rnmobile]: Clear image size when url changes. * [rnmobile]: Fixed lint issues * [rnmobile]: Removing unnecessary binding calls * [rnmobile]: Added necessary this.onLayout.bind( this ) * [rnmobile]: Adding missing bind to `onMediaLibraryPress`.
* [rnmobile]: Convert image-block into class * [rnmobile]: Creating mobile version of `image-size`. * [rnmobile]: Adding util to image-block to share math between image-size components. * [rnmobile]: Adding newline at the end of image-size.native.js file * [rnmobile]: Replace wrong tabs characters * [rnmobile]: Clear image size when url changes. * [rnmobile]: Fixed lint issues * [rnmobile]: Removing unnecessary binding calls * [rnmobile]: Added necessary this.onLayout.bind( this ) * [rnmobile]: Adding missing bind to `onMediaLibraryPress`.
This PR takes over this (very old) PR #9975 to solve the issue wordpress-mobile/gutenberg-mobile#444
The image size implementations tries to follow closely the web implementation. I tried to share some code from
ImageSize
but most of it is platform specific. I made a smallutils
to share some math calculations.On a future PR I plan to implement some kind of loading indicator.
To test:
Refer to the
gutenberg-mobile
PR.