ensurePositiveDelayProps.js 566 B

1234567891011121314151617181920212223242526
  1. /**
  2. * Copyright (c) Facebook, Inc. and its affiliates.
  3. *
  4. * This source code is licensed under the MIT license found in the
  5. * LICENSE file in the root directory of this source tree.
  6. *
  7. * @format
  8. * @flow
  9. */
  10. 'use strict';
  11. const invariant = require('invariant');
  12. const ensurePositiveDelayProps = function(props: any) {
  13. invariant(
  14. !(
  15. props.delayPressIn < 0 ||
  16. props.delayPressOut < 0 ||
  17. props.delayLongPress < 0
  18. ),
  19. 'Touchable components cannot have negative delay properties',
  20. );
  21. };
  22. module.exports = ensurePositiveDelayProps;