@ramses-superapp/ramses-ui
Version:
Skinless UI primitives for Ramses Built Apps
40 lines (39 loc) • 854 B
JavaScript
;
import { forwardRef } from 'react';
import { Image, View } from 'react-native';
import { jsx as _jsx } from "react/jsx-runtime";
function normalizeSource(source) {
if (typeof source === 'string') {
return {
uri: source
};
}
return source;
}
const RsImage = /*#__PURE__*/forwardRef(({
source,
resizeMode,
style,
alt,
onLoad,
onError
}, ref) => {
return /*#__PURE__*/_jsx(View, {
ref: ref,
style: style,
children: /*#__PURE__*/_jsx(Image, {
source: normalizeSource(source),
resizeMode: resizeMode,
accessibilityLabel: alt,
onLoad: onLoad,
onError: onError ? () => onError() : undefined,
style: {
width: '100%',
height: '100%'
}
})
});
});
RsImage.displayName = 'RsImage';
export default RsImage;
//# sourceMappingURL=RsImage.js.map