Skip to content

Commit

Permalink
[Gutenberg Mobile] Add External Link support to React Native (#23090)
Browse files Browse the repository at this point in the history
* [Gutenberg Mobile] Add External Link support to React Native

* Remove the forwardRef
  • Loading branch information
enejb authored Jun 17, 2020
1 parent 81819c2 commit df649c1
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
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

0 comments on commit df649c1

Please sign in to comment.