react-native-ios-utilities
Version:
Utilities for react-native + iOS
52 lines • 1.4 kB
JavaScript
import * as React from 'react';
import { RNIImageNativeView } from './RNIImagNativeView';
export class RNIImageView extends React.PureComponent {
nativeRef;
reactTag;
constructor(props) {
super(props);
}
;
getProps() {
const { imageConfig, preferredSymbolConfiguration, ...viewProps } = this.props;
return {
nativeProps: {
imageConfig,
preferredSymbolConfiguration,
},
viewProps,
};
}
;
getNativeRef = () => {
return this.nativeRef;
};
getNativeReactTag = () => {
// @ts-ignore
return this.nativeRef?.nativeTag ?? this.reactTag;
};
_handleOnLayout = (event) => {
this.props.onLayout?.(event);
// @ts-ignore
this.reactTag = event.nativeEvent.target;
};
_handleOnNativeRef = (ref) => {
this.nativeRef = ref;
};
render() {
const props = this.getProps();
const didSetReactTag = this.reactTag != null;
return React.createElement(RNIImageNativeView, {
...props.viewProps,
...props.nativeProps,
// @ts-ignore
ref: this._handleOnNativeRef,
onLayout: (didSetReactTag
? undefined
: this._handleOnLayout),
});
}
;
}
;
//# sourceMappingURL=RNIImageView.js.map