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

Open links from new app screen in computer's browser #24843

Closed
Closed
Show file tree
Hide file tree
Changes from 3 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
22 changes: 22 additions & 0 deletions Libraries/Core/Devtools/openURLInBrowser.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @format
* @flow strict-local
*/

'use strict';

const getDevServer = require('./getDevServer');

function openURLInBrowser(url: string) {
fetch(getDevServer().url + 'open-url', {
method: 'POST',
body: JSON.stringify({url}),
});
}

module.exports = openURLInBrowser;
5 changes: 3 additions & 2 deletions Libraries/NewAppScreen/components/LearnMoreLinks.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
'use strict';

import React from 'react';
import {View, Text, StyleSheet, TouchableOpacity, Linking} from 'react-native';
import {View, Text, StyleSheet, TouchableOpacity} from 'react-native';
import openURLInBrowser from 'react-native/Libraries/Core/Devtools/openURLInBrowser';
import Colors from './Colors';

const links = [
Expand Down Expand Up @@ -70,7 +71,7 @@ const LinkList = () => (
<View style={styles.separator} />
<TouchableOpacity
accessibilityRole={'button'}
onPress={() => Linking.openURL(item.link)}
onPress={() => openURLInBrowser(item.link)}
style={styles.linkContainer}>
<Text style={styles.link}>{item.title}</Text>
<Text style={styles.description}>{item.description}</Text>
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,9 @@
},
"dependencies": {
"@babel/runtime": "^7.0.0",
"@react-native-community/cli": "2.0.0-alpha.16",
"@react-native-community/cli-platform-ios": "2.0.0-alpha.15",
"@react-native-community/cli": "^2.0.0-alpha.19",
lucasbento marked this conversation as resolved.
Show resolved Hide resolved
"@react-native-community/cli-platform-android": "2.0.0-alpha.15",
"@react-native-community/cli-platform-ios": "2.0.0-alpha.15",
"abort-controller": "^3.0.0",
"art": "^0.10.0",
"base64-js": "^1.1.2",
Expand Down