How to use smoothscroll-polyfill - 10 common examples

To help you get started, we’ve selected a few smoothscroll-polyfill 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 LedgerHQ / ledger-live-desktop / src / components / StickyBackToTop.js View on Github external
// @flow
import React, { PureComponent } from 'react'
import ReactDOM from 'react-dom'
import styled from 'styled-components'
import smoothscroll from 'smoothscroll-polyfill'
import { track } from 'analytics/segment'
import Box from 'components/base/Box'
import AngleUp from 'icons/AngleUp'
import { GrowScrollContext } from './base/GrowScroll'

smoothscroll.polyfill()

const Container = styled(Box)`
  position: fixed;
  z-index: 10;
  bottom: 100px;
  right: 20px;
  border-radius: 50%;
  box-shadow: 0 2px 4px 0 rgba(102, 102, 102, 0.25);
  cursor: pointer;
  height: 36px;
  width: 36px;
  color: ${p => p.theme.colors.palette.primary.contrastText};
  background-color: ${p => p.theme.colors.palette.primary.main};
  transition: all 0.5s;
  opacity: ${p => (p.visible ? 1 : 0)};
  pointer-events: ${p => (!p.visible ? 'none' : 'initial')};
github django-stars / frontend-skeleton / src / app / polyfills.js View on Github external
import smoothScroll from 'smoothscroll-polyfill'
smoothScroll.polyfill()

// should be after React import for IE11
// 'require' used because inside condition
if(!!window.MSInputMethodContext && !!document.documentMode) { // IE11 check
  require('whatwg-fetch')

  // classList.toggle polyfill for IE
  DOMTokenList.prototype.toggle = function(token, force) {
    if(force === undefined) {
      force = !this.contains(token)
    }

    return this[force ? 'add' : 'remove'](token)
  }
}
github woltapp / blurhash / Website / src / sections / hero.js View on Github external
import { imageHashes } from '../constants';
import decode from '../../../TypeScript/dist/decode';
import Velocity from 'velocity-animate';
import smoothscroll from 'smoothscroll-polyfill';

// kick off the polyfill!
smoothscroll.polyfill();

function hero() {
  const images = document.getElementsByClassName('image-bg');
  const imageContainer = document.getElementsByClassName('imagesContainer');
  const content = document.getElementsByClassName('content');

  function render(canvas, blurhash) {
    if (blurhash) {
      const pixels = decode(blurhash, 32, 32);
      if (pixels) {
        const ctx = canvas.getContext('2d');

        const imageData = new ImageData(pixels, 32, 32);
        ctx.putImageData(imageData, 0, 0);
      }
    }
github gamejolt / frontend-lib / components / scroll / scroll.service.ts View on Github external
import { Ruler } from '../ruler/ruler-service';
import { Screen } from '../screen/screen-service';
import { AppAutoscrollAnchor } from './auto-scroll/anchor';
import { ScrollWatcher } from './watcher.service';

// Polyfill smooth scrolling.
if (!GJ_IS_SSR) {
	require('smoothscroll-polyfill').polyfill();
}

export type ScrollContext = HTMLElement | HTMLDocument;

export class Scroll {
	static shouldAutoScroll = true;
	static autoscrollAnchor?: AppAutoscrollAnchor;

	// For SSR context we have to set this to undefined. No methods should be
	// called that would use the context.
	static watcher: ScrollWatcher;
	static offsetTop = 0;

	/**
	 * Sets the extra offset for scrolling. This can be used if there is a fixed
	 * nav on the top that we need to always offset from.
github nrkno / tv-automation-casparcg-launcher / src / renderer / main.js View on Github external
import Vue from 'vue'
import BootstrapVue from 'bootstrap-vue'
import VueChatScroll from 'vue-chat-scroll'
import {ipcRenderer} from 'electron'

import 'bootstrap/dist/css/bootstrap.css'
import 'bootstrap-vue/dist/bootstrap-vue.css'

import App from './App'
import router from './router'
import store from './store'

import smoothscroll from 'smoothscroll-polyfill'
smoothscroll.polyfill()

if (!process.env.IS_WEB) Vue.use(require('vue-electron'))
Vue.config.productionTip = false

ipcRenderer.on('process.log', (e, data) => {
  store.dispatch('logLine', JSON.parse(data))
})
ipcRenderer.on('process.status', (e, status) => {
  store.dispatch('setStatus', JSON.parse(status))
})

Vue.use(BootstrapVue)
Vue.use(VueChatScroll)

/* eslint-disable no-new */
new Vue({
github MacKentoch / react-bootstrap-webpack-starter / src / app / index.js View on Github external
import React                from 'react';
import { render }           from 'react-dom';
import injectTpEventPlugin  from 'react-tap-event-plugin';
import { AppContainer }     from 'react-hot-loader';
import smoothScrollPolyfill from 'smoothscroll-polyfill';
import Root                 from './Root';
import 'animate.css';
import 'jquery';
import 'font-awesome/css/font-awesome.min.css'; // css is not managed by CSSModule
import 'bootstrap/dist/css/bootstrap.min.css';
import 'bootstrap/dist/js/bootstrap.min.js';
import './style/index.scss'; // import general styles, mixins etc...

// smoothscroll polyfill
smoothScrollPolyfill.polyfill();
// force polyfill (even if browser partially implements it)
window.__forceSmoothScrollPolyfill__ = true;

const ELEMENT_TO_BOOTSTRAP  = 'root';
const BootstrapedElement    = document.getElementById(ELEMENT_TO_BOOTSTRAP);

injectTpEventPlugin();

const renderApp = RootComponent => {
  render(
    <AppContainer
      warnings={false}
    >
      <RootComponent />
    </AppContainer>,
    BootstrapedElement
github web-pal / chronos-timetracker / app / renderer / index.jsx View on Github external
} from 'react-dom';
import {
  Provider,
} from 'react-redux';
import * as Sentry from '@sentry/electron';
import {
  ipcRenderer,
} from 'electron';

import App from './containers/App';
import store from './store';

import './assets/stylesheets/main.less';
import pjson from '../package.json';

require('smoothscroll-polyfill').polyfill();

if (process.env.NODE_ENV === 'production') {
  Sentry.init({
    dsn: process.env.SENTRY_DSN,
    release: `${pjson.version}_${process.platform}`,
    enableNative: false,
    beforeSend(event, hint) {
      if (
        event?.message?.startsWith('Non-Error exception captured')
        && hint.originalException.error
        && hint.originalException.extra
      ) {
        Sentry.withScope((scope) => {
          scope.setExtra('nonErrorException', true);
          Sentry.captureException(
            hint.originalException.error,
github assembl / assembl / assembl / static2 / js / app / index.jsx View on Github external
import React from 'react';
import ReactDOM from 'react-dom';
import { ApolloProvider } from 'react-apollo';
import { AppContainer } from 'react-hot-loader';
import { Router } from 'react-router';

import createAppStore from './store';
import client from './client';
import Routes from './routes';
import hashLinkScroll from './utils/hashLinkScroll';
import { initializeSentry } from './utils/sentry';
import { ScreenDimensionsProvider } from './components/common/screenDimensions';
import { browserHistory } from './router';
import GlobalErrorBoundary from './components/common/GlobalErrorBoundary';

require('smoothscroll-polyfill').polyfill();

const store = createAppStore();

const rootElement = document.getElementById('root');
initializeSentry(rootElement);

const renderAssembl = (routes) => {
  ReactDOM.render(
    <AppContainer>
      <ApolloProvider store={store} client={client}>
        <ScreenDimensionsProvider>
          <GlobalErrorBoundary>
            <Router
              history={browserHistory}
              routes={routes}
              onUpdate={() => {
github satoshipay / solar / src / app.tsx View on Github external
import DesktopNotifications from "./components/DesktopNotifications"
import NotificationContainer from "./components/NotificationContainer"
import { AccountsProvider } from "./context/accounts"
import { CachingProviders } from "./context/caches"
import { NotificationsProvider } from "./context/notifications"
import { SettingsProvider } from "./context/settings"
import { SignatureDelegationProvider } from "./context/signatureDelegation"
import { StellarProvider } from "./context/stellar"
import AllAccountsPage from "./pages/all-accounts"
import AccountPage from "./pages/account"
import CreateAccountPage from "./pages/create-account"
import SettingsPage from "./pages/settings"
import handleSplashScreen from "./splash-screen"
import theme from "./theme"

SmoothScroll.polyfill()

const CreateMainnetAccount = () => <CreateAccountPage testnet={false} />
const CreateTestnetAccount = () => <CreateAccountPage testnet={true} />

const Providers = (props: { children: React.ReactNode }) => (
  <Router>
    <MuiThemeProvider theme={theme}>
      <StellarProvider>
        <AccountsProvider>
          <SettingsProvider>
            <CachingProviders>
              <NotificationsProvider>
                <SignatureDelegationProvider>{props.children}</SignatureDelegationProvider>
              </NotificationsProvider>
            </CachingProviders>
          </SettingsProvider>
github FE-Kits / fractal-components / fc-iot / packages / fc-iot-react / src / index.umd.tsx View on Github external
export function render(_importApp: Function) {
  smoothscroll.polyfill();
  importApp = _importApp;

  ReactDOM.render(
    <ConfigProvider locale={zhCN}>
      <Provider store={store}>
        <ConnectedRouter history={history}>
          <App />
        </ConnectedRouter>
      </Provider>
    </ConfigProvider>,
    document.getElementById('root')
  );
}

smoothscroll-polyfill

Smooth Scroll behavior polyfill

MIT
Latest version published 4 years ago

Package Health Score

74 / 100
Full package analysis

Popular smoothscroll-polyfill functions