- Welcome
- Getting started
- Foundations
-
Components
- Accordion
- Alert
- Alignment
- Aria Live
- Autosuggest
- Badge
- Banner Alert
- Bar Chart
- Blockquote
- Bottom Navigation
- Bottom Sheet
- Breadcrumb
- Breakpoint
- Button
- Calendar
- Card
- Card Button
- Carousel
- Checkbox
- Chip
- Code
- Content Cards
- Data Table
- Datepicker
- Description List
- Dialog
- Divider
- Drawer
- Field Set
- Flare
- Flat List
- Flight Leg
- Floating Action Button
- Floating Notification
- Form Label
- Form Validation
- Graphic Promotion
- Horizontal Navigation
- Icon
- Image
- Infinite Scroll
- Link
- List
- Map
- Mobile Scroll Container
- Modal
- Navigation Bar
- Nudger
- Overlay
- Page Indicator
- Pagination
- Panel
- Phone Input
- Picker
- Popover
- Price
- Progress Bar
- Radio Button
- Rating
- Scrollable Calendar
- Section List
- Select
- Skeleton
- Skip Link
- Slider
- Snackbar
- Spinner
- Split Input
- Star Rating
- Switch
- Table
- Text
- Text Input
- Theming
- Ticket
- Toast
- Tooltip
- Touchable Native Feedback
- Touchable Overlay
- Content
- Accessibility
Image
A component for including images.
bpk-component-image
Backpack React Native image component.
Default
Day | Night |
---|---|
![]() |
![]() |
![]() |
![]() |
No border radius
Day | Night |
---|---|
![]() |
![]() |
![]() |
![]() |
Installation
Check the main Readme for a complete installation guide.
Usage
Default
import React, { Component } from 'react';
import { StyleSheet, View } from 'react-native';
import { spacingBase, spacingLg } from '@skyscanner/bpk-foundations-react-native/tokens/base.react.native';
import BpkImage from 'backpack-react-native/bpk-component-image';
const styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: 'center',
padding: spacingBase,
},
image: {
width: '100%',
height: spacingLg * 10,
},
});
export default () => (
<View style={styles.container}>
<BpkImage style={styles.image} alt="image title" source={{uri: "imageUri"}} />
</View>
);
With Loading Behaviour
import React, { Component } from 'react';
import { StyleSheet, View } from 'react-native';
import { spacingBase, spacingLg } from '@skyscanner/bpk-foundations-react-native/tokens/base.react.native';
import BpkImage, { withLoadingBehaviour } from 'backpack-react-native/bpk-component-image';
const BpkImageWithLoading = withLoadingBehaviour(BpkImage);
const styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: 'center',
padding: spacingBase,
},
image: {
width: '100%',
height: spacingLg * 10,
},
});
export default () => (
<View style={styles.container}>
<BpkImageWithLoading style={styles.image} alt="image title" source={{uri: "imageUri"}} />
</View>
);
Props
BpkImage
Property | PropType | Required | Default Value |
---|---|---|---|
source | oneOf(number, object, arrayOf(object)) | true | - |
imageComponent | function | false | Animated.Image |
inView | boolean | false | true |
loaded | boolean | false | true |
onLoad | function | false | null |
rounded | boolean | false | true |
style | style | false | null |
Made with ❤️ by Skyscanner © 2023
© 2023 Skyscanner Backpack. Page last updated on Oct 28, 2022, 16:03