[3-2] TextInput 작동이 안됩니다
125
작성한 질문수 2
안녕하세요!
천천히 따라서 코딩 하고 있었는데, 잘 따라 한것 같은데 InputField 설정 이후에 LoginScreen에서 placeholder 가 작동하지 않아서보니 클릭해도 키보드가 열리지 않더라고요
InputField.tsx
import React from 'react';
import {
Dimensions,
StyleSheet,
Text,
TextInput,
TextInputProps,
View,
} from 'react-native';
import {colors} from '../constants';
interface InputFieldProps extends TextInputProps {
disabled?: boolean;
error?: string;
}
const deviceHeight = Dimensions.get('screen').height;
function InputField({disabled = false, error, ...props}: InputFieldProps) {
return (
<View
style={[
styles.container,
disabled && styles.disabled,
Boolean(error) && styles.inputError,
]}>
<TextInput
editable={!disabled}
placeholderTextColor={colors.GRAY_500}
style={[styles.input, disabled && styles.disabled]}
autoCapitalize="none"
spellCheck={false}
autoCorrect={false}
{...props}
/>
{Boolean(error) && <Text style={styles.error}>{error}</Text>}
</View>
);
}
const styles = StyleSheet.create({
container: {
borderWidth: 1,
borderColor: colors.GRAY_200,
padding: deviceHeight > 700 ? 15 : 10,
},
input: {
fontSize: 16,
color: colors.BLACK,
padding: 0,
},
disabled: {
backgroundColor: colors.GRAY_200,
color: colors.GRAY_700,
},
inputError: {
borderWidth: 1,
borderColor: colors.RED_300,
},
error: {
color: colors.RED_500,
fontSize: 12,
paddingTop: 5,
},
});
export default InputField;
LoginScreen.tsx
import React from 'react';
import {SafeAreaView, StyleSheet, View} from 'react-native';
import InputField from '../../components/InputField';
function LoginScreen() {
return (
<SafeAreaView style={styles.container}>
<View style={styles.inputContainer}>
<InputField placeholder="이메일" error={'이메일을 입력해주세요.'} />
<InputField placeholder="비밀번호" />
</View>
</SafeAreaView>
);
}
const styles = StyleSheet.create({
inputContainer: {
flex: 1,
margin: 30,
},
container: {
gap: 20,
},
});
export default LoginScreen;
color.ts
const colors = {
WHITE: '#ffff',
PINK_500: '#BF5C79',
PINK_700: '#C63B64',
RED_300: '#FFB4B4',
RED_500: '#FF5F5F',
GRAY_200: '#E7E7E7',
GRAY_500: '#E8E8E8',
GRAY_700: '#E575757',
BLACK: '#000',
};
export {colors};
문제화면

몇번을 다시보고 input field를 다시 만들어서 해봐도 안되서 도움 요청드립니다 ㅜ
답변 1
react-native-screens 버전 호환 문제
2
153
1
안드로이드 실행 중 Drawer네비게이션과 MapView 성능 문제
0
103
2
해당 강의 부분은 실제 활용하기에 부족해 제가 해결한 방법입니다.
0
96
1
소스코드가 강의 순서랑 다른가요?
0
72
2
현재 Windows에서 VsCode로 작업 중인데 추후에 IOS도 가능하게 하려면
0
115
2
react-native-fast-image는 react 19 버전에서 설치가 안되나요?
0
209
2
SQL Shell의 역할이 무엇인가요?
0
91
1
혹시 해당 강의에서invalidateQueries를 사용한 이유가 있을까요?
0
79
2
빠르게 실행해보고싶습니다.
0
82
1
강의 수강 순서 관련
0
70
1
애뮬레이터 실행 방법
0
99
2
무료 Apple ID로 실기기 테스트 가능한가요?
0
90
2
ios 실기기 연결
0
70
2
npm run ios에러
0
74
1
10월 삭제 예정인 강의는 이유를 알 수 있을까요?
0
101
1
캘린더 개발 후에 navigation 에 대해서 궁금한 점이 있습니다.
0
51
1
안드로이드 위치 권한 이슈 2가지 문의
0
71
1
지도가 보이려면 음.. 작성해주신 스타일과 다르게
0
74
0
제대로 설치한거같은데 안드로이드랑 ios 둘다 앱실행이 안되는것같아요
0
83
3
강의 내용을 보면 전체적으로 function 함수 키워드를 사용하시는데
0
69
2
강의 3-9 에서 useGetRefreshToken 훅 안에 즉시 함수로 처리하는 이유가 궁금합니다!
0
82
2
사내에서 figma.com 업로드 안되나요?
0
96
1
AWS EC2 + RDS 설정
0
85
2
안드로이드 안켜집니다.
0
91
2





