| 50 | } |
| 51 | |
| 52 | createTransformedProps(props) { |
| 53 | let transformedProps = { ...props }; |
| 54 | const { source, defaultSource } = props; |
| 55 | |
| 56 | // defaultSource is not supported on Android, so we manually |
| 57 | // reassign the defaultSource prop to source if source is not defined |
| 58 | if (Platform.OS === 'android' && !isValidSource(source)) { |
| 59 | // Image views are not rendered on Android if there is no image to display, |
| 60 | // so we fallback to a transparent image to be compatible with iOS |
| 61 | transformedProps.source = defaultSource || fallbackImage; |
| 62 | // Fixes a bug with local image resizing on Android: |
| 63 | // https://github.com/facebook/react-native/issues/4598#issuecomment-162328501 |
| 64 | transformedProps.style = { width: null, height: null, ...props.style }; |
| 65 | } |
| 66 | |
| 67 | transformedProps.ref = this.captureNativeComponentRef; |
| 68 | if (externalPropsTransformer) { |
| 69 | transformedProps = externalPropsTransformer(transformedProps); |
| 70 | } |
| 71 | |
| 72 | return transformedProps; |
| 73 | } |
| 74 | |
| 75 | captureNativeComponentRef(component) { |
| 76 | this.nativeComponent = component; |