컴포넌트가 화면에 잘 나타났나요? 이제 해당 버튼을 누르면 WriteScreen을 띄우도록 컴포넌트를 수정해보세요.
components/FloatingWriteButton.js
import {useNavigation} from '@react-navigation/native'; import React from 'react'; import {Platform, Pressable, StyleSheet, View} from 'react-native'; import Icon from 'react-native-vector-icons/MaterialIcons'; function () { const navigation = useNavigation(); const onPress = () => { navigation.navigate('Write'); }; return ( <View style={styles.wrapper}> <Pressable style={({pressed}) => [ styles.button, Platform.OS === 'ios' && { opacity: pressed ? 0.6 : 1, }, ]} android_ripple={{color: 'white'}} onPress={onPress}> <Icon name="add" size={24} style={styles.icon} /> </Pressable> </View> ); } const styles StyleSheet. ({ ( ) }); export default FloatingWriteButton;
FloatingWriteButton을 눌렀을 때 WriteScreen이 나타나는지 확인해보세요.