Skip to content

Commit

Permalink
fix: fix missing waypoint ancenstor prop & refine constant declaration
Browse files Browse the repository at this point in the history
  • Loading branch information
duidae committed Nov 8, 2022
1 parent c6f726e commit cd520f2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 2 additions & 0 deletions packages/dual-channel/src/app/components/text/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import React from 'react'
import styled from 'styled-components'
import { Waypoint } from 'react-waypoint'
import { connect } from 'react-redux'
import { scrollableAncestor } from '../../constants/customized-props'

const _ = {
get,
Expand Down Expand Up @@ -110,6 +111,7 @@ class ArticleText extends React.Component {
const _renderSection = (section, sectionIndex) => {
const sectionJsx = (
<Waypoint
scrollableAncestor={scrollableAncestor}
key={section.id}
id={section.id}
topOffset="49%"
Expand Down
4 changes: 2 additions & 2 deletions packages/dual-channel/src/app/constants/customized-props.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
const isClientSide =
typeof window !== 'undefined' && typeof window.document !== 'undefined'

let scrollableAncestorValue =
const scrollableAncestorValue =
isClientSide &&
document.currentScript.getAttribute('data-scrollable-ancestor')
export const scrollableAncestor = scrollableAncestorValue || undefined

let offsetTopValue =
const offsetTopValue =
isClientSide && document.currentScript.getAttribute('data-offset-top')
export const offsetTop =
offsetTopValue &&
Expand Down

0 comments on commit cd520f2

Please sign in to comment.