How to use the rax.PropTypes.bool 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-link / src / index.js View on Github external
import {Component, createElement, PropTypes} from 'rax';
import {isWeex} from 'universal-env';
import Text from 'rax-text';

class Link extends Component {
  static contextTypes = {
    isInAParentLink: PropTypes.bool,
    isInAParentText: PropTypes.bool
  };

  static childContextTypes = {
    isInAParentLink: PropTypes.bool
  };

  getChildContext() {
    return {
      isInAParentLink: true
    };
  }

  render() {
    // https://www.w3.org/TR/html4/struct/links.html#h-12.2.2
    if (this.context.isInAParentLink) {
      return console.error('Nested links are illegal');
github alibaba / rax / components / rax-picture / src / picture.web.js View on Github external
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
  };

  state = {
    visible: false
  };

  uri = '';

  newStyle = {};

  componentWillUpdate(nextProps) {
    if (this.props.source.uri !== nextProps.source.uri) {
      this.uri = '';
    }
github alibaba / rax / components / rax-link / src / index.js View on Github external
import {Component, createElement, PropTypes} from 'rax';
import {isWeex} from 'universal-env';
import Text from 'rax-text';

class Link extends Component {
  static contextTypes = {
    isInAParentLink: PropTypes.bool,
    isInAParentText: PropTypes.bool
  };

  static childContextTypes = {
    isInAParentLink: PropTypes.bool
  };

  getChildContext() {
    return {
      isInAParentLink: true
    };
  }

  render() {
    // https://www.w3.org/TR/html4/struct/links.html#h-12.2.2
    if (this.context.isInAParentLink) {
github alibaba / rax / templates / template-retail / templates / default / pages / index / components / OfferList / index.js View on Github external
import { PropTypes, Component, createElement } from 'rax';
import { View, Text, RecyclerView, Image } from 'rax-components';
import Cell from '../OfferCell';
import style from './style';

export default class OfferList extends Component {
  static propsTypes = {
    sourceData: PropTypes.array,
    cellStyle: PropTypes.object,
    style: PropTypes.object,
    hasMoreOffer: PropTypes.bool
  }

  static defaultProps = {
    sourceData: [],
    hasMoreOffer: true
  }

  getRowCell(sourceData) {
    let rows = [];
    for (let i = 0; i < sourceData.length; i += 2) {
      let offerOdd = sourceData[i];
      offerOdd.offerDetailUrl = offerOdd.offerDetailUrl;

      let offerEven = sourceData[i + 1];
      offerEven.offerDetailUrl = offerEven.offerDetailUrl;
      // 第一排cell不能有上边框
github alibaba / rax / examples / uikit / Button.js View on Github external
title: PropTypes.string,
  onPress: PropTypes.any,
  icon: PropTypes.object,
  secondary: PropTypes.bool,
  secondary2: PropTypes.bool,
  secondary3: PropTypes.bool,
  primary1: PropTypes.bool,
  primary2: PropTypes.bool,
  primary3: PropTypes.bool,
  backgroundColor: PropTypes.string,
  color: PropTypes.string,
  fontSize: PropTypes.number,
  underlayColor: PropTypes.string,
  raised: PropTypes.bool,
  textStyle: PropTypes.any,
  disabled: PropTypes.bool,
  loading: PropTypes.bool,
  activityIndicatorStyle: PropTypes.any,
  loadingRight: PropTypes.bool
};

const styles = StyleSheet.create({
  button: {
    padding: 19 * 2,
    marginLeft: 15 * 2,
    marginRight: 15 * 2,
    backgroundColor: colors.primary,
    justifyContent: 'center',
    alignItems: 'center',
    flexDirection: 'row'
  },
  text: {
github alibaba / rax / components / rax-console / src / ObjectName.js View on Github external
...dimmed ? themeStyles.dimmed : {},
    ...styles,
  };

  return (
    <span style="{appliedStyles}">
      {name}
    </span>
  );
};

ObjectName.propTypes = {
  /** Property name */
  name: PropTypes.string,
  /** Should property name be dimmed */
  dimmed: PropTypes.bool,
};

ObjectName.defaultProps = {
  dimmed: false,
};

export default ObjectName;
github alibaba / rax / examples / uikit / Button.js View on Github external
Button.propTypes = {
  buttonStyle: PropTypes.any,
  title: PropTypes.string,
  onPress: PropTypes.any,
  icon: PropTypes.object,
  secondary: PropTypes.bool,
  secondary2: PropTypes.bool,
  secondary3: PropTypes.bool,
  primary1: PropTypes.bool,
  primary2: PropTypes.bool,
  primary3: PropTypes.bool,
  backgroundColor: PropTypes.string,
  color: PropTypes.string,
  fontSize: PropTypes.number,
  underlayColor: PropTypes.string,
  raised: PropTypes.bool,
  textStyle: PropTypes.any,
  disabled: PropTypes.bool,
  loading: PropTypes.bool,
  activityIndicatorStyle: PropTypes.any,
  loadingRight: PropTypes.bool
};

const styles = StyleSheet.create({
  button: {
    padding: 19 * 2,
    marginLeft: 15 * 2,
    marginRight: 15 * 2,
    backgroundColor: colors.primary,
    justifyContent: 'center',
    alignItems: 'center',
    flexDirection: 'row'
github alibaba / rax / components / rax-console / src / TreeNode.js View on Github external
<ol style="{styles.treeNodeChildNodesContainer}" role="group">
          {childNodes}
        </ol>
      
    );
  }
}

TreeNode.propTypes = {
  name: PropTypes.string,
  data: PropTypes.any,
  expanded: PropTypes.bool,
  shouldShowArrow: PropTypes.bool,
  shouldShowPlaceholder: PropTypes.bool,
  nodeRenderer: PropTypes.func,
  onClick: PropTypes.func,
};

TreeNode.defaultProps = {
  name: undefined,
  data: undefined,
  expanded: true,

  nodeRenderer: ({ name }) =&gt;
    <span>
      {name}
    </span>,

  onClick: () =&gt; {},
github alibaba / rax / components / rax-calendar / src / index.js View on Github external
};

  static propTypes = {
    customStyle: PropTypes.object,
    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',
github alibaba / rax / components / rax-console / src / TreeNode.js View on Github external
{renderedNode}
        

        <ol style="{styles.treeNodeChildNodesContainer}" role="group">
          {childNodes}
        </ol>
      
    );
  }
}

TreeNode.propTypes = {
  name: PropTypes.string,
  data: PropTypes.any,
  expanded: PropTypes.bool,
  shouldShowArrow: PropTypes.bool,
  shouldShowPlaceholder: PropTypes.bool,
  nodeRenderer: PropTypes.func,
  onClick: PropTypes.func,
};

TreeNode.defaultProps = {
  name: undefined,
  data: undefined,
  expanded: true,

  nodeRenderer: ({ name }) =&gt;
    <span>
      {name}
    </span>,

  onClick: () =&gt; {},