react-native-keyboard-aware-scroll-view: scrollToPosition does not work on Android
scrollToPosition works fine on iOS but does not work on Android.
I’ve set windowSoftInputMode
to adjustPan
Any idea how to make it work on android?
let scroll;
const scrollPosition = 200;
const SignupForm = (props: Props) => (
<KeyboardAwareScrollView
contentContainerStyle={styles.container}
keyboardShouldPersistTaps="always"
enableOnAndroid
enableAutomaticScroll={false}
innerRef={(ref) => { scroll = ref; }}
>
<View style={styles.row}>
<TextField
title={props.intl.formatMessage({ id: 'SignupForm.field.email' })}
value={props.signupForm.email}
onFocus={() => scroll.props.scrollToPosition(0, scrollPosition)}
/>
</View>
{/* ....More TextFields here.... */}
<View style={styles.row}>
<TextField
title={props.intl.formatMessage({ id: 'SignupForm.field.password' })}
value={props.signupForm.password}
onFocus={() => scroll.props.scrollToPosition(0, scrollPosition)}
/>
</View>
<View style={styles.row}>
<Button
onPress={props.onSubmitForm}
label={props.intl.formatMessage({ id: 'SignupForm.createAccount' })}
/>
</View>
</KeyboardAwareScrollView>
);
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Comments: 19
v"^0.7.2"
,scrollTo({x: X, y: Y})
does not working for androidit does not work for me either! using react-native 0.59.8 and react-native-keyboard-aware-scroll-view 0.8.0
change MainActivity
android:windowSoftInputMode="adjustResize"
toandroid:windowSoftInputMode="adjustPan"
solve my problemI fixed that by changing the following function in KeyboardAwareHOC.js:
to
scrollResponderScrollTo is deprecated now.
@Moreno97 It will give me this error