How to use the prop-types.number.isRequired function in prop-types

To help you get started, we’ve selected a few prop-types 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 sharetribe / ftw-daily / src / util / types.js View on Github external
ERROR_CODE_EMAIL_TAKEN,
  ERROR_CODE_EMAIL_NOT_FOUND,
  ERROR_CODE_TOO_MANY_VERIFICATION_REQUESTS,
  ERROR_CODE_UPLOAD_OVER_LIMIT,
  ERROR_CODE_VALIDATION_INVALID_PARAMS,
  ERROR_CODE_VALIDATION_INVALID_VALUE,
  ERROR_CODE_NOT_FOUND,
  ERROR_CODE_FORBIDDEN,
  ERROR_CODE_MISSING_STRIPE_ACCOUNT,
];

// API error
// TODO this is likely to change soonish
propTypes.apiError = shape({
  id: propTypes.uuid.isRequired,
  status: number.isRequired,
  code: oneOf(ERROR_CODES).isRequired,
  title: string.isRequired,
  meta: object,
});

// Storable error prop type. (Error object should not be stored as it is.)
propTypes.error = shape({
  type: propTypes.value('error').isRequired,
  name: string.isRequired,
  message: string,
  status: number,
  statusText: string,
  apiErrors: arrayOf(propTypes.apiError),
});

// Options for showing just date or date and time on BookingTimeInfo and BookingBreakdown
github yTakkar / React-Instagram-Clone-2.0 / src / components / post / tags / tag-list / untag.js View on Github external
let untagUser = async e => {
    e.preventDefault()
    await post('/api/untag', { user, post: post_id })
    dispatch(untag(user))
    decrementTags()
    Notify({ value: 'Untagged!!' })
  }

  let btnLabel = `Untag ${isAdmin() ? 'as admin' : ''}`

  return 
}

Untag.propTypes = {
  post_id: number.isRequired,
  user: number.isRequired,
  decrementTags: func.isRequired,
}

export default connect()(Untag)
export { Untag as PureUntag }
github watson-developer-cloud / discovery-nodejs / src / TopEntities / index.jsx View on Github external
export default class TopEntities extends Component {
  static widgetTitle() {
    return 'Top Entities';
  }

  static widgetDescription() {
    return 'Discovery can easily extract frequently mentioned entities - such as people, topics and companies - from the set of articles.';
  }

  static propTypes = {
    entities: shape({
      topics: arrayOf(
        shape({
          key: string.isRequired,
          matching_results: number.isRequired,
        })
      ).isRequired,
      companies: arrayOf(
        shape({
          key: string.isRequired,
          matching_results: number.isRequired,
        })
      ).isRequired,
      people: arrayOf(
        shape({
          key: string.isRequired,
          matching_results: number.isRequired,
        })
      ).isRequired,
    }).isRequired,
    query: shape({
github bbc / psammead / packages / components / psammead-brand / src / index.jsx View on Github external
{svg.group}
        
        
      
    )}
  
);

const brandProps = {
  product: string.isRequired,
  serviceLocalisedName: string,
  maxWidth: number.isRequired,
  minWidth: number.isRequired,
  svgHeight: number.isRequired,
  svg: shape({
    group: node.isRequired,
    ratio: number.isRequired,
    viewbox: shape({
      height: number.isRequired,
      width: number.isRequired,
    }).isRequired,
  }).isRequired,
  backgroundColour: string.isRequired,
  logoColour: string.isRequired,
};

StyledBrand.propTypes = brandProps;

StyledBrand.defaultProps = {
github open-apparel-registry / open-apparel-registry / src / app / src / util / propTypes.js View on Github external
status: oneOf(Object.values(facilityListItemStatusChoicesEnum)).isRequired,
    processing_started_at: string,
    processing_completed_at: string,
    name: string.isRequired,
    address: string.isRequired,
    country_code: string.isRequired,
    country_name: string.isRequired,
    geocoded_point: string,
    geocoded_address: string,
    facility_list: number.isRequired,
    processing_errors: arrayOf(string.isRequired),
    matched_facility: shape({
        oar_id: string.isRequired,
        address: string.isRequired,
        name: string.isRequired,
        created_from_id: number.isRequired,
        location: shape({
            lng: number.isRequired,
            lat: number.isRequired,
        }).isRequired,
    }),
    matches: arrayOf(shape({
        id: number.isRequired,
        oar_id: string.isRequired,
        address: string.isRequired,
        name: string.isRequired,
        location: shape({
            lng: number.isRequired,
            lat: number.isRequired,
        }).isRequired,
    }).isRequired),
});
github azavea / tilejson.io / src / app / js / src / LayerBox.jsx View on Github external
{details}
                {source}
            
        );
    }
}

LayerBox.propTypes = {
    dispatch: func.isRequired,
    layerName: string.isRequired,
    layerUrl: string.isRequired,
    i: number.isRequired,
    viewDetail: bool.isRequired,
    layerTileJSON: shape({}).isRequired,
    removeLayer: func.isRequired,
    opacity: number.isRequired,
    changeOpacity: func.isRequired,
    visible: bool.isRequired,
    toggleVisibility: func.isRequired,
};

function mapStateToProps(state) {
    return state.main;
}

export default connect(mapStateToProps)(LayerBox);
github skbkontur / retail-ui / packages / retail-ui / components / Paging / Paging.tsx View on Github external
document.removeEventListener('keydown', this.handleKeyDown);

      this.addedGlobalListener = false;
    }
  };

  private refContainer = (element: HTMLSpanElement | null) => {
    this.container = element;
  };
}

Paging.propTypes = {
  /**
   * Current active page
   */
  activePage: number.isRequired,

  /**
   * React component that would be used for rendering items
   *
   * Usefull for router integration
   */
  component: func,

  /**
   * Total page count
   */
  pagesCount: number.isRequired,

  /**
   * Calls when page has been changed
   */
github ansible / awx / awx / ui_next / src / components / NotificationList / NotificationListItem.jsx View on Github external
onChange={() =>
                  toggleNotification(notification.id, errorTurnedOn, 'error')
                }
                aria-label={i18n._(t`Toggle notification failure`)}
              />
            ,
          ]}
        />
      
    
  );
}

NotificationListItem.propTypes = {
  notification: shape({
    id: number.isRequired,
    name: string.isRequired,
    notification_type: string.isRequired,
  }).isRequired,
  canToggleNotifications: bool.isRequired,
  detailUrl: string.isRequired,
  errorTurnedOn: bool,
  startedTurnedOn: bool,
  successTurnedOn: bool,
  toggleNotification: func.isRequired,
  typeLabels: shape().isRequired,
};

NotificationListItem.defaultProps = {
  errorTurnedOn: false,
  startedTurnedOn: false,
  successTurnedOn: false,
github AndreMiras / etheroll / src / components / ContractInfo.jsx View on Github external
return (
    <div>
      {accountBalanceBlock}
      {accountAddressBlock}
      {contractBalanceBlock}
      {contractAddressBlock}
    </div>
  );
}
ContractInfo.propTypes = {
  accountAddress: string,
  accountBalance: number.isRequired,
  contractAddress: string.isRequired,
  contractBalance: number.isRequired,
  network: number.isRequired,
};
ContractInfo.defaultProps = {
  accountAddress: null,
};

export default ContractInfo;
github divyanshu013 / blog / src / components / BlogInfo.jsx View on Github external
const { theme } = useContext(ThemeContext);
	const { muted } = getTheme(theme);
	return (
		<div muted="">
			<small>
				{date} • {timeToRead} min read
			</small>
			{Array.from({ length: timeToRead / 7 + 1 }).map((item, index) =&gt; (
				
			))}
		</div>
	);
};

BlogInfo.propTypes = {
	timeToRead: number.isRequired,
	date: string.isRequired,
};

export default BlogInfo;