Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
autoScaling: true,
autoWebp: true,
ignoreGif: true,
autoCompress: true,
highQuality: true,
compressSuffix: ['Q75', 'Q50'],
defaultHeight: '750rem',
lazyload: false,
autoPixelRatio: true
};
static propTypes = {
style: PropTypes.object,
source: PropTypes.object.isRequired,
resizeMode: PropTypes.oneOf([
'contain',
'cover',
'stretch'
]),
width: PropTypes.string, // width of picture
height: PropTypes.string, // height of picture
defaultHeight: PropTypes.string, // default height when the height setting fails
autoRemoveScheme: PropTypes.bool,
autoReplaceDomain: PropTypes.bool,
autoScaling: PropTypes.bool,
autoWebp: PropTypes.bool,
autoCompress: PropTypes.bool,
highQuality: PropTypes.bool,
compressSuffix: PropTypes.array,
import {createElement, Component, PropTypes} from 'rax';
import Image from 'rax-image';
class Picture extends Component {
static defaultProps = {
source: {
uri: ''
},
defaultHeight: 750
};
static propTypes = {
style: PropTypes.object,
source: PropTypes.object.isRequired,
resizeMode: PropTypes.oneOf([
'contain',
'cover',
'stretch'
]),
width: PropTypes.string, // width of picture
height: PropTypes.string, // height of picture
defaultHeight: PropTypes.string, // default height when the height setting fails
forceUpdate: PropTypes.bool
};
shouldComponentUpdate(nextProps) {
if (this.props.forceUpdate || this.props.children) {
return true;
}
import {createElement, Component, PropTypes} from 'rax';
export default class Shape extends Component {
static type = 'shape';
static propTypes = {
dim: PropTypes.string,
shapes: PropTypes.oneOf(['string', 'array', 'func']),
};
constructor(props) {
super(props);
return this.draw();
}
draw = () => {
let {chart, dim, shapes} = this.props;
if (dim && !shapes) {
chart = chart.shape(dim);
} else if (!dim && shapes) {
chart = chart.shape(shapes);
} else if (dim && shapes) {
chart = chart.shape(dim, shapes);
}
import {createElement, Component, PropTypes} from 'rax';
export default class Color extends Component {
static propTypes = {
dim: PropTypes.string,
colors: PropTypes.oneOf(['array', 'func']),
};
constructor(props) {
super(props);
return this.draw();
}
draw = () => {
let {chart, dim, colors} = this.props;
if (dim && !colors) {
chart = chart.color(dim);
} else if (!dim && colors) {
chart = chart.color(colors);
} else if (dim && colors) {
chart = chart.color(dim, colors);
import {createElement, Component, PropTypes} from 'rax';
import isFunction from '../utils/isFunction';
import isNumber from '../utils/isNumber';
export default class Size extends Component {
static type='size';
static propTypes = {
dim: PropTypes.string,
value: PropTypes.oneOf(['number', 'func'])
};
constructor(props) {
super(props);
return this.draw();
}
draw = () => {
let {chart, dim, value} = this.props;
if (dim && !value) {
chart = chart.size(dim);
} else if (!dim && value && isNumber(value)) {
chart = chart.size(value);
} else if (dim && value && isFunction(value)) {
chart = chart.size(dim, value);
}
static propTypes = {
/**
* Custom style applied to the card.
*/
cardStyle: PropTypes.any,
/**
* Style of the stack header. `float` means the header persists and is shared
* for all screens. When set to `screen`, each header is rendered within the
* card, and will animate in together.
*
* The default for `modal` mode is `screen`, and the default for `card` mode
* is `screen` on Android and `float` on iOS.
*/
headerMode: PropTypes.oneOf(['float', 'screen', 'none']),
/**
* Custom React component to be used as a header
*/
headerComponent: PropTypes.func,
/**
* Style of the cards movement. Value could be `card` or `modal`.
* Default value is `card`.
*/
mode: PropTypes.oneOf(['card', 'modal']),
/**
* The distance from the edge of the card which gesture response can start
* for. Default value is `30`.
*/
*
* The default for `modal` mode is `screen`, and the default for `card` mode
* is `screen` on Android and `float` on iOS.
*/
headerMode: PropTypes.oneOf(['float', 'screen', 'none']),
/**
* Custom React component to be used as a header
*/
headerComponent: PropTypes.func,
/**
* Style of the cards movement. Value could be `card` or `modal`.
* Default value is `card`.
*/
mode: PropTypes.oneOf(['card', 'modal']),
/**
* The distance from the edge of the card which gesture response can start
* for. Default value is `30`.
*/
gestureResponseDistance: PropTypes.number,
/**
* Optional custom animation when transitioning between screens.
*/
transitionConfig: PropTypes.func,
/**
* The navigation prop, including the state and the dispatcher for the back
* action. The dispatcher must handle the back action
* ({ type: NavigationActions.BACK }), and the navigation state has this shape: