[3-2] TextInput 작동이 안됩니다
125
2 asked
안녕하세요!
천천히 따라서 코딩 하고 있었는데, 잘 따라 한것 같은데 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를 다시 만들어서 해봐도 안되서 도움 요청드립니다 ㅜ
Answer 1
0
아래부분 컬러가 잘못된것같은데 수정해보시겠어요? 앱도 껐다가 다시빌드해보시구요!
GRAY_700: '#E575757', -> #575757
0
색상을 바꿔도 안되네요 ㅜ
클릭했을 때 키보드가 안뜨는 문제랑 엮여있는건 아닐까요?
import를 다른거 한 것도 아닌거 같은데..
다른 설정 없이 text input을 클릭 했을때 입력창이 떠야 하는건 맞죠~?
react-native-screens 버전 호환 문제
2
156
1
안드로이드 실행 중 Drawer네비게이션과 MapView 성능 문제
0
104
2
해당 강의 부분은 실제 활용하기에 부족해 제가 해결한 방법입니다.
0
98
1
소스코드가 강의 순서랑 다른가요?
0
74
2
현재 Windows에서 VsCode로 작업 중인데 추후에 IOS도 가능하게 하려면
0
116
2
react-native-fast-image는 react 19 버전에서 설치가 안되나요?
0
209
2
SQL Shell의 역할이 무엇인가요?
0
92
1
혹시 해당 강의에서invalidateQueries를 사용한 이유가 있을까요?
0
79
2
빠르게 실행해보고싶습니다.
0
84
1
강의 수강 순서 관련
0
72
1
애뮬레이터 실행 방법
0
101
2
무료 Apple ID로 실기기 테스트 가능한가요?
0
92
2
ios 실기기 연결
0
70
2
npm run ios에러
0
76
1
10월 삭제 예정인 강의는 이유를 알 수 있을까요?
0
102
1
캘린더 개발 후에 navigation 에 대해서 궁금한 점이 있습니다.
0
52
1
안드로이드 위치 권한 이슈 2가지 문의
0
72
1
지도가 보이려면 음.. 작성해주신 스타일과 다르게
0
75
0
제대로 설치한거같은데 안드로이드랑 ios 둘다 앱실행이 안되는것같아요
0
83
3
강의 내용을 보면 전체적으로 function 함수 키워드를 사용하시는데
0
70
2
강의 3-9 에서 useGetRefreshToken 훅 안에 즉시 함수로 처리하는 이유가 궁금합니다!
0
83
2
사내에서 figma.com 업로드 안되나요?
0
97
1
AWS EC2 + RDS 설정
0
86
2
안드로이드 안켜집니다.
0
92
2

