-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add cross-platform SwiftUI wrapper for AnimatedButton (#2139)
- Loading branch information
Showing
12 changed files
with
314 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
// Created by Cal Stephens on 8/14/23. | ||
// Copyright © 2023 Airbnb Inc. All rights reserved. | ||
|
||
import Lottie | ||
import SwiftUI | ||
|
||
// MARK: - LottieSwitchRow | ||
|
||
struct LottieButtonRow: View { | ||
|
||
// MARK: Internal | ||
|
||
var animationName: String | ||
var title: String | ||
|
||
var body: some View { | ||
HStack { | ||
LottieButton(animation: .named(animationName)) { | ||
pressCount += 1 | ||
} | ||
.animate(fromMarker: "touchDownStart", toMarker: "touchDownEnd", on: .touchDown) | ||
.animate(fromMarker: "touchDownEnd", toMarker: "touchUpCancel", on: .touchUpOutside) | ||
.animate(fromMarker: "touchDownEnd", toMarker: "touchUpEnd", on: .touchUpInside) | ||
.frame(width: 80, height: 80) | ||
|
||
Text(verbatim: "\(title) (pressCount=\(pressCount))") | ||
} | ||
} | ||
|
||
// MARK: Private | ||
|
||
@State private var pressCount = 0 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.