[React Native] multiline TextInput에 KeyboardAvoidingView 적용

쿠키몬스터·2023년 6월 22일
0

React Native

목록 보기
3/3
post-thumbnail

multiline이 활성화 되어 있는 TextInput은 KeyboardAvoidingView로 제대로 포커싱 되지 않는 이슈가 있다.
scrollEnabled를 비활성화 시키면 TextInput 포커싱 시 해당 TextInput의 위치로 잘 이동하게 된다.

<TextInput
  scrollEnabled={false}
  multiline={true}
/>

참고 문서

하지만 TextInput의 높이가 정해져 있는 경우, TextInput 내에 스크롤이 필요할 수 있다.

이 때엔 react-native-keyboard-aware-scroll-view 라이브러리를 사용하였다.

<KeyboardAwareScrollView>
  <View>
    <TextInput />
  </View>
</KeyboardAwareScrollView>
profile
React Native 개발자입니당

0개의 댓글