Using custom image sizes in WordPress Gutenberg MediaUpload component

add_filter( 'image_size_names_choose', 'my_custom_sizes' );
 
function my_custom_sizes( $sizes ) {
    return array_merge( $sizes, array(
        'gallery-thumb' => __( 'Gallery Thumb' ),
        'medium-square' => __( 'Medium Square' )
    ) );
}