@wordpress/components
Version:
UI components for WordPress.
40 lines (33 loc) • 808 B
JavaScript
/**
* External dependencies
*/
import { useNavigation, useRoute } from '@react-navigation/native';
/**
* WordPress dependencies
*/
import { useMemo } from '@wordpress/element';
/**
* Internal dependencies
*/
import LinkSettings from './';
const LinkSettingsScreen = ( props ) => {
const navigation = useNavigation();
const route = useRoute();
const { url = '' } = props;
const { inputValue = url } = route.params || {};
const onLinkCellPressed = () => {
navigation.navigate( 'linkPicker', { inputValue } );
};
return useMemo( () => {
return (
<LinkSettings
onLinkCellPressed={
props.hasPicker ? onLinkCellPressed : undefined
}
urlValue={ inputValue }
{ ...props }
/>
);
}, [ props, inputValue, navigation, route ] );
};
export default LinkSettingsScreen;