Skip to content

Commit

Permalink
Merge pull request #103 from rive-app/main
Browse files Browse the repository at this point in the history
release: 2.1.26
  • Loading branch information
avivian authored Jun 30, 2021
2 parents 2fd76d9 + dacd71f commit b8fb61c
Show file tree
Hide file tree
Showing 29 changed files with 656 additions and 124 deletions.
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
![Build Status](https://github.com/rive-app/rive-react-native/actions/workflows/typecheck-lint.yml/badge.svg)
![Discord badge](https://img.shields.io/discord/532365473602600965)
![Twitter handle](https://img.shields.io/twitter/follow/rive_app.svg?style=social&label=Follow)
# rive-react-native

This package implements native binding for Rive Runtime for iOS and Android.
`Expo CLI` is not supported by this lib.

Further runtime documentation can be found in [Rive's help center](https://help.rive.app/runtimes).

## Installation

- install `rive-react-native` dependency using yarn or npm
Expand Down
3 changes: 2 additions & 1 deletion android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -136,5 +136,6 @@ dependencies {
implementation 'androidx.core:core-ktx:1.3.2'
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.4.1'
implementation 'app.rive:rive-android:0.2.5'
implementation 'app.rive:rive-android:0.2.8'
implementation 'com.android.volley:volley:1.2.0'
}
58 changes: 58 additions & 0 deletions android/src/main/java/com/rivereactnative/RNRiveError.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
package com.rivereactnative

import app.rive.runtime.kotlin.core.errors.*

enum class RNRiveError(private val mValue: String) {
FileNotFound("FileNotFound"),
UnsupportedRuntimeVersion("UnsupportedRuntimeVersion"),
IncorrectRiveFileUrl("IncorrectRiveFileUrl"),
IncorrectAnimationName("IncorrectAnimationName"),
MalformedFile("MalformedFile"),
IncorrectArtboardName("IncorrectArtboardName"),
IncorrectStateMachineName("IncorrectStateMachineName"),
IncorrectStateMachineInput("IncorrectStateMachineInput");

var message: String = "Default message"

override fun toString(): String {
return mValue
}

companion object {
fun mapToRNRiveError(ex: RiveException): RNRiveError? {
return when (ex) {
is ArtboardException -> {
val err = IncorrectArtboardName
err.message = ex.message!!
return err
}
is UnsupportedRuntimeVersionException -> {
val err = UnsupportedRuntimeVersion
err.message = ex.message!!
return err
}
is MalformedFileException -> {
val err = MalformedFile
err.message = ex.message!!
return err
}
is AnimationException -> {
val err = IncorrectAnimationName
err.message = ex.message!!
return err
}
is StateMachineException -> {
val err = IncorrectStateMachineName
err.message = ex.message!!
return err
}
is StateMachineInputException -> {
val err = IncorrectStateMachineInput
err.message = ex.message!!
return err
}
else -> null
}
}
}
}
Loading

0 comments on commit b8fb61c

Please sign in to comment.