Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Gutenberg Mobile] Add External Link support to React Native #23090

Merged
merged 2 commits into from
Jun 17, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions packages/components/src/external-link/index.native.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/**
* External dependencies
*/

import { TouchableOpacity, Text, Linking } from 'react-native';

/**
* WordPress dependencies
*/
import { __ } from '@wordpress/i18n';
import { external, Icon } from '@wordpress/icons';

export function ExternalLink( { href, children } ) {
return (
<TouchableOpacity
onPress={ () => Linking.openURL( href ) }
accessibilityLabel={ __( 'Open link in a browser' ) }
>
<Text>{ children }</Text>
<Icon icon={ external } />
</TouchableOpacity>
);
}

export default ExternalLink;
1 change: 1 addition & 0 deletions packages/components/src/index.native.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ export { default as PanelBody } from './panel/body';
export { default as PanelActions } from './panel/actions';
export { default as Button } from './button';
export { default as __experimentalText } from './text';
export { default as ExternalLink } from './external-link';
export { default as TextControl } from './text-control';
export { default as ToggleControl } from './toggle-control';
export { default as SelectControl } from './select-control';
Expand Down