标签: react-native-linking

11
推荐指数
2
解决办法
8790
查看次数

react-native 如何使用链接打开本地文件 url?

我正在使用以下代码下载文件(可以是 PDF 或 DOC),然后使用链接打开它。

const { dirs } = RNFetchBlob.fs;
let config = {
    fileCache : true,
    appendExt : extension,
    addAndroidDownloads : {
        useDownloadManager : false,
        notification : false,
        title : 'File',
        description : 'A file.',
        path: `${dirs.DownloadDir}/file.${extension}`,
    },
};
RNFetchBlob.config(config)
    .fetch(
        method,
        remoteUrl,
        APIHelpers.getDefaultHeaders()
    )
    .then((res) => {
        let status = res.info().status;
        if (status == 200) {
            Linking.canOpenURL(res.path())
                .then((supported) => {
                    if (!supported) {
                        alert('Can\'t handle url: ' + res.path());
                    } else {
                        Linking.openURL(res.path())
                            .catch((err) => alert('An error occurred …
Run Code Online (Sandbox Code Playgroud)

android ios react-native react-native-linking rn-fetch-blob

6
推荐指数
2
解决办法
4938
查看次数

npx 反应本机链接对我不起作用

我正在尝试使用它(https://mehrankhandev.medium.com/ultimate-guide-to-use-custom-fonts-in-react-native-77fcdf859cf4)来添加字体,但我对这部分有问题。 。

npx react-native link
Run Code Online (Sandbox Code Playgroud)

这个命令没有向我显示任何内容......任何内容;然后控制台行“C:\Users****\WebstormProjects\myFirstProject> 再次出现。就像我一开始没有写任何命令一样。出了什么问题?

webstorm reactjs react-native react-native-linking npx

6
推荐指数
2
解决办法
1万
查看次数

无法使用Linking.openURL打开电话

描述

无法使用Linking.openURL('tel:+123456789')打开电话

环境

环境:操作系统:macOS High Sierra 10.13.4节点:8.5.0纱线:找不到npm:5.8.0值班员:找不到Xcode:Xcode 9.3 Build版本9E145 Android Studio:2.3 AI-162.4069837

软件包:(需要=>已安装)反应:16.3.1 => 16.3.1 react-native:https : //github.com/expo/react-native/archive/sdk-27.0.0.tar.gz => 0.55 .2世博会:27.0.1,

重现步骤

import ...
export default class App extends React.Component {

_pressCall=()=>{
    const url='tel:+123456789'
    Linking.openURL(url)
}

render() {
    return (
        <View style={styles.container}>
            <Button title='call' onPress={this._pressCall}/>
        </View>
    );
}
}
Run Code Online (Sandbox Code Playgroud)

https://snack.expo.io/@kikoololmdrxdd/test-linking-phone-call

预期行为

拨打电话

实际行为

[Android]Error message
attempt to invoke virtual method 'boolean java.lang.string.endsWith(java.
lang.String)' on a null object reference
Run Code Online (Sandbox Code Playgroud)

android react-native expo react-native-linking

5
推荐指数
2
解决办法
4890
查看次数

反应本机链接路径不正确

我有一个应用程序无法链接/取消链接包,类似于此问题

特别是在链接MainApplication.java此错误文件时失败。

错误取消链接时出了点问题。原因:没有这样的文件或目录,请打开“ ./AppName/android/app/src/main/java/co/AppName/AppName/MainApplication.java”

该路径实际上是不正确java/co/AppNAme应该是java/com/AppName

我在任何地方都找不到导致此问题的原因,也找不到任何有关如何设置路径的文档。

我尝试使用babel-plugin-module-resolver但没有成功,除非我错过了一些东西。有人有类似的问题吗?

java react-native react-native-android react-native-linking

5
推荐指数
1
解决办法
64
查看次数

React Native打开Facebook页面

我一直在尝试使用React Native Linking API打开Facebook页面。它对我不起作用。我确实安装了Facebook应用程序。这是我尝试过的:

Linking.openURL('fb://page/<page_name>');
Linking.openURL('fb://profile/<profile_name>');
Linking.openURL('http://facebook.com/<page_name>');
Run Code Online (Sandbox Code Playgroud)

我也尝试使用通讯库:Communications.web(url)。没有一个适用于Facebook和Instagram。但是,对于Google Maps,Apple Maps,Twitter和其他大人物来说,它就像是一种魅力。

我想知道我是在做错什么,还是应该从Facebook向那些人发送一些Android文章,以了解如何在他们的应用程序中正确实现深层链接?他们显然不知道自己在做什么。

android facebook deep-linking react-native react-native-linking

4
推荐指数
3
解决办法
5712
查看次数

React Native 中 pod 不被识别为内部或外部命令

我已经在我的 React Native 项目中安装了图像选择器,我将在 ios 中链接该包

我运行这些命令:

cd ios && pod install

Run Code Online (Sandbox Code Playgroud)

但我收到这个错误:

pod is not recognized as an internal or external command
Run Code Online (Sandbox Code Playgroud)

我在 Windows 7 中编码,我的 React Native 版本是:“0.61.5”

我怎样才能解决这个问题?

cocoapods reactjs react-native react-native-linking

2
推荐指数
1
解决办法
1万
查看次数