Similar to the Facebook React Native Image component, but refers directly to a CYIImageView
C++ pointer.
Similar to Facebook React Native’s Image, a network URL can be specified using the URI key in the source property.
Unlike Facebook React Native’s Image, rather than using the required syntax to get local images, you must use the res
protocol with a path local to the assets folder.
For example, to refer to images in the Assets
folder, use the following:
<ImageRef name="MyImageLayer" source={{uri: "res://drawable/default/MyImage.png"}} />
.
Remember the following points when you use ImageRef
:
import React, { Component } from 'react';
import { Composition, ImageRef } from '@youi/react-native-youi';
export default class ImageRefComponent extends Component {
render() {
return (
<Composition source="RefComponents">
<ImageRef
name="Image-2x3"
source={{ uri: 'https://via.placeholder.com/720x405/fa8072?text=ImageRef' }}
onLoad={() => doSomething() } /* The uri defined in the source prop loaded and is now displaying. */
onCompositionDidLoad={(ref) => this.refToImage = ref } /* The parent Composition loaded and the ImageRef is now attached. */
/>
<Composition>
);
}
}
resizeMode: enum(‘cover’, ‘contain’, ‘stretch’, ‘repeat’, ‘center’)
onTimelinesLoaded: object (deprecated)
name
After Effects layer name
Type | Required |
---|---|
String | Yes |
style
Similar to style prop of Facebook React Native image component.
resizeMode
: Object.keys(ImageResizeMode)onLoad
Similar to onLoad prop of Facebook React Native image component.
onCompositionDidLoad
Invoked when the parent composition is loaded successfully and the Ref component gets attached to it.
onLoadEnd
Similar to onLoadEnd prop of Facebook React Native image component.
onLoadStart
Similar to onLoadStart prop of Facebook React Native image component.
resizeMode
Similar to resizeMode prop of Facebook React Native image component.
The following combinations in After Effects will result in the respective resizeMode value:
After Effects Properties | React Native Prop | REPEAT_MODE | SCALE_MODE | resizeMode |
---|---|---|---|---|
REPEAT_NONE | SCALE_ACTUAL_SIZE | center | ||
REPEAT_NONE | SCALE_FILL | cover | ||
REPEAT_NONE | SCALE_STRETCH | stretch | ||
REPEAT_NONE | SCALE_FIT | contain | ||
REPEAT_TILE | SCALE_ACTUAL_SIZE | repeat | ||
Not Specified | Not Specified | cover (as default) |
source
Similar to the source prop of Facebook React Native’s image component.
Source URI arrays containing multiple values are unsupported. When a source URI array with multiple values is provided, the first URI of the first entry is used.
A placeholder image is displayed in two situations:
The tintColor
, if defined, is also applied to the placeholder image.
onError
Similar to onError prop of Facebook React Native image component.
focusable
Determines whether the component should be focusable or not.
Default is true
.
Type | Required |
---|---|
bool | No |
visible
Determines whether the component should be visible or not.
Default is true
.
Note the following:
Type | Required |
---|---|
bool | No |
onTimelinesLoaded
Deprecated Invoked when all the timelines of the Composition or Ref component are loaded. Provides an object of names (strings) to Ref components.
Type | Required |
---|---|
object | No |
testID
Similar to testID prop of Facebook React Native image component.
tintColor
Similar to tintColor of Facebook React Native image style props.
accessible
When true
, this property indicates that the view is an accessibility element.
The default is false.
Type | Required |
---|---|
bool | No |
Similar to React Native’s accessible
property.
accessibilityLabel
The screen reader reads this string when a user selects the associated element. Setting a value for this prop allows users to know what element they’ve selected.
Type | Required |
---|---|
string | No |
Similar to React Native’s accessibilityLabel
property.