# codigo back button // Dependencies ```import React, {useCallback} from 'react'; import { TouchableOpacity as TouchableOpacityNative, Platform, } from 'react-native'; import {TouchableOpacity as TouchableOpacityGesture} from 'react-native-gesture-handler'; // Commons import {Normalize} from '../../../style/normalice'; // Assets import ArrowLeftIcon from '../../../assets/icons/arrow-left.svg'; // issue TouchableOpacity https://github.com/facebook/react-native/issues/14536 function BackButton({navigation = null, onPress = null}) { const onPressBack = useCallback(() => { if (onPress) { onPress(); } if (navigation && !onPress) { navigation.goBack(); } }, [navigation, onPress]); const renderIcon = useCallback( () => <ArrowLeftIcon width={Normalize(24)} height={Normalize(24)} />, [], ); return Platform.OS === 'ios' ? ( <TouchableOpacityNative onPress={onPressBack}> {renderIcon()} </TouchableOpacityNative> ) : ( <TouchableOpacityGesture onPress={onPressBack}> {renderIcon()} </TouchableOpacityGesture> ); } export default BackButton;
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up