Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
1521f52
Move native v1 Gallery components to v1 directory
mkevins Apr 26, 2021
8639891
Use v1 defaultColumnsNumber in native v1 gallery
mkevins Apr 26, 2021
91c09b8
Make onFocus optional in MediaPlaceholder
mkevins Apr 27, 2021
ffc22e7
Add useInnerBlocksProps hook
mkevins Apr 27, 2021
e688131
Enable __experimentalGalleryRefactor flag under __DEV__
mkevins Apr 29, 2021
c8fbc35
Add WIP v2 gallery
mkevins Apr 29, 2021
2f44f58
Add numColumns to block-list flat list
mkevins Apr 29, 2021
9fd5897
Temporarily comment out spinner for pending imagesize option
mkevins Apr 29, 2021
d646d59
Fix spacing
mkevins Apr 29, 2021
59ea082
Adjust styles to avoid appender overlap
mkevins Apr 30, 2021
683af04
Add gallery caption
mkevins Apr 30, 2021
a520018
Fix lint
mkevins May 4, 2021
1f0073d
Fix sass lint
mkevins May 4, 2021
4e3d981
Merge branch 'refactor/gallery-to-nested-image-blocks' into rnmobile/…
mkevins May 7, 2021
77091e2
Merge branch 'refactor/gallery-to-nested-image-blocks' into rnmobile/…
mkevins May 20, 2021
2c6e317
[Mobile] - Refactor gallery - cherry pick image edit native (#31826)
mkevins May 20, 2021
3221e23
Cherry-pick BlockListItem changes
mkevins May 24, 2021
7616231
Return early from render instead of renderContent
mkevins May 24, 2021
4d235fd
Cherry-pick plumb blockProps through BlockListBlock
mkevins May 24, 2021
df286d8
Cherry-pick add GridItem
mkevins May 24, 2021
f5ff38d
Cherry-pick BlockList
mkevins May 24, 2021
0e777c6
Cherry-pick StylePreview key change
mkevins May 24, 2021
acfcb7f
Cherry-pick blockProps and gridProperties in InnerBlocks
mkevins May 24, 2021
30d20b1
Use sass var for galleryAppender padding
mkevins May 24, 2021
8e89a84
Cherry-pick remaining gallery changes
mkevins May 24, 2021
2de17c3
Remove numColumns
mkevins May 26, 2021
931184a
Remove blockProps
mkevins May 26, 2021
e96cd3e
Fix gallery block.json (delete extra comma)
mkevins May 27, 2021
5c78270
Remove unused imageCrop
mkevins May 27, 2021
3c2f144
Merge branch 'refactor/gallery-to-nested-image-blocks' into rnmobile/…
mkevins May 31, 2021
46c8da7
Merge branch 'refactor/gallery-to-nested-image-blocks-upstream' into …
mkevins Jun 3, 2021
946aeab
Merge branch 'refactor/gallery-to-nested-image-blocks' into rnmobile/…
mkevins Jun 15, 2021
fb34126
Merge branch 'refactor/gallery-to-nested-image-blocks-upstream' into …
mkevins Jun 16, 2021
0527d39
Add back blockWidth contentContainerStyles in block list
mkevins May 31, 2021
a8c1f0e
Use boolean flags for variants in Platform module
mkevins May 31, 2021
1c1dc9d
Use boolean Platform flags
mkevins May 31, 2021
5f35c4c
Only render imageSizeOptions loading spinner on web
mkevins May 31, 2021
57a01f7
Add default for destructured context in image edit
mkevins Jun 1, 2021
0052b11
Temporarily hard-code experimenal gallery refactor flag to true
mkevins Jun 4, 2021
0d5fb18
Revert "Temporarily hard-code experimenal gallery refactor flag to true"
mkevins Jul 5, 2021
03d730b
Update experiments page with warning about the mobile app version
mkevins Jul 5, 2021
93fd471
Merge branch 'refactor/gallery-to-nested-image-blocks-upstream' into …
mkevins Jul 8, 2021
9ca69ea
Merge branch 'refactor/gallery-to-nested-image-blocks' into rnmobile/…
antonis Aug 2, 2021
475f976
Changes new gallery flag name
antonis Aug 2, 2021
5387ca0
Updates mobile warning
antonis Aug 2, 2021
ec158f7
Removes the imageCount attribute
antonis Aug 2, 2021
53ba376
Remove the isGrouped context
antonis Aug 2, 2021
fe40795
Fixes lint issue
antonis Aug 2, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Cherry-pick add GridItem
Since this is duplicated from the original mobile gallery code (Tiles
component), it might make sense to export it for re-use. Previously, it
was only moved, but now that we will maintain both versions, it has
become a duplicate implementation. I will defer this to a later commit.
  • Loading branch information
mkevins committed May 27, 2021
commit df286d8ecdce2e56edfc9cf956154ad7da4d048d
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,7 @@
.fullAlignmentPadding {
padding: $block-edge-to-content;
}

.gridItem {
overflow: visible;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
/**
* External dependencies
*/
import { View } from 'react-native';

/**
* Internal dependencies
*/
import styles from './block-list-item.scss';

function Grid( props ) {
/**
* Since we don't have `calc()`, we must calculate our spacings here in
* order to preserve even spacing between tiles and equal width for tiles
* in a given row.
*
* In order to ensure equal sizing of tile contents, we distribute the
* spacing such that each tile has an equal "share" of the fixed spacing. To
* keep the tiles properly aligned within their rows, we calculate the left
* and right paddings based on the tile's relative position within the row.
*
* Note: we use padding instead of margins so that the fixed spacing is
* included within the relative spacing (i.e. width percentage), and
* wrapping behavior is preserved.
*
* - The left most tile in a row must have left padding of zero.
* - The right most tile in a row must have a right padding of zero.
*
* The values of these left and right paddings are interpolated for tiles in
* between. The right padding is complementary with the left padding of the
* next tile (i.e. the right padding of [tile n] + the left padding of
* [tile n + 1] will be equal for all tiles except the last one in a given
* row).
*
*/
const { numOfColumns, children, tileCount, index, maxWidth } = props;
const lastTile = tileCount - 1;
const lastRow = Math.floor( lastTile / numOfColumns );

const row = Math.floor( index / numOfColumns );
const rowLength =
row === lastRow ? ( lastTile % numOfColumns ) + 1 : numOfColumns;

return (
<View
style={ [
{
width: maxWidth / rowLength,
},
styles.gridItem,
] }
>
{ children }
</View>
);
}

export default Grid;