Skip to content

Commit

Permalink
feat: added robust pause method on iOS (#42)
Browse files Browse the repository at this point in the history
  • Loading branch information
TMaszko authored May 24, 2021
1 parent f4b010f commit 1285e2b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
8 changes: 6 additions & 2 deletions ios/RiveReactNativeView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -178,8 +178,12 @@ class RiveReactNativeView: UIView, PlayDelegate, PauseDelegate, StopDelegate, Lo

}

@objc func pause() {
riveView.pause()
func pause(animationNames: [String], areStateMachines: Bool) {
if animationNames.isEmpty {
riveView.pause()
} else {
riveView.pause(animationNames: animationNames, isStateMachine: areStateMachines)
}
}

// func updateArtboard(_ artboard: RiveArtboard) {
Expand Down
2 changes: 1 addition & 1 deletion ios/RiveReactNativeViewManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class RiveReactNativeViewManager: RCTViewManager {
@objc func pause(_ node: NSNumber, animationNames: [String], areStateMachines: Bool) {
DispatchQueue.main.async {
let component = self.bridge.uiManager.view(forReactTag: node) as! RiveReactNativeView
component.pause()
component.pause(animationNames: animationNames, areStateMachines: areStateMachines)
}
}

Expand Down

0 comments on commit 1285e2b

Please sign in to comment.