How to use the @shoutem/ui.Html.registerElement function in @shoutem/ui

To help you get started, we’ve selected a few @shoutem/ui 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 shoutem / extensions / shoutem.application / app / app.js View on Github external
import { resizeImageSource } from './services/resizeImageSource';
import { loadLocalConfiguration, fetchConfiguration } from './redux';
import { CONFIGURATION_SCHEMA, ACTIVE_APP_STATE, ext } from './const';
import { SeAttachment } from './html';
import buildConfig from './buildConfig.json';

export const appActions = {};

let appStateChangeHandler; // Dynamically created handler;
let appState = ACTIVE_APP_STATE;

let application;
let unsubscribeFromConfigurationLoaded;

Html.registerElement('se-attachment', SeAttachment);
Html.registerElement('attachment', SeAttachment);

export const getAppId = () => {
  if (_.isEmpty(application)) {
    console.warn('You called getAppId before appWillMount has finished.');
  }

  return _.get(application, 'props.appId') || buildConfig.appId;
};

export const initializeApp = () => {
  Image.setPropsTransformer(resizeImageSource);
};

function loadConfiguration(app) {
  const store = app.getStore();
  const dispatch = store.dispatch;
github shoutem / extensions / shoutem.application / app / app.js View on Github external
import { isConfigurationLoaded } from './shared/isConfigurationLoaded';
import { resizeImageSource } from './services/resizeImageSource';
import { loadLocalConfiguration, fetchConfiguration } from './redux';
import { CONFIGURATION_SCHEMA, ACTIVE_APP_STATE, ext } from './const';
import { SeAttachment } from './html';
import buildConfig from './buildConfig.json';

export const appActions = {};

let appStateChangeHandler; // Dynamically created handler;
let appState = ACTIVE_APP_STATE;

let application;
let unsubscribeFromConfigurationLoaded;

Html.registerElement('se-attachment', SeAttachment);
Html.registerElement('attachment', SeAttachment);

export const getAppId = () => {
  if (_.isEmpty(application)) {
    console.warn('You called getAppId before appWillMount has finished.');
  }

  return _.get(application, 'props.appId') || buildConfig.appId;
};

export const initializeApp = () => {
  Image.setPropsTransformer(resizeImageSource);
};

function loadConfiguration(app) {
  const store = app.getStore();