How to use the fbjs/lib/keyMirror function in fbjs

To help you get started, we’ve selected a few fbjs 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 taofed / react-web / Libraries / Touchable / Touchable.js View on Github external
*   },
 *
 * - There are more advanced methods you can implement (see documentation below):
 *   touchableGetHighlightDelayMS: function() {
 *     return 20;
 *   }
 *   // In practice, *always* use a predeclared constant (conserve memory).
 *   touchableGetPressRectOffset: function() {
 *     return {top: 20, left: 20, right: 20, bottom: 100};
 *   }
 */

/**
 * Touchable states.
 */
var States = keyMirror({
  NOT_RESPONDER: null, // Not the responder
  RESPONDER_INACTIVE_PRESS_IN: null, // Responder, inactive, in the `PressRect`
  RESPONDER_INACTIVE_PRESS_OUT: null, // Responder, inactive, out of `PressRect`
  RESPONDER_ACTIVE_PRESS_IN: null, // Responder, active, in the `PressRect`
  RESPONDER_ACTIVE_PRESS_OUT: null, // Responder, active, out of `PressRect`
  RESPONDER_ACTIVE_LONG_PRESS_IN: null, // Responder, active, in the `PressRect`, after long press threshold
  RESPONDER_ACTIVE_LONG_PRESS_OUT: null, // Responder, active, out of `PressRect`, after long press threshold
  ERROR: null
});

/**
 * Quick lookup map for states that are considered to be "active"
 */
var IsActive = {
  RESPONDER_ACTIVE_PRESS_OUT: true,
  RESPONDER_ACTIVE_PRESS_IN: true
github brunobar79 / react-native-web3-webview / Web3Webview.android.js View on Github external
},
	hidden: {
		height: 0,
		flex: 0 // disable 'flex:1' when hiding a View
	},
	loadingView: {
		flex: 1,
		justifyContent: "center",
		alignItems: "center"
	},
	loadingProgressBar: {
		height: 20
	}
});

const WebViewState = keyMirror({
	IDLE: null,
	LOADING: null,
	ERROR: null
});

const defaultRenderLoading = show =>
	show
		? ((
				
		  ): null)
		: null;

/**
 * Renders a native WebView.
github brunobar79 / react-native-web3-webview / Web3Webview.ios.js View on Github external
height: 0,
		flex: 0 // disable 'flex:1' when hiding a View
	},
	loadingView: {
		backgroundColor: BGWASH,
		flex: 1,
		justifyContent: "center",
		alignItems: "center",
		height: 100
	},
	webView: {
		backgroundColor: "#ffffff" // eslint-disable-line
	}
});

const WebViewState = keyMirror({
	IDLE: null,
	LOADING: null,
	ERROR: null
});

const NavigationType = keyMirror({
	click: true,
	formsubmit: true,
	backforward: true,
	reload: true,
	formresubmit: true,
	other: true
});

const JSNavigationScheme = "react-js-navigation";
github gilbarbara / react-redux-observables-boilerplate / app / scripts / constants / index.js View on Github external
// @flow
/**
 * @namespace Constants
 * @desc App constants
 */

import keyMirror from 'fbjs/lib/keyMirror';

/**
 * @constant {Object} ActionTypes
 * @memberof Constants
 */
export const ActionTypes: Object = keyMirror({
  USER_LOGIN_REQUEST: undefined,
  USER_LOGIN_SUCCESS: undefined,
  USER_LOGIN_FAILURE: undefined,
  USER_LOGOUT_REQUEST: undefined,
  USER_LOGOUT_SUCCESS: undefined,
  USER_LOGOUT_FAILURE: undefined,
  FETCH_POPULAR_REPOS_REQUEST: undefined,
  FETCH_POPULAR_REPOS_SUCCESS: undefined,
  FETCH_POPULAR_REPOS_FAILURE: undefined,
  FETCH_POPULAR_REPOS_CANCEL: undefined,
  CANCEL_FETCH: undefined,
  SHOW_ALERT: undefined,
  HIDE_ALERT: undefined,
});

/**
github iamdustan / react-hardware / src / InteractionManager.js View on Github external
* reads have ended or been cancelled.
 *
 * InteractionManager also allows applications to register animations by
 * creating an interaction 'handle' on animation start, and clearing it upon
 * completion:
 *
 * ```
 * var handle = InteractionManager.createInteractionHandle();
 * // run animation... (`runAfterInteractions` tasks are queued)
 * // later, on animation completion:
 * InteractionManager.clearInteractionHandle(handle);
 * // queued tasks run if all handles were cleared
 * ```
 */
var InteractionManager = {
  Events: keyMirror({
    interactionStart: true,
    interactionComplete: true,
  }),

  /**
   * Schedule a function to run after all interactions have completed.
   */
  runAfterInteractions(callback: Function) {
    invariant(
      typeof callback === 'function',
      'Must specify a function to schedule.'
    );
    scheduleUpdate();
    _queue.push(callback);
  },
github brunobar79 / react-native-web3-webview / Web3Webview.ios.js View on Github external
justifyContent: "center",
		alignItems: "center",
		height: 100
	},
	webView: {
		backgroundColor: "#ffffff" // eslint-disable-line
	}
});

const WebViewState = keyMirror({
	IDLE: null,
	LOADING: null,
	ERROR: null
});

const NavigationType = keyMirror({
	click: true,
	formsubmit: true,
	backforward: true,
	reload: true,
	formresubmit: true,
	other: true
});

const JSNavigationScheme = "react-js-navigation";

type ErrorEvent = {
	domain: any,
	code: any,
	description: any
};
github emgage / engage-ui / src / components / ReactDataGrid / AppConstants.js View on Github external
import keyMirror from 'fbjs/lib/keyMirror';

const constants = {
  UpdateActions: keyMirror({
    CELL_UPDATE: null,
    COLUMN_FILL: null,
    COPY_PASTE: null,
    CELL_DRAG: null
  }),
  DragItemTypes: {
    Column: 'column'
  },
  CellExpand: {
    DOWN_TRIANGLE: String.fromCharCode('9660'),
    RIGHT_TRIANGLE: String.fromCharCode('9654')
  }
};

module.exports = constants;
github iran-react-community / elegant-react-native / app / store / constants / index.js View on Github external
import keyMirror from 'fbjs/lib/keyMirror';

/**
 * @namespace Constants
 * @desc App constants
 */

/**
 * @constant {Object} ActionTypes
 * @memberof Constants
 */
export const ActionTypes = keyMirror({
  EXCEPTION: undefined,
  GITHUB_GET_REPOS: undefined,
  GITHUB_GET_REPOS_FAILURE: undefined,
  GITHUB_GET_REPOS_SUCCESS: undefined,
  HIDE_ALERT: undefined,
  SHOW_ALERT: undefined,
  SWITCH_MENU: undefined,
  USER_LOGIN: undefined,
  USER_LOGIN_FAILURE: undefined,
  USER_LOGIN_SUCCESS: undefined,
  USER_LOGOUT: undefined,
  USER_LOGOUT_FAILURE: undefined,
  USER_LOGOUT_SUCCESS: undefined,
});

/**
github emgage / engage-ui / src / components / DataGrid / AppConstants.ts View on Github external
import keyMirror from 'fbjs/lib/keyMirror';

const constants = {
  UpdateActions: keyMirror({
    CELL_UPDATE: null,
    COLUMN_FILL: null,
    COPY_PASTE: null,
    CELL_DRAG: null,
  }),
  DragItemTypes: {
    Column: 'column',
  },
  CellExpand: {
    DOWN_TRIANGLE: String.fromCharCode(9660),
    RIGHT_TRIANGLE: String.fromCharCode(9654),
  },
};

export default constants;
github taofed / react-web / Libraries / Image / ImageResizeMode.js View on Github external
* All rights reserved.
 *
 * Copyright (c) 2015-present, Facebook, Inc.
 * All rights reserved.
 *
 * @flow
 */
'use strict';

import keyMirror from 'fbjs/lib/keyMirror';

/**
 * ImageResizeMode - Enum for different image resizing modes, set via
 * `resizeMode` style property on `<img>` components.
 */
let ImageResizeMode = keyMirror({
  /**
   * contain - The image will be resized such that it will be completely
   * visible, contained within the frame of the View.
   */
  contain: null,
  /**
   * cover - The image will be resized such that the entire area of the view
   * is covered by the image, potentially clipping parts of the image.
   */
  cover: null,
  /**
   * stretch - The image will be stretched to fill the entire frame of the
   * view without clipping. This may change the aspect ratio of the image,
   * distoring it.
   */
  stretch: null,