Skip to content

Commit 6e063a7

Browse files
iddanalvaromb
authored andcommitted
Support innerRef (APSL#162)
1 parent 92fa776 commit 6e063a7

File tree

4 files changed

+11
-4
lines changed

4 files changed

+11
-4
lines changed

lib/KeyboardAwareFlatList.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ const KeyboardAwareFlatList = createReactClass({
4949

5050
return (
5151
<FlatList
52-
ref='_rnkasv_keyboardView'
52+
ref={this.handleRef}
5353
keyboardDismissMode='interactive'
5454
contentInset={{bottom: keyboardSpace}}
5555
automaticallyAdjustContentInsets={false}

lib/KeyboardAwareListView.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ const KeyboardAwareListView = createReactClass({
4949

5050
return (
5151
<ListView
52-
ref='_rnkasv_keyboardView'
52+
ref={this.handleRef}
5353
keyboardDismissMode='interactive'
5454
contentInset={{bottom: keyboardSpace}}
5555
automaticallyAdjustContentInsets={false}

lib/KeyboardAwareMixin.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ const KeyboardAwareMixin = {
141141
},
142142

143143
getScrollResponder() {
144-
return this.refs._rnkasv_keyboardView && this.refs._rnkasv_keyboardView.getScrollResponder()
144+
return this._rnkasv_keyboardView && this._rnkasv_keyboardView.getScrollResponder()
145145
},
146146

147147
scrollToPosition: function (x: number, y: number, animated: boolean = true) {
@@ -199,6 +199,13 @@ const KeyboardAwareMixin = {
199199
handleOnScroll: function (e: SyntheticEvent & {nativeEvent: {contentOffset: number}}) {
200200
this.position = e.nativeEvent.contentOffset
201201
},
202+
203+
handleRef: function(ref) {
204+
this._rnkasv_keyboardView = ref
205+
if (this.props.innerRef) {
206+
this.props.innerRef(this._rnkasv_keyboardView)
207+
}
208+
},
202209
}
203210

204211
export default KeyboardAwareMixin

lib/KeyboardAwareScrollView.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ const KeyboardAwareScrollView = createReactClass({
4242

4343
return (
4444
<ScrollView
45-
ref='_rnkasv_keyboardView'
45+
ref={this.handleRef}
4646
keyboardDismissMode='interactive'
4747
contentInset={{bottom: keyboardSpace}}
4848
automaticallyAdjustContentInsets={false}

0 commit comments

Comments
 (0)