diff --git a/android/src/main/java/com/rivereactnative/RNFit.kt b/android/src/main/java/com/rivereactnative/RNFit.kt index 4d65044..d8c7703 100644 --- a/android/src/main/java/com/rivereactnative/RNFit.kt +++ b/android/src/main/java/com/rivereactnative/RNFit.kt @@ -4,6 +4,7 @@ import app.rive.runtime.kotlin.core.Fit enum class RNFit(private val mValue: String) { Cover("cover"), + layout("layout"), Contain("contain"), Fill("fill"), FitWidth("fitWidth"), @@ -24,6 +25,7 @@ enum class RNFit(private val mValue: String) { fun mapToRiveFit(rnFit: RNFit): Fit { return when (rnFit) { Cover -> Fit.COVER + Layout -> Fit.LAYOUT Contain -> Fit.CONTAIN Fill -> Fit.FILL FitWidth -> Fit.FIT_WIDTH diff --git a/docs/types.md b/docs/types.md index 0535382..d02bc79 100644 --- a/docs/types.md +++ b/docs/types.md @@ -5,6 +5,7 @@ ```ts export enum Fit { Cover = 'cover', + Layout = 'layout', Contain = 'contain', Fill = 'fill', FitWidth = 'fitWidth', diff --git a/example/android/app/src/main/res/raw/layouts.riv b/example/android/app/src/main/res/raw/layouts.riv new file mode 100644 index 0000000..844f6cf Binary files /dev/null and b/example/android/app/src/main/res/raw/layouts.riv differ diff --git a/example/ios/Assets/layouts.riv b/example/ios/Assets/layouts.riv new file mode 100644 index 0000000..844f6cf Binary files /dev/null and b/example/ios/Assets/layouts.riv differ diff --git a/example/ios/Podfile.lock b/example/ios/Podfile.lock index da0e5e6..e7949da 100644 --- a/example/ios/Podfile.lock +++ b/example/ios/Podfile.lock @@ -489,8 +489,8 @@ PODS: - React-perflogger (= 0.72.7) - rive-react-native (8.0.0): - React-Core - - RiveRuntime (= 6.2.1) - - RiveRuntime (6.2.1) + - RiveRuntime (= 6.3.1) + - RiveRuntime (6.3.1) - RNCMaskedView (0.2.9): - React-Core - RNCPicker (1.16.8): @@ -744,8 +744,8 @@ SPEC CHECKSUMS: React-runtimescheduler: 7649c3b46c8dee1853691ecf60146a16ae59253c React-utils: 56838edeaaf651220d1e53cd0b8934fb8ce68415 ReactCommon: 5f704096ccf7733b390f59043b6fa9cc180ee4f6 - rive-react-native: 555505d7a84182ea159d5856bcda8ba01057f256 - RiveRuntime: 23b2f53b5439c38f716b2f1a5d2a9e3a24683877 + rive-react-native: f73f70e67c53ba2d755b20f7350378fcdf2620b6 + RiveRuntime: 6c8d8553ba11599f7336a7c1be835a4584606678 RNCMaskedView: 949696f25ec596bfc697fc88e6f95cf0c79669b6 RNCPicker: 0991c56da7815c0cf946d6f63cf920b25296e5f6 RNGestureHandler: a479ebd5ed4221a810967000735517df0d2db211 diff --git a/example/src/Simple.tsx b/example/src/Simple.tsx index d49f5be..d7dae91 100644 --- a/example/src/Simple.tsx +++ b/example/src/Simple.tsx @@ -10,10 +10,8 @@ export default function Simple() { fit={Fit.Contain} alignment={Alignment.Center} style={styles.animation} - artboardName={'Avatar 3'} autoplay={true} - animationName="idlePreview" - resourceName={'avatars'} + resourceName={'layouts'} /> diff --git a/ios/RNFit.swift b/ios/RNFit.swift index b9aafe2..f5ce46b 100644 --- a/ios/RNFit.swift +++ b/ios/RNFit.swift @@ -3,13 +3,14 @@ import RiveRuntime enum RNFit: String { case Contain = "contain" + case Layout = "layout" case Cover = "cover" case Fill = "fill" case FitWidth = "fitWidth" case FitHeight = "fitHeight" case None = "none" case ScaleDown = "scaleDown" - + static func mapToRNFit(value: String) -> RNFit { if let rnEnum = RNFit(rawValue: value) { return rnEnum @@ -17,11 +18,13 @@ enum RNFit: String { fatalError("Unsupported fit type: \(value)") } } - + static func mapToRiveFit(rnFit: RNFit) -> RiveFit { switch rnFit { case .Contain: return RiveFit.contain + case .Layout: + return RiveFit.layout case .Cover: return RiveFit.cover case .Fill: diff --git a/rive-react-native.podspec b/rive-react-native.podspec index 77de1ed..1ffa1f5 100644 --- a/rive-react-native.podspec +++ b/rive-react-native.podspec @@ -18,5 +18,5 @@ Pod::Spec.new do |s| s.swift_version = "5.0" s.dependency "React-Core" - s.dependency "RiveRuntime", "6.2.1" + s.dependency "RiveRuntime", "6.3.1" end diff --git a/src/types.ts b/src/types.ts index cf3f590..482924b 100644 --- a/src/types.ts +++ b/src/types.ts @@ -43,6 +43,7 @@ export enum ViewManagerMethod { export enum Fit { Cover = 'cover', + Layout = 'layout', Contain = 'contain', Fill = 'fill', FitWidth = 'fitWidth',