Skip to content

Commit ffedf32

Browse files
Noah Livelyalvaromb
authored andcommitted
Allow scroll to a specific position (#19)
* allow scroll to a specific position * Update KeyboardAwareMixin.js Applied suggestions from @APSL to add the `animated` parameter to this function and specify flow annotations
1 parent 4fb14a2 commit ffedf32

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,5 @@ AwesomeProject.xcodeproj
44
AwesomeProjectTests
55
index.ios.js
66
iOS
7+
8+
.idea/

lib/KeyboardAwareMixin.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,13 @@ const KeyboardAwareMixin = {
4848
this.keyboardWillHideEvent.remove()
4949
},
5050

51+
scrollToPosition: function (x: number, y: number, animated: bool = false) {
52+
const scrollView = this.refs.keyboardView.getScrollResponder()
53+
this.setTimeout(() => {
54+
scrollView.scrollResponderScrollTo({x: x, y: y, animated: animated});
55+
}, 220)
56+
},
57+
5158
/**
5259
* @param extraHeight: takes an extra height in consideration.
5360
*/

0 commit comments

Comments
 (0)