Skip to content

Commit

Permalink
🔥 Remove console logs
Browse files Browse the repository at this point in the history
  • Loading branch information
hsunpei committed Jan 5, 2025
1 parent fb63782 commit 72dc996
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 22 deletions.
8 changes: 8 additions & 0 deletions apps/docs/pages/react-spring.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,14 @@ export const Section = () => {

### Example

You can simply the example in [track grouped sections](/track_grouped_sections) and use `useActiveSectionSpring()` to get the active section information and the updated `SpringValue` based on the scroll progress:

```tsx
import { useActiveSectionSpring } from '@react-scrollytelling/react-spring';

const { trackingId, scrolledRatioSpring } = useActiveSectionSpring();
```

<div className="mx-2 my-12">
<ScrollytellingProvider>
<StickyContainerTailwind
Expand Down
2 changes: 1 addition & 1 deletion apps/docs/pages/track_grouped_sections.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ module.exports = {
// ...
content: [
// path to the library
'../../node_modules/@react-scrollytelling/layout/**/*.{js,jsx,ts,tsx}',
'./node_modules/@react-scrollytelling/layout/**/*.{js,jsx,ts,tsx}',
],
};
```
Original file line number Diff line number Diff line change
Expand Up @@ -67,12 +67,6 @@ export const ScrollytellingProvider = ({ children }: ScrollytellingProviderProps

const activeSection = trackedSectionsRef.current.getSection(activeSectionId || '');

console.log('handleScroll', {
activeSectionId,
activeSection,
trackedSection: trackedSectionsRef.current,
});

// notify the active section about its scroll progress
if (activeSection) {
const { sectionTop, sectionBottom } = activeSection;
Expand Down Expand Up @@ -109,8 +103,6 @@ export const ScrollytellingProvider = ({ children }: ScrollytellingProviderProps

const onObserve = useCallback(
({ isIntersecting }: IntersectionObserverEntry) => {
console.log('*** ScrollytellingProvider > onObserve', isIntersecting);

// track scrolling only when the section is visible in viewport
if (isIntersecting) {
window.addEventListener('scroll', handleScrollThrottled);
Expand Down
10 changes: 0 additions & 10 deletions packages/grouped/src/hooks/section/useTrackedSectionScroll.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,6 @@ export function useTrackedSectionScroll(

const onObserve = useCallback(
({ isIntersecting }: IntersectionObserverEntry) => {
console.log('onObserve', isIntersecting, sectionID);

if (isIntersecting) {
const { scrollTop } = getScrollPosition();

Expand All @@ -56,15 +54,7 @@ export function useTrackedSectionScroll(
sectionBottom: (sectionRef.current?.getBoundingClientRect().bottom || 0) + scrollTop,
onActiveScroll: onScroll,
});

console.log('useTrackedSectionScroll > onObserve > added', sectionID, {
sectionTop: sectionRef.current?.getBoundingClientRect().top || 0,
sectionBottom: sectionRef.current?.getBoundingClientRect().bottom || 0,
onActiveScroll: onScroll,
});
} else {
console.log('useTrackedSectionScroll > onObserve > removed', sectionID);

// notify the scroll progress that isIntersecting = false
const { scrolledRatio = 0, scrollBottom = 0, distance = 0 } = scrollInfoRef.current || {};

Expand Down
3 changes: 0 additions & 3 deletions packages/video/src/components/Video.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@ export const VideoWithImperativeHandle = React.memo(
if (!isNaN(duration)) {
requestAnimationFrame(() => {
videoElement.currentTime = Math.round(ratio * duration * 100) / 100;
console.log('setRatio', ratio, Math.round(ratio * duration * 100) / 100);
});
}
}, []);
Expand All @@ -95,12 +94,10 @@ export const VideoWithImperativeHandle = React.memo(
);

const handleWaiting = useCallback(() => {
console.log('waiting');
setIsLoading(true);
}, []);

const handleCanPlay = useCallback(() => {
console.log('can play');
setIsLoading(false);
}, []);

Expand Down

0 comments on commit 72dc996

Please sign in to comment.