Loading images
Let's get started by figuring out how to load images. You can render the <Image> component and pass its properties just like any other React component. But this particular component needs image blob data to be of any use. Let's look at some code:
export default function App({ reactSource, relaySource }) {
return (
<View style={styles.container}>
<Image style={styles.image} source={reactSource} />
<Image style={styles.image} source={relaySource} />
</View>
);
}
const sourceProp = PropTypes.oneOfType([
PropTypes.shape({
uri: PropTypes.string.isRequired,
}),
PropTypes.number,
]).isRequired;
App.propTypes = {
reactSource: sourceProp,
relaySource: sourceProp,
};
App.defaultProps = {
reactSource...