Repository navigation
RNMobile - Image Block: Add caption. (v2) - #10616
Conversation
|
Those commits from @mzorz are already on |
2f8977e to
c7352c3
Compare
|
Thank you @hypest ! I believe now it's ready for review. |
| if ( isSelected ) { | ||
| return textContainer( textInput ); | ||
| } | ||
| return textContainer( text ); |
There was a problem hiding this comment.
Any particular reason we fall back to plain textview instead of just letting the editing component in?
There was a problem hiding this comment.
I tried using the editable={ isSelected } property on TextInput. It had these issues:
When the block is not selected, with a caption written, and I tap over it to select the block:
- IOS: The tap is consumed by the TextInput component and it doesn't select the block.
- Android: That property seems to not work and it starts editing the caption anyway, without actually selecting the block.
I tested this approach of using the Text component and it worked as expected, so I decided to keep it. If there's a better way I'll be happy to test it!
There was a problem hiding this comment.
Yeah, I think the focus/selection issues are already there for the rest of the blocks anyway and we will probably tackle them in unison.
Besides, the textview only solution "solves" the tap-to-focus-block but needs an extra tap to place the cursor.
I think leaving the TextInput (or RichText as the web side does) should be fine for this iteration and should simplify the PR diff for now. WDYT?
There was a problem hiding this comment.
Sounds good!
And yes! it will get quite a lot simpler. 😁
…ption. Now it uses just TextInput in both selected and not-selected state to simplify implementation.
| ); | ||
| } | ||
|
|
||
| const CaptionTextInput = ( setAttributes, caption, isSelected ) => { |
There was a problem hiding this comment.
At this point it seems that CaptionTextInput just checks for caption presence/length besides rendering the caption elements. WDYT about copying what the web-side does and just check and inline the JSX snippet directly, like this? This will bring us closer to the web-side and will be easier to compare what's different on the mobile.
There was a problem hiding this comment.
I like that is more declarative in this way, but I agree on trying to be closer to the web-side! I'll push a commit with the change 👍
…line declaration.
Description
This PR adds captions to the mobile version of the Image Block.
To test:
gutenberg-mobileproject and follow the instructions.