prop-types#func JavaScript Examples

The following examples show how to use prop-types#func. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: types.js    From supportal-frontend with MIT License 6 votes vote down vote up
AuthContextType = shape({
  answerCustomChallenge: func.isRequired,
  checkAuthentication: func.isRequired,
  getPublicChallengeParameters: func.isRequired,
  hasInitialized: bool.isRequired,
  isAuthenticated: bool.isRequired,
  profile: UserProfileType,
  signIn: func.isRequired,
  signOut: func.isRequired,
  user: object,
})
Example #2
Source File: SlideAnimation.js    From wix-style-react with MIT License 6 votes vote down vote up
SlideAnimation.propTypes = {
  isVisible: bool.isRequired,
  direction: oneOf([SlideDirection.in, SlideDirection.out]),
  animateAppear: bool,
  animateEnter: bool,
  animateLeave: bool,
  children: node,
  onEnter: func,
  onEntered: func,
  onExit: func,
  onExited: func,
};
Example #3
Source File: Functions.js    From elementz with GNU Affero General Public License v3.0 6 votes vote down vote up
export function debounce(func, wait) {
	let timeout;
	return function executedFunction(...args) {
	  const later = () => {	
		timeout = null;
		func(...args);
	  };
	  clearTimeout(timeout);
	  timeout = setTimeout(later, wait);
	};
}
Example #4
Source File: Calendar.js    From react-nice-dates with MIT License 6 votes vote down vote up
Calendar.propTypes = {
  locale: object.isRequired,
  minimumDate: instanceOf(Date),
  maximumDate: instanceOf(Date),
  modifiers: objectOf(func),
  modifiersClassNames: objectOf(string),
  month: instanceOf(Date),
  onMonthChange: func,
  onDayHover: func,
  onDayClick: func,
  weekdayFormat: string,
  touchDragEnabled: bool
}
Example #5
Source File: card.js    From what-front with MIT License 6 votes vote down vote up
Card.propTypes = {
  id: number.isRequired,
  title: string,
  date: string,
  buttonName: string,
  iconName: string,
  onDetails: func,
  onEdit: func,
  children: PropTypes.oneOfType([
    element,
    string,
    PropTypes.arrayOf(element),
  ]),
  className: string,
};
Example #6
Source File: Image.js    From dnd-builder with MIT License 6 votes vote down vote up
ImageElement.propTypes = {
  item: shape({
    defaultURL: string,
    height: oneOfType([
      number,
      string,
    ]),
    id: string,
    opacity: oneOfType([
      number,
      string,
    ]),
    roundedCorners: oneOfType([
      number,
      string,
    ]),
    url: string,
    width: oneOfType([
      number,
      string,
    ]),
  }),
  itemAccessor: func,
};
Example #7
Source File: Poppable.props.js    From webrix with Apache License 2.0 6 votes vote down vote up
propTypes = {
    container: oneOfType([
        func,
        shape({current: oneOfType([instanceOf(Element), instanceOf(_window.constructor)])}),
    ]),
    reference: oneOfType([
        func,
        instanceOf(DOMRect),
        shape({current: instanceOf(Element)}),
    ]),
    placements: func,
    placement: shape({
        top: number,
        left: number,
    }),
    overflow: func,
    onPlacement: func,
    default: number,
    children: node,
}
Example #8
Source File: CollectionRow.js    From discovery-mobile-ui with MIT License 6 votes vote down vote up
CollectionRow.propTypes = {
  collection: shape({}).isRequired,
  collectionId: string.isRequired,
  label: string.isRequired,
  navigation: shape({}).isRequired,
  selectCollectionAction: func.isRequired,
  updateIsAddingNewCollectionAction: func.isRequired,

};
Example #9
Source File: ControlledMenu.js    From react-menu with MIT License 6 votes vote down vote up
process.env.NODE_ENV !== "production" ? ControlledMenu.propTypes = /*#__PURE__*/_extends({}, rootMenuPropTypes, {
  state: /*#__PURE__*/oneOf( /*#__PURE__*/values(MenuStateMap)),
  anchorPoint: /*#__PURE__*/exact({
    x: number,
    y: number
  }),
  anchorRef: object,
  skipOpen: object,
  captureFocus: bool,
  menuItemFocus: /*#__PURE__*/exact({
    position: /*#__PURE__*/oneOfType([string, number]),
    alwaysUpdate: bool
  }),
  onClose: func
}) : void 0;
Example #10
Source File: Device.js    From techno-broadlink with MIT License 6 votes vote down vote up
Device.propTypes = {
  name: string,
  ip: string,
  mac: string,
  selected: bool,
  model: string,
  manufacturer: string,
  handleClick: func,
  disabled: bool,
  handleChange: func,
};
Example #11
Source File: ToggleTheme.jsx    From trashpanda-fe with MIT License 5 votes vote down vote up
Toggle.propTypes = {
  theme: string.isRequired,
  toggleTheme: func.isRequired
};
Example #12
Source File: index.js    From juggernaut-desktop with MIT License 5 votes vote down vote up
ctaType = shape({
  type: oneOf(['button', 'icon']).isRequired,
  action: func.isRequired,
  label: string,
  icon: oneOfType([string, node]),
  tooltip: string
})
Example #13
Source File: SocketConnect.js    From flatris-LAB_V1 with MIT License 5 votes vote down vote up
export function withSocket(
  CompType: ComponentType<*>,
  syncActions: {
    [propName: string]: (...args: any) => JoinGameAction | ThunkAction
  } = {}
) {
  class SocketConnect extends Component<Props> {
    static displayName = `SocketConnect(${CompType.displayName ||
      CompType.name ||
      'UnnamedComponent'})`;

    static contextTypes = {
      subscribe: func.isRequired,
      keepGameAlive: func.isRequired,
      broadcastGameAction: func.isRequired,
      onGameKeepAlive: func.isRequired,
      offGameKeepAlive: func.isRequired
    };

    createActionHandler = (actionName: string) => async (...args: any) => {
      const { broadcastGameAction } = this.context;
      const actionCreator = syncActions[actionName];

      // NOTE: This must only run on the client!
      return broadcastGameAction(actionCreator(...args));
    };

    getBoundHandlers() {
      return Object.keys(syncActions).reduce((acc, actionName) => {
        return {
          ...acc,
          [actionName]: this.createActionHandler(actionName)
        };
      }, {});
    }

    render() {
      return (
        <CompType
          {...this.props}
          {...this.context}
          {...this.getBoundHandlers()}
        />
      );
    }
  }

  return SocketConnect;
}
Example #14
Source File: Toggle.js    From portfolio with MIT License 5 votes vote down vote up
Toggle.propTypes = {
  theme: string.isRequired,
  toggleTheme: func.isRequired,
}
Example #15
Source File: Toggler.js    From demolab with MIT License 5 votes vote down vote up
Toggle.propTypes = {
    theme: string.isRequired,
    toggleTheme: func.isRequired,
}
Example #16
Source File: FilterDropdown.jsx    From covid-trials-dashboard with MIT License 5 votes vote down vote up
FilterDropdown.propTypes = {
  label: string,
  filters: arrayOf(string),
  handleSelected: func,
  selected: arrayOf(string),
}
Example #17
Source File: ColorPickerActions.js    From wix-style-react with MIT License 5 votes vote down vote up
ColorPickerActions.propTypes = {
  onCancel: func.isRequired,
  onConfirm: func.isRequired,
};
Example #18
Source File: Dialog.jsx    From Turnip-Calculator with MIT License 5 votes vote down vote up
CustomDialog.propTypes = {
  open: bool.isRequired,
  onClose: func,
  title: any,
  description: any,
  children: any,
  actions: any,
};
Example #19
Source File: CalendarNavigation.js    From react-nice-dates with MIT License 5 votes vote down vote up
CalendarNavigation.propTypes = {
  locale: object.isRequired,
  month: instanceOf(Date).isRequired,
  minimumDate: instanceOf(Date),
  maximumDate: instanceOf(Date),
  onMonthChange: func.isRequired
}
Example #20
Source File: Modal.js    From thekusuma with MIT License 5 votes vote down vote up
ModalMusic.propTypes = {
  isShow: bool.isRequired,
  onClickAction: func.isRequired,
};
Example #21
Source File: Toggler.js    From indeplot with GNU General Public License v3.0 5 votes vote down vote up
Toggler.propTypes = {
  toggleTheme: func.isRequired,
};
Example #22
Source File: search.js    From what-front with MIT License 5 votes vote down vote up
Search.propTypes = {
  onSearch: func.isRequired,
  placeholder: PropTypes.string.isRequired,
  className: PropTypes.string,
};
Example #23
Source File: PageAdder.js    From dnd-builder with MIT License 5 votes vote down vote up
PageAdder.propTypes = {
  additionalClass: string,
  onPageAdd: func,
  pageCount: number,
};
Example #24
Source File: Collapsible.props.js    From webrix with Apache License 2.0 5 votes vote down vote up
propTypes = {
    expanded: bool,
    onTransitionEnd: func,
    children: node.isRequired,
}
Example #25
Source File: Toggler.js    From react-blog-github with MIT License 5 votes vote down vote up
Toggle.propTypes = {
  theme: string.isRequired,
  toggleTheme: func.isRequired,
};
Example #26
Source File: index.js    From study-chain with MIT License 5 votes vote down vote up
getBlockListType = func
Example #27
Source File: index.js    From discovery-mobile-ui with MIT License 5 votes vote down vote up
CollectionNotes.propTypes = {
  collectionNotes: arrayOf(shape({}).isRequired).isRequired,
  editNoteId: string,
  handleEditNote: func.isRequired,
  fromNotesScreen: bool.isRequired,
};