-
Notifications
You must be signed in to change notification settings - Fork 90
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixes #4 - allow other elements to scroll #37
base: master
Are you sure you want to change the base?
Conversation
Can someone take care about this? |
I’ll send an email to @gabergg and see if he is still maintaining the project. |
Not sure if I'm doing something wrong, but I had a play with your code earlier and hit a problem. The "container" is set before the app has been mounted, meaning that if I set "container: document.getElementById('whatever')" it ends up setting the container to null. I've tried setting the container in an componentDidMount but by the time the component had mounted container was already set to window. Might it work if we pass an id instead of an element as the container and then let the manager find the element once the app has loaded? If I'm doing something obviously wrong please let me know. |
When do you call configureAnchors? |
I've tried two places, straight away at the top of the file and in componentDidMount. First option is too soon, the container doesn't exist yet. Second option is too late, container is already set to window. As I mentioned, you could get around this by passing an ID to configureAnchors and then only finding the element in the addAnchor method. A bigger issue that I later found is that jump.js (it is used here to provide the smooth scrolling effect) only works with the window object: It seems to have been raised as an issue there, and people have created pull requests, but the owner doesn't seem to have addressed it: Someone in there suggests another library, but I don't know if @gabergg would be willing to switch to velocity.js? |
If I or someone else has time, then maybe an example could be added? I don’t have answer for you at the moment. |
Built on your changes, created a pull request and have an example built see example 5 I found that zenscroll allows us to scroll elements as well as the window, so I've switched from jump.js to that. Would be interested to know what you think, can you spot anything I might have missed? |
Also, don't suppose you got a response from @gabergg ? |
Any updates on this PR?...the example that dbramwell created is exactly what I need...thanks in advance. |
If you want to use my code you can do so by changing the dependency in your package.json to: "react-scrollable-anchor": "github:dbramwell/react-scrollable-anchor#release" @gabergg doesn't seem to be maintaining this project at the moment, so I'm not sure when this will progress |
@dbramwell I never heard back. You may want to make you version available via npm, maybe as |
I'll see if I get chance at some point. Bit of a crap outcome though. Someone asked in another pull for another maintainer to be added, hopefully that happens at some point. Would be nice if that happened as this thing has quite a following. |
I can't seem to get this to work for some reason...getting errors about removeEventListeners and getListeners which are referred to in the Manager class. My scrollable div container is in another container separate from the sections that I want to add ScrollabeAnchor to...so I'm not sure what's going on?
On Thursday, May 10, 2018, 12:35:40 PM PDT, David Bramwell <[email protected]> wrote:
I'll see if I get chance at some point. Bit of a crap outcome though. Someone asked in another pull for another maintainer to be added, hopefully that happens at some point. Would be nice if that happened as this thing has quite a following.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub, or mute the thread.
|
Can you give me more info? What do the errors say? Any chance I can see the code? The ScrollAnchors need to be inside the scrollable container. |
I'm working on a react-boilerplate app with 5 other developers so tough to share the code without getting fired...lol...are you familiar with react-boilerplate? here are the errors:
VM141677 Manager.js:46 Uncaught TypeError: Cannot read property 'addEventListener' of null at Manager.addListeners (VM141677 Manager.js:46) at Manager.addAnchor (VM141677 Manager.js:71) at ScrollableAnchor.componentDidMount (VM141676 ScrollableAnchor.js:49) at commitLifeCycles (VM140120 react-dom.development.js:9784) at commitAllLifeCycles (VM140120 react-dom.development.js:11455) at HTMLUnknownElement.callCallback (VM140120 react-dom.development.js:100) at Object.invokeGuardedCallbackDev (VM140120 react-dom.development.js:138) at invokeGuardedCallback (VM140120 react-dom.development.js:187) at commitRoot (VM140120 react-dom.development.js:11594) at completeRoot (VM140120 react-dom.development.js:12502)Manager.addListeners @ VM141677 Manager.js:46Manager.addAnchor @ VM141677 Manager.js:71componentDidMount @ VM141676 ScrollableAnchor.js:49commitLifeCycles @ VM140120 react-dom.development.js:9784commitAllLifeCycles @ VM140120 react-dom.development.js:11455callCallback @ VM140120 react-dom.development.js:100invokeGuardedCallbackDev @ VM140120 react-dom.development.js:138invokeGuardedCallback @ VM140120 react-dom.development.js:187commitRoot @ VM140120 react-dom.development.js:11594completeRoot @ VM140120 react-dom.development.js:12502performWorkOnRoot @ VM140120 react-dom.development.js:12452performWork @ VM140120 react-dom.development.js:12370performSyncWork @ VM140120 react-dom.development.js:12347requestWork @ VM140120 react-dom.development.js:12247scheduleWorkImpl @ VM140120 react-dom.development.js:12122scheduleWork @ VM140120 react-dom.development.js:12082enqueueSetState @ VM140120 react-dom.development.js:6644Component.setState @ VM140110 react.development.js:238(anonymous) @ VM141979 index.js:219Promise.then (async)loadComponent @ VM141979 index.js:218componentDidUpdate @ VM141979 index.js:100commitLifeCycles @ VM140120 react-dom.development.js:9792commitAllLifeCycles @ VM140120 react-dom.development.js:11455callCallback @ VM140120 react-dom.development.js:100invokeGuardedCallbackDev @ VM140120 react-dom.development.js:138invokeGuardedCallback @ VM140120 react-dom.development.js:187commitRoot @ VM140120 react-dom.development.js:11594completeRoot @ VM140120 react-dom.development.js:12502performWorkOnRoot @ VM140120 react-dom.development.js:12452performWork @ VM140120 react-dom.development.js:12370performSyncWork @ VM140120 react-dom.development.js:12347requestWork @ VM140120 react-dom.development.js:12247scheduleWorkImpl @ VM140120 react-dom.development.js:12122scheduleWork @ VM140120 react-dom.development.js:12082enqueueSetState @ VM140120 react-dom.development.js:6644Component.setState @ VM140110 react.development.js:238onStateChange @ VM140140 connectAdvanced.js:215notify @ VM140143 Subscription.js:28notifyNestedSubs @ VM140143 Subscription.js:67onStateChange @ VM140140 connectAdvanced.js:212notify @ VM140143 Subscription.js:28notifyNestedSubs @ VM140143 Subscription.js:67onStateChange @ VM140140 connectAdvanced.js:212notify @ VM140143 Subscription.js:28notifyNestedSubs @ VM140143 Subscription.js:67onStateChange @ VM140140 connectAdvanced.js:212dispatch @ VM140147 redux.js:227dispatch @ VM139687:1(anonymous) @ VM140197 middleware.js:18(anonymous) @ VM141240 middleware.js:71dispatch @ VM140147 redux.js:569(anonymous) @ VM140340 utils.js:283(anonymous) @ VM141242 proc.js:499exec @ VM140346 scheduler.js:23flush @ VM140346 scheduler.js:64asap @ VM140346 scheduler.js:37runPutEffect @ VM141242 proc.js:496runEffect @ VM141242 proc.js:445next @ VM141242 proc.js:325currCb @ VM141242 proc.js:398Promise.then (async)resolvePromise @ VM141242 proc.js:460runCallEffect @ VM141242 proc.js:527runEffect @ VM141242 proc.js:445next @ VM141242 proc.js:325currCb @ VM141242 proc.js:398end @ VM141242 proc.js:366task.cont @ VM141242 proc.js:109next @ VM141242 proc.js:331currCb @ VM141242 proc.js:398Promise.then (async)resolvePromise @ VM141242 proc.js:460runCallEffect @ VM141242 proc.js:527runEffect @ VM141242 proc.js:445next @ VM141242 proc.js:325currCb @ VM141242 proc.js:398runCallEffect @ VM141242 proc.js:527runEffect @ VM141242 proc.js:445next @ VM141242 proc.js:325currCb @ VM141242 proc.js:398runSelectEffect @ VM141242 proc.js:709runEffect @ VM141242 proc.js:445next @ VM141242 proc.js:325proc @ VM141242 proc.js:280resolveIterator @ VM141242 proc.js:466runCallEffect @ VM141242 proc.js:527runEffect @ VM141242 proc.js:445next @ VM141242 proc.js:325currCb @ VM141242 proc.js:398runSelectEffect @ VM141242 proc.js:709runEffect @ VM141242 proc.js:445next @ VM141242 proc.js:325currCb @ VM141242 proc.js:398(anonymous) @ VM141242 proc.js:509exec @ VM140346 scheduler.js:23flush @ VM140346 scheduler.js:64asap @ VM140346 scheduler.js:37runPutEffect @ VM141242 proc.js:496runEffect @ VM141242 proc.js:445next @ VM141242 proc.js:325proc @ VM141242 proc.js:280runSaga @ VM141241 runSaga.js:53injectSaga @ VM140283 sagaInjectors.js:70componentWillMount @ VM140281 injectSaga.js:61callComponentWillMount @ VM140120 react-dom.development.js:6872mountClassInstance @ VM140120 react-dom.development.js:6968updateClassComponent @ VM140120 react-dom.development.js:8337beginWork @ VM140120 react-dom.development.js:8982performUnitOfWork @ VM140120 react-dom.development.js:11814workLoop @ VM140120 react-dom.development.js:11843renderRoot @ VM140120 react-dom.development.js:11874performWorkOnRoot @ VM140120 react-dom.development.js:12449performWork @ VM140120 react-dom.development.js:12370performSyncWork @ VM140120 react-dom.development.js:12347requestWork @ VM140120 react-dom.development.js:12247scheduleWorkImpl @ VM140120 react-dom.development.js:12122scheduleWork @ VM140120 react-dom.development.js:12082enqueueSetState @ VM140120 react-dom.development.js:6644Component.setState @ VM140110 react.development.js:238update @ VM140242 index.js:196(anonymous) @ VM140242 index.js:206Promise.then (async)componentWillMount @ VM140242 index.js:205callComponentWillMount @ VM140120 react-dom.development.js:6872mountClassInstance @ VM140120 react-dom.development.js:6968updateClassComponent @ VM140120 react-dom.development.js:8337beginWork @ VM140120 react-dom.development.js:8982performUnitOfWork @ VM140120 react-dom.development.js:11814workLoop @ VM140120 react-dom.development.js:11843renderRoot @ VM140120 react-dom.development.js:11874performWorkOnRoot @ VM140120 react-dom.development.js:12449performWork @ VM140120 react-dom.development.js:12370performSyncWork @ VM140120 react-dom.development.js:12347requestWork @ VM140120 react-dom.development.js:12247scheduleWorkImpl @ VM140120 react-dom.development.js:12122scheduleWork @ VM140120 react-dom.development.js:12082scheduleRootUpdate @ VM140120 react-dom.development.js:12710updateContainerAtExpirationTime @ VM140120 react-dom.development.js:12738updateContainer @ VM140120 react-dom.development.js:12765ReactRoot.render @ VM140120 react-dom.development.js:16069(anonymous) @ VM140120 react-dom.development.js:16488unbatchedUpdates @ VM140120 react-dom.development.js:12557legacyRenderSubtreeIntoContainer @ VM140120 react-dom.development.js:16484render @ VM140120 react-dom.development.js:16543render @ VM140107 app.js:103(anonymous) @ VM140107 app.js:132(anonymous) @ VM140107 app.js:133hotApply @ VM139706 main.js:605cb @ VM139726 process-update.js:52(anonymous) @ VM139726 process-update.js:68Promise.then (async)check @ VM139726 process-update.js:67module.exports @ VM139726 process-update.js:28processMessage @ VM139711 client.js:228handleMessage @ VM139711 client.js:111handleMessage @ VM139711 client.js:74VM141677 Manager.js:51 Uncaught TypeError: Cannot read property 'removeEventListener' of null at Manager.removeListeners (VM141677 Manager.js:51) at Manager.removeAnchor (VM141677 Manager.js:81) at ScrollableAnchor.componentWillUnmount (VM141676 ScrollableAnchor.js:54) at callComponentWillUnmountWithTimer (VM140120 react-dom.development.js:9703) at HTMLUnknownElement.callCallback (VM140120 react-dom.development.js:100) at Object.invokeGuardedCallbackDev (VM140120 react-dom.development.js:138) at invokeGuardedCallback (VM140120 react-dom.development.js:187) at safelyCallComponentWillUnmount (VM140120 react-dom.development.js:9710) at commitUnmount (VM140120 react-dom.development.js:9956) at commitNestedUnmounts (VM140120 react-dom.development.js:9992)Manager.removeListeners @ VM141677 Manager.js:51Manager.removeAnchor @ VM141677 Manager.js:81componentWillUnmount @ VM141676 ScrollableAnchor.js:54callComponentWillUnmountWithTimer @ VM140120 react-dom.development.js:9703callCallback @ VM140120 react-dom.development.js:100invokeGuardedCallbackDev @ VM140120 react-dom.development.js:138invokeGuardedCallback @ VM140120 react-dom.development.js:187safelyCallComponentWillUnmount @ VM140120 react-dom.development.js:9710commitUnmount @ VM140120 react-dom.development.js:9956commitNestedUnmounts @ VM140120 react-dom.development.js:9992unmountHostComponents @ VM140120 react-dom.development.js:10279commitDeletion @ VM140120 react-dom.development.js:10329commitAllHostEffects @ VM140120 react-dom.development.js:11413callCallback @ VM140120 react-dom.development.js:100invokeGuardedCallbackDev @ VM140120 react-dom.development.js:138invokeGuardedCallback @ VM140120 react-dom.development.js:187commitRoot @ VM140120 react-dom.development.js:11559completeRoot @ VM140120 react-dom.development.js:12502performWorkOnRoot @ VM140120 react-dom.development.js:12452performWork @ VM140120 react-dom.development.js:12370performSyncWork @ VM140120 react-dom.development.js:12347requestWork @ VM140120 react-dom.development.js:12247scheduleWorkImpl @ VM140120 react-dom.development.js:12122scheduleWork @ VM140120 react-dom.development.js:12082enqueueSetState @ VM140120 react-dom.development.js:6644Component.setState @ VM140110 react.development.js:238(anonymous) @ VM141979 index.js:219Promise.then (async)loadComponent @ VM141979 index.js:218componentDidUpdate @ VM141979 index.js:100commitLifeCycles @ VM140120 react-dom.development.js:9792commitAllLifeCycles @ VM140120 react-dom.development.js:11455callCallback @ VM140120 react-dom.development.js:100invokeGuardedCallbackDev @ VM140120 react-dom.development.js:138invokeGuardedCallback @ VM140120 react-dom.development.js:187commitRoot @ VM140120 react-dom.development.js:11594completeRoot @ VM140120 react-dom.development.js:12502performWorkOnRoot @ VM140120 react-dom.development.js:12452performWork @ VM140120 react-dom.development.js:12370performSyncWork @ VM140120 react-dom.development.js:12347requestWork @ VM140120 react-dom.development.js:12247scheduleWorkImpl @ VM140120 react-dom.development.js:12122scheduleWork @ VM140120 react-dom.development.js:12082enqueueSetState @ VM140120 react-dom.development.js:6644Component.setState @ VM140110 react.development.js:238onStateChange @ VM140140 connectAdvanced.js:215notify @ VM140143 Subscription.js:28notifyNestedSubs @ VM140143 Subscription.js:67onStateChange @ VM140140 connectAdvanced.js:212notify @ VM140143 Subscription.js:28notifyNestedSubs @ VM140143 Subscription.js:67onStateChange @ VM140140 connectAdvanced.js:212notify @ VM140143 Subscription.js:28notifyNestedSubs @ VM140143 Subscription.js:67onStateChange @ VM140140 connectAdvanced.js:212dispatch @ VM140147 redux.js:227dispatch @ VM139687:1(anonymous) @ VM140197 middleware.js:18(anonymous) @ VM141240 middleware.js:71dispatch @ VM140147 redux.js:569(anonymous) @ VM140340 utils.js:283(anonymous) @ VM141242 proc.js:499exec @ VM140346 scheduler.js:23flush @ VM140346 scheduler.js:64asap @ VM140346 scheduler.js:37runPutEffect @ VM141242 proc.js:496runEffect @ VM141242 proc.js:445next @ VM141242 proc.js:325currCb @ VM141242 proc.js:398Promise.then (async)resolvePromise @ VM141242 proc.js:460runCallEffect @ VM141242 proc.js:527runEffect @ VM141242 proc.js:445next @ VM141242 proc.js:325currCb @ VM141242 proc.js:398end @ VM141242 proc.js:366task.cont @ VM141242 proc.js:109next @ VM141242 proc.js:331currCb @ VM141242 proc.js:398Promise.then (async)resolvePromise @ VM141242 proc.js:460runCallEffect @ VM141242 proc.js:527runEffect @ VM141242 proc.js:445next @ VM141242 proc.js:325currCb @ VM141242 proc.js:398runCallEffect @ VM141242 proc.js:527runEffect @ VM141242 proc.js:445next @ VM141242 proc.js:325currCb @ VM141242 proc.js:398runSelectEffect @ VM141242 proc.js:709runEffect @ VM141242 proc.js:445next @ VM141242 proc.js:325proc @ VM141242 proc.js:280resolveIterator @ VM141242 proc.js:466runCallEffect @ VM141242 proc.js:527runEffect @ VM141242 proc.js:445next @ VM141242 proc.js:325currCb @ VM141242 proc.js:398runSelectEffect @ VM141242 proc.js:709runEffect @ VM141242 proc.js:445next @ VM141242 proc.js:325currCb @ VM141242 proc.js:398(anonymous) @ VM141242 proc.js:509exec @ VM140346 scheduler.js:23flush @ VM140346 scheduler.js:64asap @ VM140346 scheduler.js:37runPutEffect @ VM141242 proc.js:496runEffect @ VM141242 proc.js:445next @ VM141242 proc.js:325proc @ VM141242 proc.js:280runSaga @ VM141241 runSaga.js:53injectSaga @ VM140283 sagaInjectors.js:70componentWillMount @ VM140281 injectSaga.js:61callComponentWillMount @ VM140120 react-dom.development.js:6872mountClassInstance @ VM140120 react-dom.development.js:6968updateClassComponent @ VM140120 react-dom.development.js:8337beginWork @ VM140120 react-dom.development.js:8982performUnitOfWork @ VM140120 react-dom.development.js:11814workLoop @ VM140120 react-dom.development.js:11843renderRoot @ VM140120 react-dom.development.js:11874performWorkOnRoot @ VM140120 react-dom.development.js:12449performWork @ VM140120 react-dom.development.js:12370performSyncWork @ VM140120 react-dom.development.js:12347requestWork @ VM140120 react-dom.development.js:12247scheduleWorkImpl @ VM140120 react-dom.development.js:12122scheduleWork @ VM140120 react-dom.development.js:12082enqueueSetState @ VM140120 react-dom.development.js:6644Component.setState @ VM140110 react.development.js:238update @ VM140242 index.js:196(anonymous) @ VM140242 index.js:206Promise.then (async)componentWillMount @ VM140242 index.js:205callComponentWillMount @ VM140120 react-dom.development.js:6872mountClassInstance @ VM140120 react-dom.development.js:6968updateClassComponent @ VM140120 react-dom.development.js:8337beginWork @ VM140120 react-dom.development.js:8982performUnitOfWork @ VM140120 react-dom.development.js:11814workLoop @ VM140120 react-dom.development.js:11843renderRoot @ VM140120 react-dom.development.js:11874performWorkOnRoot @ VM140120 react-dom.development.js:12449performWork @ VM140120 react-dom.development.js:12370performSyncWork @ VM140120 react-dom.development.js:12347requestWork @ VM140120 react-dom.development.js:12247scheduleWorkImpl @ VM140120 react-dom.development.js:12122scheduleWork @ VM140120 react-dom.development.js:12082scheduleRootUpdate @ VM140120 react-dom.development.js:12710updateContainerAtExpirationTime @ VM140120 react-dom.development.js:12738updateContainer @ VM140120 react-dom.development.js:12765ReactRoot.render @ VM140120 react-dom.development.js:16069(anonymous) @ VM140120 react-dom.development.js:16488unbatchedUpdates @ VM140120 react-dom.development.js:12557legacyRenderSubtreeIntoContainer @ VM140120 react-dom.development.js:16484render @ VM140120 react-dom.development.js:16543render @ VM140107 app.js:103(anonymous) @ VM140107 app.js:132(anonymous) @ VM140107 app.js:133hotApply @ VM139706 main.js:605cb @ VM139726 process-update.js:52(anonymous) @ VM139726 process-update.js:68Promise.then (async)check @ VM139726 process-update.js:67module.exports @ VM139726 process-update.js:28processMessage @ VM139711 client.js:228handleMessage @ VM139711 client.js:111handleMessage @ VM139711 client.js:742VM140120 react-dom.development.js:9643 The above error occurred in the <ScrollableAnchor> component: in ScrollableAnchor (created by PartCAllCompleters) in PartCAllCompleters (created by pure(PartCAllCompleters)) in pure(PartCAllCompleters) in ChildrenWrapper (created by FormContext) in FormContext in Unknown (created by withSaga(Component)) in withSaga(Component) (created by Completions1) in td (created by Completions1) in tr (created by Completions1) in tbody (created by Completions1) in table (created by Completions1) in Completions1 (created by Completions1) in Completions1 (created by FormLoader) in div (created by FormLoader) in FormLoader (created by Connect(FormLoader)) in Connect(FormLoader) (created by FormWrapper) in div (created by FormWrapper__MainFormStyleWrapper) in FormWrapper__MainFormStyleWrapper (created by FormWrapper) in div (created by Segment) in Segment (created by FormWrapper) in div (created by FormWrapper) in FormWrapper (created by Connect(FormWrapper)) in Connect(FormWrapper) (created by SurveyFormPage) in div (created by GridColumn) in GridColumn (created by SurveyFormPage) in div (created by Grid) in Grid (created by SurveyFormPage) in div (created by SurveyFormPage) in div in Unknown (created by Spacing__VerticalSpacingWrapper) in Spacing__VerticalSpacingWrapper (created by Spacing) in div (created by Spacing) in Spacing (created by SurveyFormPage) in div (created by SurveyFormPage) in SurveyFormPage (created by Connect(SurveyFormPage)) in Connect(SurveyFormPage) (created by withSaga(Connect(SurveyFormPage))) in withSaga(Connect(SurveyFormPage)) (created by withReducer(withSaga(Connect(SurveyFormPage)))) in withReducer(withSaga(Connect(SurveyFormPage))) (created by LoadableComponent) in LoadableComponent (created by Route) in Route (created by App) in Switch (created by App) in div (created by AppWrapper__AppContainer) in AppWrapper__AppContainer (created by AppWrapper) in div (created by SidebarPusher) in SidebarPusher (created by SidebarModalConnector) in Ref (created by SidebarModalConnector) in div (created by SidebarPushable) in SidebarPushable (created by SidebarModal__StyledPushableSidebar) in SidebarModal__StyledPushableSidebar (created by SidebarModalConnector) in Ref (created by SidebarModalConnector) in SidebarModalConnector (created by AppWrapper) in AppWrapper (created by Connect(AppWrapper)) in Connect(AppWrapper) (created by App) in App (created by Connect(App)) in Connect(App) (created by Route) in Route (created by withRouter(Connect(App))) in withRouter(Connect(App)) in Router (created by ConnectedRouter) in ConnectedRouter in KeycloakProvider (created by Connect(KeycloakProvider)) in Connect(KeycloakProvider) (created by withSaga(Connect(KeycloakProvider))) in withSaga(Connect(KeycloakProvider)) (created by withReducer(withSaga(Connect(KeycloakProvider)))) in withReducer(withSaga(Connect(KeycloakProvider))) in IntlProvider (created by LanguageProvider) in LanguageProvider (created by Connect(LanguageProvider)) in Connect(LanguageProvider) in ThemeProvider in Provider
Consider adding an error boundary to your tree to customize error handling behavior.Visit https://fb.me/react-error-boundaries to learn more about error boundaries.
On Thursday, May 10, 2018, 2:45:39 PM PDT, David Bramwell <[email protected]> wrote:
Can you give me more info? What do the errors say? Any chance I can see the code?
The ScrollAnchors need to be inside the scrollable container.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub, or mute the thread.
|
"Cannot read property 'addEventListener' of null" - this is the telling part. Means that config.container is set to null. this.config.container = document.getElementById(this.config.containerId) The fact that it's null means that there are no elements found by the id that you are passing into configureAnchors. Are you sure you are using the correct id of your scrollable container? Notice where 'scrolling-div' is set in example 5: Sorry for the lack of formatting in this comment, writing on a phone |
I was able to set the containerId correctly in the wrapper container I'm using...it's called SurveyFormPage...it looks a bit like this in the render method:
<div role="main" aria-labelledby="mainHeader" >
<Grid>
<Grid.Column width={3} only="computer">
<StickyBox style={{ paddingTop: '65px' }}>
<Grid>
<Grid.Column width={2} only="computer" style={{ minWidth: '100%' }}>
<Segment.Group key={'key'}>
<SurveySidebarQuickNav sections={[{ key: 0, menuItem: 'Overview' }, { key: 1, menuItem: 'CIP Data' }, { key: 2, menuItem: 'All Completers' }, { key: 3, menuItem: 'Completers By Level' }]} />
</Segment.Group>
</Grid.Column>
</Grid>
</StickyBox>
</Grid.Column>
<Grid.Column computer={10} tablet={16} mobile={16} >
<div id="scrolling-div">
<FormWrapper />
</div>
</Grid.Column>
<Grid.Column width={3} only="computer">
<FormActionsRail workflowStatusType={workflowStatusType} />
</Grid.Column>
</Grid>
</div> componentWillMount() {
configureAnchors({ containerId: 'scrolling-div' });
}in this container and those errors have disappeared...however when I click on the sidebar menuitems that are part of the SurveySidebarQuickNav component above nothing happens and no errors are thrown. The FormWrapper component above is a component that fetches the form which I want to navigate to and has the ScrollableAnchor tags defined within these forms which are loaded dynamically based on a surveyId. These ScrollableAnchors I've placed around the sections which are all broken out into their own containers. So I believe something is losing context of where the anchors are defined...I'm not sure.
On Friday, May 11, 2018, 1:02:52 AM PDT, David Bramwell <[email protected]> wrote:
"Cannot read property 'addEventListener' of null" - this is the telling part. Means that config.container is set to null.
this.config.container = document.getElementById(this.config.containerId)
The fact that it's null means that there are no elements found by the id that you are passing into configureAnchors. Are you sure you are using the correct id of your scrollable container? Notice where 'scrolling-div' is set in example 5:
https://github.com/dbramwell/react-scrollable-anchor/blob/master/example/src/components/Example5.js
Sorry for the lack of formatting in this comment, writing on a phone
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub, or mute the thread.
|
Do I need to pass any props down from the wrapper component where I specify the containerId to the child components where I am placing the ScrollableAnchor tags?
On Friday, May 11, 2018, 1:02:52 AM PDT, David Bramwell <[email protected]> wrote:
"Cannot read property 'addEventListener' of null" - this is the telling part. Means that config.container is set to null.
this.config.container = document.getElementById(this.config.containerId)
The fact that it's null means that there are no elements found by the id that you are passing into configureAnchors. Are you sure you are using the correct id of your scrollable container? Notice where 'scrolling-div' is set in example 5:
https://github.com/dbramwell/react-scrollable-anchor/blob/master/example/src/components/Example5.js
Sorry for the lack of formatting in this comment, writing on a phone
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub, or mute the thread.
|
Do I need to pass any props down from the Parent wrapper component where I specify the containerId to the child components where I specify the ScrollableAnchor tags?
On Friday, May 11, 2018, 1:02:52 AM PDT, David Bramwell <[email protected]> wrote:
"Cannot read property 'addEventListener' of null" - this is the telling part. Means that config.container is set to null.
this.config.container = document.getElementById(this.config.containerId)
The fact that it's null means that there are no elements found by the id that you are passing into configureAnchors. Are you sure you are using the correct id of your scrollable container? Notice where 'scrolling-div' is set in example 5:
https://github.com/dbramwell/react-scrollable-anchor/blob/master/example/src/components/Example5.js
Sorry for the lack of formatting in this comment, writing on a phone
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub, or mute the thread.
|
A couple of questions now.
You say FormWrapper loads the form which contains the anchors. The id passed to configureAnchors needs to point to the div that has the scroll bar. In your example, is it the div with the id 'scrolling-div', or is it infact whatever is created by FormWrapper, that has the scrollbar? |
The url is changing http://localhost:3000/survey/33b7406a-9783-44cf-9074-8f833ad04b63/form#2 <-- here is the #
and
FormWrapper loads the form which is made up of separate sections which correlate to the different anchors I want to navigate to yes. On Friday, May 11, 2018, 1:59:02 PM PDT, David Bramwell <[email protected]> wrote:
A couple of questions now.
-
When you click a menu option in , does the hash in the url in the browser change? react-scrollable-anchor listens for hash changes, for example if you click the 'section 3' link on example page above, the url in the browser changes to 'https://dbramwell.github.io/react-scrollable-anchor/#section3'. The library sees this and then scrolls the component to the
-
You say FormWrapper loads the form which contains the anchors. The id passed to configureAnchors needs to point to the div that has the scroll bar. In your example, is it the div or whatever is created by FormWrapper that has the scrollbar?
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub, or mute the thread.
|
To clarify...the FormWrapper gathers the data for the form (which for this survey consists of 4 sections) asynchronously via a react saga. I wrapped each section of the form in the <ScrollableAnchor> tag.
On Friday, May 11, 2018, 1:59:02 PM PDT, David Bramwell <[email protected]> wrote:
A couple of questions now.
-
When you click a menu option in , does the hash in the url in the browser change? react-scrollable-anchor listens for hash changes, for example if you click the 'section 3' link on example page above, the url in the browser changes to 'https://dbramwell.github.io/react-scrollable-anchor/#section3'. The library sees this and then scrolls the component to the
-
You say FormWrapper loads the form which contains the anchors. The id passed to configureAnchors needs to point to the div that has the scroll bar. In your example, is it the div or whatever is created by FormWrapper that has the scrollbar?
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub, or mute the thread.
|
and passed in the correct anchor id of course that correlates to the anchors I specified on the link as in example5
On Friday, May 11, 2018, 1:59:02 PM PDT, David Bramwell <[email protected]> wrote:
A couple of questions now.
-
When you click a menu option in , does the hash in the url in the browser change? react-scrollable-anchor listens for hash changes, for example if you click the 'section 3' link on example page above, the url in the browser changes to 'https://dbramwell.github.io/react-scrollable-anchor/#section3'. The library sees this and then scrolls the component to the
-
You say FormWrapper loads the form which contains the anchors. The id passed to configureAnchors needs to point to the div that has the scroll bar. In your example, is it the div or whatever is created by FormWrapper that has the scrollbar?
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub, or mute the thread.
|
Can you share the structure of the FormWrapper? If you have all the ids named correctly then the only thing I can think of that would cause this is the 'scrollable-div' not actually being scrollable. Are you sure the scrolling isn't happening on the FormWrapper itself? Or on something inside it? I think it's unlikely that the ajax part is causing it. You can test that by disabling the ajax stuff and filling the FormWrapper with a static form and checking if you're still getting the same behaviour. |
Hey David...I ended up using react-router-hash-link . It was very simple to implement the scrolling...thank you for your help.
|
|
|
| | |
|
|
|
| |
react-router-hash-link
Hash link scroll functionality for React Router v4
|
|
|
On Saturday, May 12, 2018, 1:22:08 AM PDT, David Bramwell <[email protected]> wrote:
Can you share the structure of the FormWrapper? If you have all the ids named correctly then the only thing I can think of that would cause this is the 'scrollable-div' not actually being scrollable. Are you sure the scrolling isn't happening on the FormWrapper itself? Or on something inside it?
I think it's unlikely that the ajax part is causing it. You can test that by disabling the ajax stuff and filling the FormWrapper with a static form and checking if you're still getting the same behaviour.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub, or mute the thread.
|
No description provided.