Skip to content

Commit

Permalink
[iOS] Adding the posibility for the client to addd a loading view (#2…
Browse files Browse the repository at this point in the history
…3506)

This view is shown while the editor is loading
  • Loading branch information
etoledom authored Jun 29, 2020
1 parent b89d4d1 commit 3366fbe
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
4 changes: 3 additions & 1 deletion packages/react-native-bridge/ios/Gutenberg.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ public class Gutenberg: NSObject {
private var extraModules: [RCTBridgeModule];

public lazy var rootView: UIView = {
return RCTRootView(bridge: bridge, moduleName: "gutenberg", initialProperties: initialProps)
let view = RCTRootView(bridge: bridge, moduleName: "gutenberg", initialProperties: initialProps)
view.loadingView = dataSource.loadingView
return view
}()

public var delegate: GutenbergBridgeDelegate? {
Expand Down
11 changes: 9 additions & 2 deletions packages/react-native-bridge/ios/GutenbergBridgeDataSource.swift
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,16 @@ public protocol GutenbergBridgeDataSource: class {
/// - Returns: Gutenberg related localization key value pairs for the current locale.
func gutenbergTranslations() -> [String : [String]]?

/// Asks the delegate for a list of Media Sources to show on the Media Source Picker.
/// Asks the data source for a list of Media Sources to show on the Media Source Picker.
func gutenbergMediaSources() -> [Gutenberg.MediaSource]

func gutenbergCapabilities() -> [String: Bool]?

/// Asks the delegate for a list of theme colors
/// Asks the data source for a list of theme colors.
func gutenbergEditorTheme() -> GutenbergEditorTheme?

/// Asks the data source for a view to show while the Editor is loading.
var loadingView: UIView? { get }
}

public extension GutenbergBridgeDataSource {
Expand All @@ -54,6 +57,10 @@ public extension GutenbergBridgeDataSource {
func gutenbergPostType() -> String {
return "post"
}

var loadingView: UIView? {
return nil
}
}

public protocol GutenbergEditorTheme {
Expand Down

0 comments on commit 3366fbe

Please sign in to comment.