小编GRZ*_*RZa的帖子

在 iOS 中运行默认的 RN 本机项目会出现错误

知道出了什么问题吗?我已将所有相关组件更新到最新版本。

我正在创建一个默认的react-native项目并尝试运行iOS模拟器

npx react-native init {project_name}
cd {project_name}
npx react-native run-ios    
Run Code Online (Sandbox Code Playgroud)

我收到以下错误:

/bin/sh -c {user}/Library/Developer/Xcode/DerivedData/{project_name}-epegcqhmisnuaeenegumkazvqqys/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/FBReactNativeSpec.build/Script-5F4C70EF7D90A5A5BDAEB404279F232A.sh
N/A: version "default -> N/A" is not yet installed.

You need to run "nvm install default" to install it before using it.
Command PhaseScriptExecution failed with a nonzero exit code
Run Code Online (Sandbox Code Playgroud)

有问题的脚本(自行生成)如下:

#!/bin/sh
set -o pipefail
set -e

RN_DIR=$(cd "${PODS_TARGET_SRCROOT}/../.." && pwd)

GENERATED_SRCS_DIR="${DERIVED_FILE_DIR}/generated/source/codegen"
GENERATED_SCHEMA_FILE="$GENERATED_SRCS_DIR/schema.json"
TEMP_OUTPUT_DIR="$GENERATED_SRCS_DIR/out"

LIBRARY_NAME="FBReactNativeSpec"
OUTPUT_DIR="${PODS_TARGET_SRCROOT}/../../React/FBReactNativeSpec/FBReactNativeSpec"

CODEGEN_REPO_PATH="$RN_DIR/packages/react-native-codegen"
CODEGEN_NPM_PATH="$RN_DIR/../react-native-codegen"
CODEGEN_CLI_PATH=""

# Determine path to react-native-codegen
if [ -d "$CODEGEN_REPO_PATH" ]; then
  CODEGEN_CLI_PATH=$(cd "$CODEGEN_REPO_PATH" && pwd)
elif …
Run Code Online (Sandbox Code Playgroud)

ios react-native

14
推荐指数
2
解决办法
5597
查看次数

React Native:使用@testing-library/react-hooks和react-query“测试运行完成后一秒Jest没有退出”

我正在使用jest@testing-library/react-hooks测试react-query在我的 React Native 代码中实现的钩子。

测试工作正常,但最后我得到:

Jest did not exit one second after the test run has completed.

This usually means that there are asynchronous operations that weren't stopped in your tests. Consider running Jest with `--detectOpenHandles` to troubleshoot this issue.
Run Code Online (Sandbox Code Playgroud)

这是我的简化代码:

import { renderHook } from '@testing-library/react-hooks'
import React from 'react'
import { QueryClient, QueryClientProvider, useQuery } from 'react-query'

const useSomething = () => {
  return useQuery('myquery', () => 'OK')
}

beforeAll((done) => { …
Run Code Online (Sandbox Code Playgroud)

jestjs react-native react-hooks testing-library react-query

3
推荐指数
1
解决办法
3718
查看次数