모각코처음하는사람들 3회차 2022.01.11
목표
- 백준 한문제 풀기
- RN todolist 앱만들기
듣보잡 : 백준
https://www.acmicpc.net/problem/1764
포스트 링크 : https://sumi-0011.github.io/algo/Algo69/
풀이코드
#듣보잡
N,M = map(int,input().split(" "))
arr1 = []
for _ in range(N+M):
arr1.append(input())
arr1.sort()
old=''
result = []
for x in arr1:
if old == x:
result.append(x)
old =x
#출력
print(len(result))
for x in result:
print(x)
RN
터치 이벤트
참고자료 : https://reactnative.dev/docs/touchableopacity
-
TouchableOpacity : 누른 요소를 약간 투명해지게 만든다.
- TouchableHighlight : View가 터치에 적절하게 반응하도록 하는 래퍼, backgound 설정 가능
- TouchableWithoutFeedback : 시각적 요소가 없는 이벤트, Press에 반응하는 모든 요소는 눌렀을때 시각적으로 보여야 하기 때문에 가능한 사용하지않는다.
- Pressable : new
props
- onPress : 사용자가 눌렀을때 발생하는 이벤트
<TouchableOpacity onPress={work}>
<Text
style=>
Work
</Text>
</TouchableOpacity>
<TouchableOpacity onPress={travel}>
<Text
style=>
Travel
</Text>
</TouchableOpacity>
text input
react native에는 text input이 있고, HTML 이나 CSS처럼 textarea같은것이 존재하지 않는다.
- TextInput 사용
prop
- keyboardType
-
placeholder
- returnKeyType (Android)
- retuirnKeyLabel (Android)
- secureTextEntry : pw 사용할때 유용
- multiline : 여러줄을 입력할때 자동으로 늘어남, 유저가 텍스트처럼 글을 쓸수 있다.
<TextInput
onChangeText={onChangeText}
value={text}
placeholder={
working ? "Add a To Do" : "Where do you want to go?"
}
style={styles.input}
/>