[내일배움캠프 TIL] 51일차

Jaehyeon Ye·2023년 1월 9일
0

오늘 새로 배운 것

특정 screen에서 bottom tabBar 제거

tabBarStyle: {display : 'none'}

useEffect(() => {
    navigation.getParent().setOptions({
      tabBarStyle: { display: 'none' },
    });
}, []);

TouchableOpacity press 여부에 따른 색 변경

먼저 press여부를 확인할 boolean 타입의 state값 선언해주고

TouchableOpacity style에 backgroundColor: state ? true일 때 색 : false일 때 색

const [isClicked, setIsClicked] = useState(false);

const handleIsClicked = () => {
    setIsClicked(!isClicked);
  };


<TouchableOpacity
        onPress={handleIsClicked}
        style={{ backgroundColor: isClicked ? 'blue' : 'white' }}
      >
profile
FE Developer

0개의 댓글