react native trouble shooting

broccoli·2023년 5월 15일
0

1. absolute touch 안될 때

https://stackoverflow.com/questions/36938742/touchablehighlight-not-clickable-if-position-absolute

import { TouchableOpacity } from 'react-native'

기본 react-native에서는 onPress로 할때 잘 동작함. ios/aos 모두

2. ios 헤더 바텀 노치 높이 구하기

https://blog.naver.com/PostView.naver?blogId=gu04005&logNo=222828415325&categoryNo=24&parentCategoryNo=20&viewDate=¤tPage=1&postListTopCurrentPage=1&from=postView

import { useSafeAreaInsets } from 'react-native-safe-area-context'

const insets = useSafeAreaInsets()

console.log(insets)을 보면 각 위치들을 구할 수 있음.

3. absolute에서 중앙 정렬하기

<View className="absolute top-0 bottom-[50%] w-full bg-transparent z-[1000] border-2 border-blue-500">
	<View className="w-full h-full justify-center items-center">
    </View>
</View>

안에 relative View를 하나 더 넣은 다음 위치 조정을 해줌.

profile
🌃브로콜리한 개발자🌟

0개의 댓글