How to use the rax.PropTypes.string function in rax

To help you get started, we’ve selected a few rax examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github alibaba / rax / packages / rax-picture / src / picture.weex.js View on Github external
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;
    }

    return this.props.source.uri !== nextProps.source.uri;
  }

  render() {
    let {
      children,
github alibaba / rax / components / rax-picture / src / picture.web.js View on Github external
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,

    lazyload: PropTypes.bool,
    placeholder: PropTypes.string,
    autoPixelRatio: PropTypes.bool,
    forceUpdate: PropTypes.bool,
    ignoreGif: PropTypes.bool
github alibaba / rax / templates / template-retail / templates / default / pages / index / components / Canopy / index.js View on Github external
const CANOPY_IMAGE_URL = 'https://cbu01.alicdn.com/cms/upload/2017/972/092/3290279_2093810242.png';
const SCAN_IMAGE_URL = 'https://cbu01.alicdn.com/cms/upload/2017/533/092/3290335_2093810242.png';
const MESSAGE_IMAGE_URL = 'https://cbu01.alicdn.com/cms/upload/2017/982/192/3291289_2093810242.png';
const SEARCH_IMAGE_URL = 'https://cbu01.alicdn.com/cms/upload/2017/294/133/3331492_2093810242.png';

const noop = () => {};

class Canopy extends PureComponent {
  static propTypes = {
    onScan: T.func,
    onMessage: T.func,
    onSearch: T.func,
    messageNum: T.number, // '99+' maybe
    searchKeyword: T.string,
    searchPlaceholder: T.string
  }

  static defaultProps = {
    onScan: noop,
    onMessage: noop,
    onSearch: noop,
    messageNum: 0
  }

  renderPlaceholder() {
    const { searchKeyword, searchPlaceholder } = this.props;
    if (searchKeyword) {
      return ;
    } else if (searchPlaceholder) {
      return ;
    }
github alibaba / rax / packages / rax-countdown / src / index.js View on Github external
;
};

class Index extends Component {
  state = {
    timeRemaining: 0
  };

  timeoutId = 0;

  static propTypes = {
    formatFunc: PropTypes.func,
    onTick: PropTypes.func,
    onComplete: PropTypes.func,
    tpl: PropTypes.string, // template (example {h}:{m}:{s})
    timeRemaining: PropTypes.number,
    secondStyle: PropTypes.object,
    timeStyle: PropTypes.object, // style for num
    textStyle: PropTypes.object, // style for text
    timeWrapStyle: PropTypes.object,
    timeBackground: PropTypes.string,
    timeBackgroundStyle: PropTypes.object,
    interval: PropTypes.number
  };

  static defaultProps = {
    tpl: '{d}天{h}时{m}分{s}秒',
    timeRemaining: 0,
    interval: 1000
  };
github alibaba / rax / packages / rax-picture / src / picture.weex.js View on Github external
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;
    }

    return this.props.source.uri !== nextProps.source.uri;
  }

  render() {
    let {
github alibaba / rax / packages / rax-charts / src / charts / Chart.js View on Github external
import isArray from '../utils/isArray';
import isFunction from '../utils/isFunction';

let WeexGM = null;
const WEEX_ID = 'taobao-fed-rax-chart-weex-id';

if (isWeex) {
  WeexGM = require('./weexGM');
}

class Chart extends Component {
  static propTypes = {
    height: PropTypes.number.isRequired,
    width: PropTypes.number.isRequired,
    id: PropTypes.string.isRequired,
    backgroundColor: PropTypes.string,
    draw: PropTypes.func,
    margin: PropTypes.array,
  };

  static defaultProps = {};

  constructor(props) {
    super(props);
    this.chart = null;
    /**
     * global defs animate must only one
     */
    this.globalChildren = null;
    this.defsChildren = null;
    this.axisChildren = [];
github alibaba / rax / packages / rax-calendar / src / Calendar.js View on Github external
eventDates: PropTypes.array,
    monthNames: PropTypes.array,
    nextButtonText: PropTypes.string,
    onDateSelect: PropTypes.func,
    onSwipeNext: PropTypes.func,
    onSwipePrev: PropTypes.func,
    onTouchNext: PropTypes.func,
    onTouchPrev: PropTypes.func,
    prevButtonText: PropTypes.string,
    scrollEnabled: PropTypes.bool,
    selectedDate: PropTypes.any,
    showControls: PropTypes.bool,
    startDate: PropTypes.any,
    endDate: PropTypes.any,
    titleFormat: PropTypes.string,
    dateFormat: PropTypes.string,
    today: PropTypes.any,
    weekStart: PropTypes.number,
  };

  static defaultProps = {
    customStyle: {},
    dayHeadings: ['S', 'M', 'T', 'W', 'T', 'F', 'S'],
    eventDates: [],
    monthNames: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun',
      'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
    nextButtonText: 'Next',
    prevButtonText: 'Prev',
    scrollEnabled: false,
    showControls: true,
    titleFormat: 'MMMM YYYY',
    dateFormat: 'YYYY-MM-DD',
github alibaba / rax / packages / rax-charts / src / geom / Style.js View on Github external
*   fill: '#fff',
   *   stroke: '#999',
   *   fillOpacity: 0,
   *   lineWidth: 1
   * },
   * line: {
   *   stroke: '#999',
   *   lineWidth: 1,
   *   fill: null
   * }
   */
  static propTypes = {
    lineWidth: PropTypes.number,
    fill: PropTypes.string,
    radius: PropTypes.number,
    stroke: PropTypes.string,
    fillOpacity: PropTypes.number,
    strokeOpacity: PropTypes.number,
    opacity: PropTypes.number,
  };

  constructor(props) {
    super(props);
    return this.draw();
  }

  draw = () => {
    let {chart, ...item} = this.props;

    if (item && isObject(item)) {
      chart = chart.style(item);
    }
github alibaba / rax / components / rax-calendar / src / index.js View on Github external
dayHeadings: PropTypes.array,
    eventDates: PropTypes.array,
    monthNames: PropTypes.array,
    nextButtonText: PropTypes.string,
    onDateSelect: PropTypes.func,
    onSwipeNext: PropTypes.func,
    onSwipePrev: PropTypes.func,
    onTouchNext: PropTypes.func,
    onTouchPrev: PropTypes.func,
    prevButtonText: PropTypes.string,
    selectedDate: PropTypes.any,
    showControls: PropTypes.bool,
    startDate: PropTypes.any,
    endDate: PropTypes.any,
    titleFormat: PropTypes.string,
    dateFormat: PropTypes.string,
    today: PropTypes.any,
    weekStart: PropTypes.number,
  };

  static defaultProps = {
    customStyle: {},
    dayHeadings: ['S', 'M', 'T', 'W', 'T', 'F', 'S'],
    eventDates: [],
    monthNames: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun',
      'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
    nextButtonText: 'Next',
    prevButtonText: 'Prev',
    showControls: true,
    titleFormat: 'MMMM YYYY',
    dateFormat: 'YYYY-MM-DD',
    today: moment(),
github alibaba / rax / components / rax-navigation / src / views / HeaderBackButton.js View on Github external
type DefaultProps = {
  tintColor: ?string,
  truncatedTitle: ?string,
};

type State = {
  initialTextWidth?: number,
};

class HeaderBackButton extends PureComponent {
  static propTypes = {
    onPress: PropTypes.func.isRequired,
    title: PropTypes.string,
    tintColor: PropTypes.string,
    truncatedTitle: PropTypes.string,
    width: PropTypes.number,
  };

  static defaultProps = {
    tintColor: Platform.select({
      ios: '#037aff',
    }),
    truncatedTitle: 'Back',
  };

  state = {};

  _onTextLayout = (e) => {
    if (this.state.initialTextWidth) {
      return;
    }