React Native
Props
Rive Component Props
The following are props you can set on the Rive React component for this runtime:
children
(optional) - Can be used to display something positionedabsolutely
on top of the rive animation view.style
(optional) - Style of the rive animation view wrapper.- Default:
undefined
- Type:
StyleProp<ViewStyle>
- Default:
resourceName
(optional) - A file name that matches the rive file without.riv
extension. You should provide eitherresourceName
orurl
not both at the same time.- Default:
undefined
- Type:
string
- Default:
url
(optional) - A URL that provides a rive file. You should provide eitherresourceName
orurl
not both at the same time.- Default:
undefined
- Type:
string
- Default:
autoplay
(optional) - Opening a rive animation view or specifying newresourceName
orurl
will make it automatically play, when it is ready.- Default:
true
- Type:
boolean
- Default:
fit
(optional) - Specifies how animation should be displayed inside rive animation view- Default:
Fit.Contain
- Type:
Fit
- Default:
alignment
(optional) - Specifies how animation should be aligned inside rive animation view.- Default:
Alignment.None
- Type:
Alignment
- Default:
artboardName
(optional) - Specifies which animation artboard should be displayed in rive animation view.- Default:
undefined
- Type:
string
- Default:
animationName
(optional) - Specifies which animation should be played whenautoplay
is set totrue
.- Default:
undefined
- Type:
string
- Default:
stateMachineName
(optional) - Specifies which stateMachine should be played whenautoplay
is set totrue
.- Default:
undefined
- Type:
string
- Default:
testID
(optional) - Specifies testID which could be handy in tests.- Default:
undefined
- Type:
string
- Default:
onPlay
(optional) - Callback function that is called when animation or stateMachine has been started.- Type:
(animationName: string, isStateMachine: boolean) => void
- Type:
onPause
(optional) - Callback function that is called when animation or stateMachine has been paused.- Type:
(animationName: string, isStateMachine: boolean) => void
- Type:
onStop
(optional) - Callback function that is called when animation or stateMachine has been stopped.- Type:
(animationName: string, isStateMachine: boolean) => void
- Type:
onLoopEnd
(optional) - Callback function that is called when animation loop has been ended. Note: This callback is only invoked if playing individual animations via theanimationName
prop, and does not get invoked if playing a state machine via thestateMachineName
prop.- Type:
(animationName: string, loopMode: LoopMode) => void
- Type:
onStateChanged
(optional) - Callback function that is called when the internal animation state has been changed. It’s tightly coupled with state machines feature.- Type:
(stateMachineName: string, stateName: string) => void
- Type:
onError
(optional) - Callback function that is called when error is thrown. Allows manual handling of thrown errors that are described byRNRiveError
.- Type:
(riveError: RNRiveError) => void
- Type:
onRiveEventReceived
(optional) - Callback function that is called when the render loop reports a Rive Event.- Type:
(event: RiveGeneralEvent | RiveOpenUrlEvent) => void
- Type:
Was this page helpful?