How to use the rax.PropTypes.number 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 / components / rax-navigation / src / PropTypes.js View on Github external
/* NavigationAction */
const action = PropTypes.shape({
  type: PropTypes.string.isRequired,
});

/* NavigationAnimatedValue  */
const animatedValue = PropTypes.instanceOf(Animated.Value);

/* NavigationRoute  */
const navigationRoute = PropTypes.shape({
  key: PropTypes.string.isRequired,
});

/* NavigationState  */
const navigationState = PropTypes.shape({
  index: PropTypes.number.isRequired,
  routes: PropTypes.arrayOf(navigationRoute),
});

/* NavigationLayout */
const layout = PropTypes.shape({
  height: animatedValue,
  initHeight: PropTypes.number.isRequired,
  initWidth: PropTypes.number.isRequired,
  isMeasured: PropTypes.bool.isRequired,
  width: animatedValue,
});

/* NavigationScene */
const scene = PropTypes.shape({
  index: PropTypes.number.isRequired,
  isActive: PropTypes.bool.isRequired,
github alibaba / rax / packages / rax-tab-panel / src / TabPanelView.js View on Github external
/** @jsx createElement */

'use strict';

import {createElement, Component, PropTypes} from 'rax';
import View from 'rax-view';
import {Event as Emitter} from './Utils';
import Detection from './Detection';


class TabPanelView extends Component {
  isPanning = false;

  static contextTypes = {
    isInATabPanel: PropTypes.bool,
    uuid: PropTypes.number
  };

  render() {
    let props = {
      ...this.props,
      preventMoveEvent: true,
      onClick: this.onCellClick
    };
    if (Detection.isEnableSliderAndroid && this.context.isInATabPanel) {
      props.onHorizontalPan = this.onHorizontalPan;
    }

    return (
github alibaba / rax / components / rax-calendar / src / index.js View on Github external
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(),
    weekStart: 1,
  };
github alibaba / rax / packages / rax-charts / src / charts / Chart.js View on Github external
import AreaStack from './AreaStack';

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;
github alibaba / rax / packages / rax-charts / src / charts / Chart.js View on Github external
import IntervalStack from './IntervalStack';
import AreaStack from './AreaStack';

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;
github alibaba / rax / packages / rax-theme-lst / templates / default / pages / index / mods / wrap.js View on Github external
onTouchEnd={this.webRefresh}
        ref={(ref) => {
          this.recyclerView = ref;
        }}
        >
        
        {children}
      
    );
  }

}

FloorWrapper.propTypes = {
  onEndReached: T.func,
  onEndReachedThreshold: T.number,
  style: T.object,
  children: T.node
};

FloorWrapper.Top = function Top() {
  return null;
};
FloorWrapper.Bottom = function Bottom() {
  return null;
};
FloorWrapper.Header = function Header() {
  return null;
};
github alibaba / rax / packages / rax-charts / src / geom / Style.js View on Github external
*   fillOpacity: 1
   * },
   * hollowArea: {
   *   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;
github alibaba / rax / packages / rax-calendar / src / Calendar.js View on Github external
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',
    today: moment(),
    weekStart: 1,
github alibaba / rax / packages / rax-charts / src / geom / Style.js View on Github external
* hollowArea: {
   *   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-console / src / ObjectPreview.js View on Github external
return (
      <span style="{styles.preview}">
        {`${object.constructor.name} {`}
        {intersperse(propertyNodes, ', ')}
        {'}'}
      </span>
    );
  }
};

ObjectPreview.propTypes = {
  /**
   * max number of properties shown in the property view
   */
  maxProperties: PropTypes.number,
};
ObjectPreview.defaultProps = {
  maxProperties: 5,
};

export default ObjectPreview;