标签: react-native-ios

使用 React Native 通过 Whatsapp 共享图像和文本

我正在开发一个 React Native 应用程序,我的需求之一是能够通过 Whatsapp 共享 png 图像(从 svg 创建)以及消息中的一些文本。我已经使用react-native-share在Android上实现了这一点,但是当我在iOS上尝试时,消息中填充了提供的文本,但图像被忽略。我也尝试过分享,但结果是一样的。

我尝试过直接共享 base64 图像(data:image/png;base64, image_data以及保存创建的图像并将路径添加为 url,但结果始终相同。

在 iOS 上(同时使用 React-native-share 和 Share)实现此功能的唯一方法是省略该消息,但需求中需要文本。

有办法实现这一点吗?

版本:

  • 反应本机 - 0.55.0
  • 反应本机共享 - 1.1.2

顺便说一句,Twitter、电子邮件、短信和其他一些应用程序上的共享过程运行正常。

代码示例:

const base64Data = this.state.uri
const dir = `${RNFS.DocumentDirectoryPath}/tmp_${moment().valueOf()}.png`

RNFS.writeFile(dir, base64Data, 'base64').then(async () => {
  const options = {
    url: Platform.OS === 'android' ? `file://${dir}` : dir,
    message: '' // By omitting the message, whatsapp shows the image
  }
  try { …
Run Code Online (Sandbox Code Playgroud)

javascript share whatsapp react-native react-native-ios

5
推荐指数
0
解决办法
2995
查看次数

React Native iOS 构建问题在提供的路径中找不到应用程序包

我对原生反应很陌生。我创建了一个 Hello World 项目,但无法在 iOS 上运行。每次我运行 iOS 项目时都会抛出以下错误

** 构建失败 **

以下构建命令失败:CompileC /Users/usman/FunZoneAppsProjects/{ProjectName}/ios/build/Build/Intermediates/React.build/Debug-iphonesimulator/React.build/Objects-normal/x86_64/RCTShadowView+Internal.o Views /RCTShadowView+Internal.m 正常 x86_64 Objective-c com.apple.compilers.llvm.clang.1_0.compiler (1 次失败)

安装 build/Build/Products/Debug-iphonesimulator/{ProjectName}.app 处理命令时遇到错误(domain=NSPOSIXErrorDomain,code=2):无法安装请求的应用程序 在提供的路径中找不到应用程序包。提供所需应用程序包的有效路径。打印:条目,“:CFBundleIdentifier”,不存在

命令失败: /usr/libexec/PlistBuddy -c 打印:CFBundleIdentifier build/Build/Products/Debug-iphonesimulator/{ProjectName}.app/Info.plist 打印:条目,“:CFBundleIdentifier”,不存在

错误:命令失败:/usr/libexec/PlistBuddy -c 打印:CFBundleIdentifier build/Build/Products/Debug-iphonesimulator/{ProjectName}.app/Info.plist 打印:条目,“:CFBundleIdentifier”,不存在

at checkExecSyncError (child_process.js:621:11)
at Object.execFileSync (child_process.js:639:13)
at Promise.then (/Users/usman/FunZoneAppsProjects/{ProjectName}/node_modules/react-native/local-cli/runIOS/runIOS.js:208:5)
Run Code Online (Sandbox Code Playgroud)

我读过很多人用不同的修复方法解决了这个问题,但没有一个对我有用。可能是什么问题?TIA

ios react-native react-native-ios

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

react-native clang:错误:链接器命令失败,退出代码为 1

我正在尝试在 Xcode 中构建我的反应本机项目以在 App Store 中发布,但构建失败并出现错误

clang: error: linker command failed with exit code 1 (use -v to see invocation)
Run Code Online (Sandbox Code Playgroud)

我不知道如何继续。我的项目中有facebook sdk和react-native-firebase。你能帮我看看可能出了什么问题吗?谢谢。

xcode react-native react-native-ios

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

React-Native-Scrollview 的滚动在到达 StickyHeaderIndices 时被禁用

我正在尝试使我的标签栏具有粘性,我正在使用native base标签栏,而他们正在使用"react-native-scrollable-tab-view". 我用scrollView包裹我的根视图并设置“stickyHeaderIndices={[1]}”,这对于使我的选项卡栏粘在顶部很有用,但是当这些选项卡栏粘在顶部时,滚动在粘到顶部之前停止工作它工作正常,但是当这些选项卡粘在顶部滚动条上时,它会停止工作,有什么建议吗?

我尝试添加另一个滚动视图,这样我的滚动就可以工作,但没有运气,我在选项卡内有 FlatList 组件,但在 StickyHeaderIndices 滚动工作之前,FlatList 的滚动在 StickyHeaderIndices 之后也不起作用。

 <ScrollView
      stickyHeaderIndices={[1]}
      ref={ref => this.scrollView = ref}
      onContentSizeChange={(contentWidth, contentHeight) => {
        _scrollToBottomY = contentHeight
      }}
      contentContainerStyle={{flexGrow: 1, flex: 1}}>
 >  <AnotherComponent/>
    <MyTabsComponent />
</ScrollView>
Run Code Online (Sandbox Code Playgroud)

滚动应该在 StickyHeaderIndices 之后起作用。

react-native react-native-scrollview react-native-ios react-native-flatlist

5
推荐指数
0
解决办法
1362
查看次数

是否可以在 React Native 库中加载 .XIB 或 Storyboard?

我已经为 React Native 创建了一个模块,它有五个视图控制器。所以我为每个视图控制器获取 XIB。但 XIB 不会加载到库中。

RCT_EXPORT_METHOD(showFirstVC){

    UIViewController *root = RCTPresentedViewController();

   FVCViewController *ViewController = (FVCViewController *)[[UIViewController alloc] initWithNibName:@"FVCViewController" bundle:nil];

   UINavigationController *navController = [[UINavigationController alloc] initWithRootViewController:ViewController];
   navController.navigationBarHidden = YES;

    [root presentViewController:ViewController animated:YES completion:nil];
}
Run Code Online (Sandbox Code Playgroud)

你能帮我看看是否可以在 React Native 库中加载 XIB 或 Storyboard。

react-native react-native-ios

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

如何在xcworkspace项目中使用“increment_build_number”?

我正在尝试在我的 React Native 项目中使用 fastlane 自动化构建过程。我正在关注这篇文章。在increment_build_number实际操作中,我找不到任何选项来指定 .xcworkspace 项目。我尝试使用workspace标签,但没有成功。

react-native fastlane react-native-ios

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

是否可以将项目拖动到水平 FlatList 范围之外?

我正在使用 React Native 库开发 FotoBook 应用程序。当我让用户从设备库中选择图像后,我将它们以水平模式放入 FlatList 组件中。那么如何将选定的图像拖放到屏幕的其他部分

我正在使用 PanResponder 和 Animated API,它可以很好地转换响应者坐标,但是当我尝试超出水平 FlatList 的范围时,它会被隐藏。我尝试将溢出设置为可见并更改 zIndex 但它不起作用

以下是屏幕截图:

拖动 FlatList 项目之前的应用程序屏幕截图 拖动 FlatList 项目后的应用程序屏幕截图

这是我的代码:

import React from 'react';
import {
    SafeAreaView,
    View, 
    FlatList, 
    Text,
    StyleSheet,
    Animated,
    PanResponder
} from 'react-native';
import { v4 } from 'uuid';


export default class App extends React.PureComponent{

  state = {
    data: [
      { id: v4(), title: 'Lightcoral', hex: '#eb7474' },
      { id: v4(), title: 'Orchid', hex: '#eb74dc' },
      { id: v4(), title: 'Mediumpurple', hex: '#9a74eb' },
      { id: v4(), title: …
Run Code Online (Sandbox Code Playgroud)

reactjs react-native react-native-ios react-native-flatlist

5
推荐指数
0
解决办法
589
查看次数

找不到模块

我正在尝试运行react-native start并出现以下错误

"Cannot find module 'metro-core'.  Run CLI with --verbose flag for more details. 
Run Code Online (Sandbox Code Playgroud)

在收到此消息之前,我收到了一条不同的错误消息,指出未找到模块,因此我尝试了以下操作:

删除node_modules文件夹 -

rm -rf node_modules && npm install
Reset packager cache - rm -fr $TMPDIR/react-* or node_modules/react-native/packager/packager.sh --reset-cache
Clear watchman watches - watchman watch-del-all
Run Code Online (Sandbox Code Playgroud)

我刚刚输入了react-native start,模拟器上就弹出了错误消息,这告诉我在终端上查看错误消息。

react-native react-native-ios

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

使用 TrustKit iOS 在 React-Native 应用程序中实现 ssl pinning

我正在尝试在react-native应用程序(RN 0.60)中实现SSL固定,并且我正在使用Trustkit。

按照https://github.com/datatheorem/TrustKit中发布的指南,这些是我所做的步骤:

1) 使用pod 'TrustKit'和安装 TrustKit podpod install

2)添加到我的AppDelegate.m这段代码:

#import <TrustKit/TrustKit.h>

//inside didFinishLaunchingWithOptions

NSDictionary *trustKitConfig =
  @{
    kTSKSwizzleNetworkDelegates: @YES,
    kTSKPinnedDomains: @{
        @"www.datatheorem.com" : @{
            kTSKEnforcePinning:@YES,
            kTSKIncludeSubdomains:@YES,
            //Using wrong hashes so it fails
            kTSKPublicKeyHashes : @[
                @"Ca5gV6n7OVx4AxtEaIk8NI9qyKBTtKJjwqullb/v9hh=",
                @"YLh1dUR9y6Kja30RrAn7JKnbQG/uEtLMkBgFF2Fuihh="
                ]
            }}};

  [TrustKit initSharedInstanceWithConfiguration:trustKitConfig];
Run Code Online (Sandbox Code Playgroud)

当我尝试做的时候

 RNFetchBlob.fetch('GET', "https://www.datatheorem.com", {})    //tried using standard fetch() but gives same results
    .then(async(res) => {
        console.log('RES => ' ,res)
    })
    // Something went wrong:
    .catch((err) => {
        console.log('ERROR =>', err);
    })
Run Code Online (Sandbox Code Playgroud)

它进入内部 …

ios react-native react-native-ios trustkit

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

如何从IOS本机模块(插件)调用react-native函数

我想从本机模块调用反应本机函数。

我为我的 React-Native 应用程序创建了一个条形码扫描仪插件,条形码扫描仪 SDK 可在本机 IOS 和 Android 中使用,因此,我提取这些本机代码并为 React-Native 应用程序创建一个插件(NPM)。

现在我的问题是,一旦条形码扫描仪扫描数据并发送到本机IOS,我如何在我的react-native应用程序中获取这些扫描数据?(我在IOS本机中获取了扫描数据)

我想在本机模块扫描数据后调用react-native应用程序函数并将这些数据发送到react-native

请给出示例或正确的文档,以便我可以尝试和实施。

提前致谢。

barcode-scanner react-native react-native-ios

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