How to use the react-router-scroll.useScroll function in react-router-scroll

To help you get started, we’ve selected a few react-router-scroll 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 wevote / WebApp / src / js / index.js View on Github external
// prevent keyboard scrolling our view, https://www.npmjs.com/package/cordova-plugin-keyboard
    if (window.Keyboard) {
      console.log('Cordova startupApp keyboard plugin found');
      Keyboard.shrinkView(true); // eslint-disable-line no-undef
      Keyboard.disableScrollingInShrinkView(true); // eslint-disable-line no-undef
    } else console.log('ERROR: Cordova index.js startApp keyboard plugin WAS NOT found');
  }

  render(
    // eslint-disable-next-line react/jsx-filename-extension
    
      
         true))}
        >
          {routes()}
        
      
    , document.getElementById('app'),
  );
}
github edp963 / davinci / webapp / app / app.tsx View on Github external
const render = (messages) => {
  ReactDOM.render(
    
      
        
          
        
      
    ,
    MOUNT_NODE
  )
}
// declare const module: any
github IcaliaLabs / alpha / app / app.js View on Github external
const render = () => {
  ReactDOM.render(
    
      
    ,
    document.getElementById('app')
  );
};
github VulcanJS / Vulcan / packages / vulcan-routing / lib / client / routing.jsx View on Github external
wrapperHook(appGenerator) {
      const { apolloClient, store } = getRenderContext();
      const app = runCallbacks('router.client.wrapper', appGenerator({
        onUpdate: () => {
          // the first argument is an item to iterate on, needed by vulcan:lib/callbacks
          // note: this item is not used in this specific callback: router.onUpdate
          // runCallbacks('router.onUpdate', {}, store, apolloClient);
        },
        render: applyRouterMiddleware(useScroll((prevRouterProps, nextRouterProps) => {
          // if the action is REPLACE, return false so that we don't jump back to top of page
          return !(nextRouterProps.location.action === 'REPLACE');
        }))
      }));
      return {app};
    },
  };
github recruit-tech / redux-pluto / src / client / components / App.tsx View on Github external
export default function App({ store, ...renderProps }: Props) {
  const RenderWithMiddleware: any = applyRouterMiddleware(
    useAsyncLoader(),
    useScroll((_prevRouterProps: any, { location, routes }: any) => {
      if (
        routes.some(
          (route: any) =>
            route.ignoreScrollBehavior && route.ignoreScrollBehavior(location),
        )
      ) {
        return false;
      }

      return true;
    }),
  );

  if (__DEVELOPMENT__) {
    // eslint-disable-next-line @typescript-eslint/no-var-requires
    const { AppContainer } = require("react-hot-loader");
github ryelle / Foxhound / js / index.jsx View on Github external
function renderApp() {
	let blogURL, frontPageRoute;
	if ( FoxhoundSettings.frontPage.page ) {
		blogURL = path + 'page/' + FoxhoundSettings.frontPage.blog + '/';
		frontPageRoute = ;
	} else {
		blogURL = path;
		frontPageRoute = null;
	}

	const routerMiddleware = applyRouterMiddleware( useScroll( shouldUpdateScroll ), keyboardFocusReset( 'main' ) );

	// Add the event Jetpack listens for to initialize various JS features on posts.
	const emitJetpackEvent = () => {
		jQuery( document.body ).trigger( 'post-load' );
	}

	// Routes
	const routes = (
		
			
			
			{ frontPageRoute }
github freedomexio / rocketx-condenser / src / shared / UniversalRender.jsx View on Github external
export function clientRender(initialState) {
    const sagaMiddleware = createSagaMiddleware();
    const store = createStore(
        rootReducer,
        initialState,
        bindMiddleware([sagaMiddleware])
    );
    sagaMiddleware.run(rootSaga);
    const history = syncHistoryWithStore(browserHistory, store);

    /**
     * When to scroll - on hash link navigation determine if the page should scroll to that element (forward nav, or ignore nav direction)
     */
    const scroll = useScroll({
        createScrollBehavior: config => new OffsetScrollBehavior(config), //information assembler for has scrolling.
        shouldUpdateScroll: (prevLocation, { location }) => {
            // eslint-disable-line no-shadow
            //if there is a hash, we may want to scroll to it
            if (location.hash) {
                //if disableNavDirectionCheck exists, we want to always navigate to the hash (the page is telling us that's desired behavior based on the element's existence
                const disableNavDirectionCheck = document.getElementById(
                    DISABLE_ROUTER_HISTORY_NAV_DIRECTION_EL_ID
                );
                //we want to navigate to the corresponding id= element on 'PUSH' navigation (prev null + POP is a new window url nav ~= 'PUSH')
                if (
                    disableNavDirectionCheck ||
                    (prevLocation === null && location.action === 'POP') ||
                    location.action === 'PUSH'
                ) {
                    return location.hash;

react-router-scroll

React Router scroll management

MIT
Latest version published 7 years ago

Package Health Score

50 / 100
Full package analysis

Popular react-router-scroll functions