From 904c7228f50f30a44e3f59aece4eeecbf19892a9 Mon Sep 17 00:00:00 2001 From: makotot Date: Wed, 16 Aug 2017 02:09:19 +0900 Subject: [PATCH] pass active el --- src/js/app.jsx | 4 ++-- src/js/lib/Scrollspy.jsx | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/js/app.jsx b/src/js/app.jsx index 6d76891..637c705 100644 --- a/src/js/app.jsx +++ b/src/js/app.jsx @@ -30,8 +30,8 @@ class App extends React.Component { style={ {fontWeight: 300} } offset={ -20 } onUpdate={ - () => { - console.log(this) + (el) => { + console.log(el) } } > diff --git a/src/js/lib/Scrollspy.jsx b/src/js/lib/Scrollspy.jsx index 91e26ac..73a20c4 100644 --- a/src/js/lib/Scrollspy.jsx +++ b/src/js/lib/Scrollspy.jsx @@ -205,7 +205,7 @@ export default class Scrollspy extends React.Component { return } - this.props.onUpdate() + this.props.onUpdate(this.state.targetItems[this.state.inViewState.indexOf(true)]) } _handleSpy () {