mirror of
https://github.com/zoriya/react-native-svg.git
synced 2026-05-23 11:16:42 +00:00
To allow only data URI as iOS does not support async image loading
This commit is contained in:
+9
-5
@@ -18,11 +18,15 @@ class Image extends Shape {
|
||||
height: numberProp.isRequired,
|
||||
href: PropTypes.oneOfType([
|
||||
PropTypes.number,
|
||||
PropTypes.shape({
|
||||
uri: PropTypes.string.isRequired,
|
||||
width: PropTypes.number.isRequired,
|
||||
height: PropTypes.number.isRequired
|
||||
})
|
||||
function(props, propName, componentName) {
|
||||
if (Object.keys(props[propName]).length != 1 ||
|
||||
!/^\s*data:([a-z]+\/[a-z]+(;[a-z\-]+\=[a-z\-]+)?)?(;base64)?,[a-z0-9\!\$\&\'\,\(\)\*\+\,\;\=\-\.\_\~\:\@\/\?\%\s]*\s*$/i.test(props[propName].uri)) {
|
||||
return new Error(
|
||||
'Invalid prop `' + propName + '` supplied to' +
|
||||
' `' + componentName + '`. Validation failed.'
|
||||
);
|
||||
}
|
||||
}
|
||||
]).isRequired,
|
||||
preserveAspectRatio: PropTypes.string
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user