How to use the @times-components/utils.addMissingProtocol function in @times-components/utils

To help you get started, we’ve selected a few @times-components/utils 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 newsuk / times-components / packages / image / src / image.android.js View on Github external
render() {
    const { uri, style, aspectRatio } = this.props;
    const { isLoaded } = this.state;
    // web handles missing protocols just fine, native doesn't. This evens out support.
    const cleanUri = addMissingProtocol(uri);
    const previewUri =
      !cleanUri || this.state.isHighResolutionLoaded
        ? null
        : `${cleanUri}&preview=true`; // TODO: Implement a separate uri for preview

    const props = {
      style: styles.imageBackground,
      onLoad: this.handleLoad
    };

    if (cleanUri) {
      props.source = { uri: cleanUri };
    }

    const previewProps = {
      ...props,
github newsuk / times-components / packages / image / src / image.web.js View on Github external
render() {
    const {
      aspectRatio,
      disablePlaceholder,
      highResSize,
      lowResSize,
      style,
      uri,
      onLayout,
      rounded
    } = this.props;
    const { imageIsLoaded } = this.state;
    const url = addMissingProtocol(uri);

    return (
github newsuk / times-components / packages / brightcove-video / src / splash.js View on Github external
const addMissingProtocolToPoster = poster => ({
  uri: addMissingProtocol(poster.uri)
});