Skip to content
Merged
1 change: 1 addition & 0 deletions packages/components/src/mobile/badge/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,5 @@
border-radius: 3px;
background-color: $gray-70;
border-color: $gray-70;
overflow: hidden;
}
10 changes: 4 additions & 6 deletions packages/react-native-bridge/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,10 @@ export function subscribeUpdateHtml( callback ) {
}

export function subscribeFeaturedImageIdNativeUpdated( callback ) {
return isAndroid
? gutenbergBridgeEvents.addListener(
'featuredImageIdNativeUpdated',
callback
)
: undefined;
return gutenbergBridgeEvents.addListener(
'featuredImageIdNativeUpdated',
callback
);
}

/**
Expand Down
6 changes: 6 additions & 0 deletions packages/react-native-bridge/ios/Gutenberg.swift
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ public class Gutenberg: NSObject {
initialProps["initialTitle"] = initialTitle
}

initialProps["featuredImageId"] = dataSource.gutenbergFeaturedImageId()

initialProps["postType"] = dataSource.gutenbergPostType()

if let locale = dataSource.gutenbergLocale() {
Expand Down Expand Up @@ -118,6 +120,10 @@ public class Gutenberg: NSObject {
sendEvent(.updateHtml, body: ["html": html])
}

public func featuredImageIdNativeUpdated(mediaId: Int32) {
sendEvent(.featuredImageIdNativeUpdated, body: ["featuredImageId": mediaId])
}

public func replace(block: Block) {
sendEvent(.replaceBlock, body: ["html": block.content, "clientId": block.id])
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@ public protocol GutenbergBridgeDataSource: class {
/// - Returns: The HTML initial title or nil.
func gutenbergInitialTitle() -> String?

/// Asks the data source for the initial featured image id to be presented by the editor.
///
/// - Returns: The initial id of the post's featured image, zero if no featured image is set.
func gutenbergFeaturedImageId() -> NSNumber?

/// Asks the data source for the post type to be presented by the editor.
/// Return `nil` to assume a `post` type.
///
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -366,6 +366,7 @@ extension RNReactNativeGutenbergBridge {
case setTitle
case toggleHTMLMode
case updateHtml
case featuredImageIdNativeUpdated
case mediaUpload
case setFocusOnTitle
case mediaAppend
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,10 @@ extension GutenbergViewController: GutenbergBridgeDataSource {
return nil
}

func gutenbergFeaturedImageId() -> NSNumber? {
return nil
}

func gutenbergCapabilities() -> [Capabilities : Bool] {
return [
.mentions: true,
Expand Down