Skip to content

Commit a7de5e1

Browse files
Fix the bug that style in contentContainerStyle could be ignored
1 parent 408a991 commit a7de5e1

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

lib/KeyboardAwareListView.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,15 +35,15 @@ const KeyboardAwareListView = createReactClass({
3535
let newContentContainerStyle
3636

3737
if (Platform.OS === 'android' && enableOnAndroid) {
38-
newContentContainerStyle = {}
39-
newContentContainerStyle.paddingBottom = (contentContainerStyle ? contentContainerStyle.paddingBottom : 0) + keyboardSpace
38+
newContentContainerStyle = Object.assign({}, contentContainerStyle)
39+
newContentContainerStyle.paddingBottom = (newContentContainerStyle.paddingBottom || 0) + keyboardSpace
4040
}
4141

4242
return (
4343
<ListView
4444
ref='_rnkasv_keyboardView'
4545
keyboardDismissMode='interactive'
46-
contentInset={{bottom: this.state.keyboardSpace}}
46+
contentInset={{bottom: keyboardSpace}}
4747
showsVerticalScrollIndicator={true}
4848
scrollEventThrottle={0}
4949
{...this.props}

lib/KeyboardAwareScrollView.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,15 +36,15 @@ const KeyboardAwareScrollView = createReactClass({
3636
let newContentContainerStyle
3737

3838
if (Platform.OS === 'android' && enableOnAndroid) {
39-
newContentContainerStyle = {}
40-
newContentContainerStyle.paddingBottom = (contentContainerStyle ? contentContainerStyle.paddingBottom : 0) + keyboardSpace
39+
newContentContainerStyle = Object.assign({}, contentContainerStyle)
40+
newContentContainerStyle.paddingBottom = (newContentContainerStyle.paddingBottom || 0) + keyboardSpace
4141
}
4242

4343
return (
4444
<ScrollView
4545
ref='_rnkasv_keyboardView'
4646
keyboardDismissMode='interactive'
47-
contentInset={{bottom: this.state.keyboardSpace}}
47+
contentInset={{bottom: keyboardSpace}}
4848
showsVerticalScrollIndicator={true}
4949
scrollEventThrottle={0}
5050
{...this.props}

0 commit comments

Comments
 (0)