小编jax*_*eed的帖子

React Native Animated singleValue.stopTracking不是一个函数

我有以下代码在React Native中动画

Animated.timing(
    this.state.absoluteChangeX,
    {toValue: 0},
).start(function() {
    this.lastX = 0;
    this.lastY = 0;
}); 
Run Code Online (Sandbox Code Playgroud)

非常简单,但无论何时触发,我都会收到错误: singleValue.stopTracking is not a function

这是错误的起源:

/react-native/Libraries/Animates/src/AnimtaedImplementation.js

var timing = function(
  value: AnimatedValue | AnimatedValueXY,
  config: TimingAnimationConfig,
): CompositeAnimation {
  return maybeVectorAnim(value, config, timing) || {
    start: function(callback?: ?EndCallback): void {
      var singleValue: any = value;
      var singleConfig: any = config;
      singleValue.stopTracking(); // <--------------- HERE!!!
      if (config.toValue instanceof Animated) {
        singleValue.track(new AnimatedTracking(
          singleValue,
          config.toValue,
          TimingAnimation,
          singleConfig,
          callback
        ));
      } else {
        singleValue.animate(new TimingAnimation(singleConfig), callback); …
Run Code Online (Sandbox Code Playgroud)

react-native

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

React Native无法找到项目的匹配配置(仅限构建)

我的反应原生构建在运行react-native run-android或运行时工作正常cd android && ./gradlew assembleDebug.但是我会为运行时安装的所有反应本机包获得以下内容./gradlew assembleRelease

> Could not resolve project :react-native-fbsdk.
     Required by:
         project :app
      > Unable to find a matching configuration of project :react-native-fbsdk:
          - Configuration 'debugApiElements':
              - Required com.android.build.api.attributes.BuildTypeAttr 'releaseStaging' and found incompatible value 'debug'.
              - Required com.android.build.gradle.internal.dependency.AndroidTypeAttr 'Aar' and found compatible value 'Aar'.
              - Found com.android.build.gradle.internal.dependency.VariantAttr 'debug' but wasn't required.
              - Required org.gradle.api.attributes.Usage 'java-runtime' and found incompatible value 'java-api'.
          - Configuration 'debugRuntimeElements':
              - Required com.android.build.api.attributes.BuildTypeAttr 'releaseStaging' and found incompatible value …
Run Code Online (Sandbox Code Playgroud)

android gradle gradlew android-gradle-plugin react-native

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

React Native 指定的 Android SDK Build Tools 版本(23.0.1)被忽略

我已经尝试过这里发布的解决方案:“指定的 Android SDK 构建工具版本 (26.0.0) 被忽略......”升级到 26.0.2 不起作用。

运行项目构建时,我得到以下输出,该输出以错误结尾,表明无法构建任何本机组件。

> Configure project :app
Configuration 'compile' in project ':app' is deprecated. Use 'implementation' instead.
The Task.leftShift(Closure) method has been deprecated and is scheduled to be removed in Gradle 5.0. Please use Task.doLast(Action) instead.
registerResGeneratingTask is deprecated, use registerGeneratedFolders(FileCollection)
registerResGeneratingTask is deprecated, use registerGeneratedFolders(FileCollection)
registerResGeneratingTask is deprecated, use registerGeneratedFolders(FileCollection)
registerResGeneratingTask is deprecated, use registerGeneratedFolders(FileCollection)
registerResGeneratingTask is deprecated, use registerGeneratedFolders(FileCollection)
registerResGeneratingTask is deprecated, use registerGeneratedFolders(FileCollection)

> Configure project :react-native-code-push
Configuration 'compile' …
Run Code Online (Sandbox Code Playgroud)

android gradle react-native

7
推荐指数
1
解决办法
2218
查看次数

使用 Serverless Next JS 在同一路由上使用不同的 Content-Type

我想知道无服务器(部署在 Vercel 上)Next JS 是否可以实现以下场景:

/product/[id].tsx当您发送带有 header 的请求时,我有一条路线Accept: text/html,我希望它通过 React 页面来经历正常的 Next JS 流程。但是,当使用 给出请求时Accept: application/json,我希望它返回 JSON 表示形式。

我通过使用为 Express 编写的一些自定义中间件(见下文)来完成此任务,但我还想将其部署在 Vercel 上,而 Vercel 不适用于自定义 Express 实现。

那么问题来了,在无服务器环境下是否可以做到这一点?Next JS React 页面之一可以返回纯 JSON,还是可以从 Next JS Api 路由返回 React?或者还有其他方法可以实现此目的吗?

服务器.ts

import express, { Request, Response } from "express";
import next from 'next'
import { parse } from 'url'

const port = parseInt(process.env.PORT || "3000", 10);
const dev = process.env.NODE_ENV !== "production";

async function run(): Promise<void> {
  const …
Run Code Online (Sandbox Code Playgroud)

javascript node.js next.js serverless vercel

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