File tree Expand file tree Collapse file tree 2 files changed +14
-5
lines changed Expand file tree Collapse file tree 2 files changed +14
-5
lines changed Original file line number Diff line number Diff line change @@ -25,10 +25,7 @@ var ScrollableTabView = React.createClass({
2525 // Initialize the spring that will drive animations
2626 this . springSystem = new rebound . SpringSystem ( ) ;
2727 this . _scrollSpring = this . springSystem . createSpring ( ) ;
28- var springConfig = this . _scrollSpring . getSpringConfig ( ) ;
29- springConfig . tension = rebound . OrigamiValueConverter . tensionFromOrigamiValue ( 25 ) ;
30- springConfig . friction = rebound . OrigamiValueConverter . frictionFromOrigamiValue ( 8 ) ;
31- this . _scrollSpring . setOvershootClampingEnabled ( false ) ;
28+ this . _updateSpringConfig ( this . props ) ;
3229
3330 this . _scrollSpring . addListener ( {
3431 onSpringUpdate : ( ) => {
@@ -90,6 +87,18 @@ var ScrollableTabView = React.createClass({
9087 } ) ;
9188 } ,
9289
90+ componentWillReceiveProps ( nextProps ) {
91+ this . _updateSpringConfig ( nextProps ) ;
92+ } ,
93+
94+ _updateSpringConfig ( props ) {
95+ var springConfig = this . _scrollSpring . getSpringConfig ( ) ;
96+ springConfig . tension = rebound . OrigamiValueConverter . tensionFromOrigamiValue ( props . springTension || 25 ) ;
97+ springConfig . friction = rebound . OrigamiValueConverter . frictionFromOrigamiValue ( props . springFriction || 8 ) ;
98+
99+ this . _scrollSpring . setOvershootClampingEnabled ( ( typeof props . clampSpring === 'undefined' ) ? true : props . clampSpring ) ;
100+ } ,
101+
93102 goToPage ( pageNumber ) {
94103 this . _scrollSpring . setEndValue ( pageNumber ) ;
95104 this . _currentPage = pageNumber ;
Original file line number Diff line number Diff line change 11{
22 "name" : " react-native-scrollable-tab-view" ,
3- "version" : " 0.1.1 " ,
3+ "version" : " 0.1.2 " ,
44 "description" : " " ,
55 "main" : " index.js" ,
66 "scripts" : {
You can’t perform that action at this time.
0 commit comments