Code Monkey home page Code Monkey logo

react-scrollchor's People

Contributors

bysabi avatar jeanchung avatar kambing86 avatar sbrk avatar seinopsys avatar xehpuk avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

react-scrollchor's Issues

variable offset parameter in animation properties

thx a lot for component, it's very helpful

Is it right that I can't set variable in offset parameter in animation object?
I've tried to do so and it looks like component takes it only once during component build and ignore it changes after component did mount. It is a little strange that changing props don't cause component to rebuild.

I need it to make anchor view in the middle of screen instead of it's top part. Even if user will change browser window height. Thats why I need to use a variable.

<Scrollchor
    to={letter}
    key={letter}
    className={styles.listLettersItem}
    animate={{offset: this.state.offset}}>
    {letter}
</Scrollchor> 

ScrollChor doesn't seem to work with styled.button

Hi there,

I'm probably doing something dumb, but this one has me stumped.

I've got a styled.a component that I'm using as a button.

import styled from "react-emotion";
import { fontSize, space } from "styled-system";
import "typeface-exo-2";

export default styled.a`
  ${fontSize};
  ${space};
  background-color: rgba(0, 0, 0, 0.4);
  border-radius: 0.33em;
  border-style: solid;
  border-width: 1px;
  color: white;
  font-family: "Exo 2", sans-serif;
  font-weight: 400;
  letter-spacing: 1px;
  opacity: 1;
  text-decoration: none;
  transition: background-color 0.15s ease-in;
  text-transform: uppercase;
  &:hover {
    background-color: rgba(255, 255, 255, 0.1);
  }
`;

Scrollchor works beautifully when I do this:

<Button>
  <Scrollchor to="#ss-signup" animate={{ offset: 0, duration: 500 }}>
     soul surfer
  </Scrollchor>
</Button>

However, if I change the styled anchor component to export default styled.button ScrollChor stops working.

I've tried various things with "type=button" and role="button", and I've tried surrounding the Scrollchor element in an <a> tag, but nothing seems to get that working.

Again, it's probably something stupid, but I thought I'd ask ๐Ÿ˜„

Undocumented breaking change to the API in v 7.0.0 (default export is no longer used)

Hi there, I think that the release notes for v 7.0.0 might need updating.

While the documentation is clear about the fact that you need to import the component as a named export, the release notes simply say that there were no breaking changes to the API vis-ร -vis v 6.0.0, and I think that adding a note about that might facilitate teams' transitions towards the new version.

Thanks so much for all your hard work!

HashRouter(react-router-dom v4) and scrollchor

Hello,

I use HashRouter in my react app and the landing page is single-page which use react-scrollchor component to scroll to some section with animation. Say I defined #service section in the landing page, when I click Service and the page scroll to the anchor and finally the URL turn to /#/service(should be /#service), the page is blank. And I leave the example page here

I searched stackover and find https://github.com/rafrex/react-router-hash-link would work, and could you support HashRouter in scrollchor?

Thanks!

Unknown prop `animate` on <a> tag

I used react-scrollchor for scrolling some hash links, everything just worked fine.
However, when I set animate prop to anything, the browser always pop-up the warning:

Warning: Unknown prop animate on tag. Remove this prop from the element. For details, see https://fb.me/react-unknown-prop
in a (created by Scrollchor)
in Scrollchor (created by Nav)
in div (created by Nav)
in nav (created by Nav)
in Nav (created by Layout)
in div (created by Layout)
in Layout (created by RouterContext)
in RouterContext (created by Router)
in Router

I set the duration to 200, and it worked properly except for the warning above.
Thanks!

Problem Scrollchor inside <a> tag

Hey! I have a problem using component inside another tag component. resulting in error:

Warning:
validateDOMNesting(...): cannot appear as a descendant of . See NavItem > SafeAnchor > a > ... > Scrollchor > a.

This happens because it is not possible to change the base component like in the bootstrap componentClass prop. Do you guys intend to adjust that?

Not working when I put the component inside a div with overflow: scroll !

When the entire component is rendered on the browser screen the Scrollchor with #id works, but when the same component is kept in a div with overflow: scroll property in parent div it doesn't work.
I had the same issue with react-scroll Link.
They mentioned that react-scroll won't work inside a div.
Is this the same issue with react-scrollchor?

can url add hash?

First, this rep is very good.

when i click the Anchor, it scrolls very smooth. but can url add hash? because i want to go back by the back button of browser.

Is this package abandoned? I've got a fork that I could contribute back my changes from

Considering there have been no updates to master in 3 years I figured this might be the case, but I am seeing relatively recent issue comments so I'm not sure what to think.

I was getting a bunch of warnings from React about the fact that "components using new hooks will not have their legacy hooks called" or something along those lines, and seeing the last publish date made me go the fork route, but I wanted to mention this here in case there are any other active maintainers who would like to discuss the possibility of contributing all or some of my changes back "upstream" so to speak.

My fork currently lives at https://github.com/SeinopSys/react-scrollchor and is published to NPM under a namespace of mine that I use for package forks. The key points I wanted to address, and then did so:

  1. Update all the dependencies/tooling to more recent versions (switched to Rollup instead of Babel)
  2. Keep API as same as possible (partially failed due to the removal of the default export for the component, because Rollup was throwing a warning about it, and also hooks support meant a higher minimum React version)
  3. TypeScript typings for everything (basically rewritten the package with types)
  4. Using the new function components with hooks
  5. Full easing function compatibility with jQuery easings (this may have been the case already but I checked the jQuery souce and adjusted the animation implementation to match how it works more closely, hopefully improving compatibility in the process)

The complete set of changes are here: master...SeinopSys:main

I'd like to ask any remaining active maintainers to chime in and let me know if any of these changes interest you. I would be happy to prepare a separate PR just for those changes which you would like to have so that this package remains useful to all moving forward. It's often not trivial for developers to find where a package continues to live (if it even does) once it appears to be abandoned.

Universal Isomorphic Support

For some reason which I couldn't figure out, this doesn't work for universal isomorphic apps, the server rendering turns out to be different from the clients.

NavItem with Scrollchor error - `<a>` cannot appear as a descendant of `<a>`

From the following setup

import React from 'react';
import { Nav, NavItem } from 'react-bootstrap';
import Scrollchor from 'react-scrollchor';

const HomeNavigation = () => (
  <Nav pullRight>
    <NavItem><Scrollchor to="#how" className="nav-link">How?</Scrollchor></NavItem>
  </Nav>
);

export default HomeNavigation;

I get: Warning: validateDOMNesting(...): <a> cannot appear as a descendant of <a>. See HomeNavigation > NavItem > SafeAnchor > a > ... > Scrollchor > a

Expose animateScroll function

Hello,

Would it be possible to expose the animateScroll function from the helpers as an es6 export so that we can programatically call the scrolling function without having to click on or use the React component?

Something like this:
import { animateSroll } from 'react-scrollchor'

then we can
() => { animateScroll('#to', '#target', (optional) animation) }

This would be really helpful as it will allow us to scroll to anchors on different pages. We can change our route then directly call the animateScroll function on the new page. I don't see how this is currently possible with just the component.

Thanks!

Need to scroll to anchors programmatically

It's not always users clicking on links in the same page but sometimes users are coming from other pages and I need to check the hash and if there were a hash scroll them to related anchor something like this:

componentDidMount() {
  if (location.hash) {
    schrollchor.scrollToAnchor(location.hash);
  }
}

Cannot resolve module 'fbjs/lib/warning'`

I'm trying to use this package, but I'm getting this error message on import

webpack-dev-server.js:1 ./~/react-scrollchor/lib/animatescroll.js Module not found: Error: Cannot resolve module 'fbjs/lib/warning'

im running
node v4.4.5
react: 15.2.0,
react-router: 2.4.1,
webpack: 1.12.9
webpack-dev-server: 1.14.0

Bootstrap Navbar collapseOnSelect

Hi

If I use <Scrollchor> link instead of default react-bootstrap <Nav.Link>, collapseOnSelect won't work on mobile devices. Any workaround?

Regards

Method to cancel scroll animation

I have case that page should be scrolled conditionally.
I try
clickEvent.preventDefault(); clickEvent.stopPropagation();
but it's animated in any case.

Scrollchor disables functionality of submit button

Not sure if you've ran into a similar problem before, but what I'm trying to do is search by location and by doing so the map will display 5 markers of breweries close by. However when I added around the submit button it auto scrolls but the markers don't show up anymore. Any reason for loss of functionality you could explain to me? Please and thank you!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.