我需要修复这个错误。
不变违规:requireNativeComponent:在 UIManager 中找不到“RNGestureHandlerRootView”。
这个错误位于: 在RNGestureHandlerRootView(由GestureHandlerRootView创建)中 在GestureHandlerRootView(由StackView创建)中 在StackView(由StackView创建)中 在StackView中 在Unknown(由Navigator创建)中 在Navigator(由SceneView创建)中 在SceneView(由SwitchView创建)中在SwitchView(由Navigator创建)中 在Navigator(由NavigationContainer创建)中 在NavigationContainer(由ExpoRoot创建)中 在ExpoRoot中 在RCTView(由View创建)中 在View(由AppContainer创建)中 在RCTView(由View创建)中 在View(由AppContainer创建)中) 在 AppContainer 中
最近,当yarn eas build我的世博项目开始失败时
[INSTALL_PODS] Using Expo modules
[INSTALL_PODS] [Expo] Enabling modular headers for pod ExpoModulesCore
...
[INSTALL_PODS] [!] Invalid `Podfile` file:
[INSTALL_PODS] [!] Invalid `RNGestureHandler.podspec` file: undefined method `exists?' for File:Class.
...
[INSTALL_PODS] # -------------------------------------------
[INSTALL_PODS] #
[INSTALL_PODS] > isUserApp = File.exists?(File.join(__dir__, "..", "..", "node_modules", "react-native", "package.json"))
[INSTALL_PODS] # if isUserApp
[INSTALL_PODS] # -------------------------------------------
Run Code Online (Sandbox Code Playgroud)
我不经常在本地进行构建(在 Expo 服务器上进行远程构建效果很好),因此过去几周内可能有很多事情触发了此问题,包括从 Intel MBP 迁移到 M2 MBA,但我想知道是否有一个有人有经验的明显原因。该错误表明 podfile 使用未定义的方法存在问题。但我在网上找到的解决这个问题的建议涉及各种调整,远远超出了我所熟悉的范围。我对 Expo/EAS 的经验是一定要
brew install cocoapods fastlane
Run Code Online (Sandbox Code Playgroud)
并且不要涉及更多。理想情况下,我希望避免弄乱建议作为快速修复的特殊宝石安装。
所以问题是:这确实只是 podfile 中的一个错误(使用已弃用的方法),最终会得到修复吗?
更新:总的来说,答案似乎是“是”:这确实在受影响的软件包的更高版本中得到修复,但 …
世博会更新后,我的项目无法运行
错误是:
Failed building JavaScript bundle.
node_modules\react-native-gesture-handler\src\index.ts: [BABEL] D:\data\Anonymous\ReactNative\test\node_modules\react-native-gesture-handler\src\index.ts: You gave us a visitor for the node type TSInstantiationExpression but it's not a valid type
Run Code Online (Sandbox Code Playgroud)
该项目的依赖项是:
packages: {
"@react-navigation/bottom-tabs": "^6.3.1",
"@react-navigation/drawer": "^6.4.1",
"@react-navigation/native": "^6.0.10",
"@react-navigation/stack": "^6.2.1",
"expo": "~45.0.0",
"expo-barcode-scanner": "~11.3.0",
"expo-status-bar": "~1.3.0",
"react": "17.0.2",
"react-dom": "17.0.2",
"react-native": "https://github.com/expo/react-native/archive/sdk-45.0.0.tar.gz",
"react-native-gesture-handler": "~2.2.1",
"react-native-keyboard-aware-scroll-view": "^0.9.5",
"react-native-paper": "^4.12.1",
"react-native-reanimated": "~2.8.0",
"react-native-safe-area-context": "4.2.4",
"react-native-screens": "~3.11.1",
"react-native-vector-icons": "^9.1.0",
"react-native-web": "0.17.7",
}
Run Code Online (Sandbox Code Playgroud) 这是我在构建分支的 android apk 时遇到的错误。(为 ios 构建时不会发生)。多年来我一直在这个代码库上使用react-native-gesture-handler,但从未遇到过这个错误。
此错误在合并 pr 后开始发生,但此 pr 不包含任何 android 端本机更改。
版本信息:react-native-gesture-handler:^2.3.2 build.gradle 中的 kotlin 版本:1.6.10 React-native 版本:0.68.5
> Task :react-native-gesture-handler:compileReleaseKotlin FAILED
e: /Users/saumya/Desktop/latest/lc-app/node_modules/react-native-gesture-handler/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerButtonViewManager.kt: (247, 92): Unresolved reference: TIRAMISU
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':react-native-gesture-handler:compileReleaseKotlin'.
> Compilation error. See log for more details
* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run …Run Code Online (Sandbox Code Playgroud) android cross-platform kotlin react-native react-native-gesture-handler
我们在这种情况下,我们在我们的应用程序中同时使用react-native-gesture-handler Touchables AND react-native Touchables。(我所说的 Touchables 是指 TouchableOpacity、TouchableHighlight 等)。如您所知, react-native-gesture-handler 也提供了这些组件,以便它们在用作react-native-gesture-handler手势识别组件。
我们认为我们只会rn-gesture-handler Touchables在绝对需要rn-gesture-handler Touchables才能工作的组件中使用(即用gestureHandlerRootHOC包裹的根视图)并rn Touchables在其他任何地方使用。
我们遇到了其中两个组件干扰的情况,我们遇到了奇怪的问题(例如触摸通过一个组件,好像它pointerEvents="none"只是因为它在 Android 中使用了 arn touchable而不是 an rngh touchable)。
一个解决方案可能是更换每一个rn Touchable在我们与一个应用程序rn-gesture-handler Touchable,但是这是超级困难的,因为我们的很多依赖也在使用的rn Touchables所以这将是难以替代的一切-而且这将是更难,因为rn-gesture-handler Touchables是在更换不降rn Touchables并且我们rn-gesture-handler Touchables确实遇到了样式问题。
我需要一些帮助来正确解决这个问题 - 我认为即使是像阻止通过 react-native touchables 进行触摸的方法这样的hacky 也可以。
我正在使用react-native-gesture-handler 和react-native-reanimated 包在react native 中对视图进行动画处理。点击时视图的比例应增加,背景颜色应在点击时更改为红色。当我在网络上启动应用程序时一切正常,但在 Android 上我没有得到任何反馈。我使用零食在我的设备上发送代码,并且在我的 Android 设备上运行,但是当我在笔记本电脑上使用 expo-start 运行该项目时,手势处理根本不起作用。任何帮助都感激不尽 。该项目由世博会管理。
我正在使用react-native-reanimated版本“~2.3.1”,react-native-gesture-handler版本“2.1.0”;
//我的APP.JS文件
import "react-native-gesture-handler";
import { StyleSheet, Text, View } from "react-native";
import Animated,{useAnimatedGestureHandler, useAnimatedStyle, useSharedValue} from "react-native-reanimated";
import { TapGestureHandler } from "react-native-gesture-handler";
export default function App() {
const pressed= useSharedValue(false);
const gestureEvent= useAnimatedGestureHandler({
onStart:()=>{
pressed.value=true
},
onActive:(e)=>{
pressed.value=true;
},
onEnd:()=>{
pressed.value=false;
}
});
const animationStyle=useAnimatedStyle(()=>{
return {
transform:[{scale:pressed.value?1.3:1}],
backgroundColor:pressed.value?"red":"yellow"
}
})
return (
<View style={styles.container}>
<TapGestureHandler onGestureEvent={gestureEvent} >
<Animated.View style={[styles.view,animationStyle]}></Animated.View>
</TapGestureHandler>
</View>
);
}
const styles …Run Code Online (Sandbox Code Playgroud) react-native react-native-gesture-handler react-native-reanimated-v2
我在捏合手势处理程序内有一个平移手势处理程序,用于创建多方向滚动可缩放视图的效果,该效果一切正常。但我遇到的问题是,当用户放大时,视图不会在手指下放大,而当用户缩放时,视图会放大其他地方,而不是保持相同的位置。这是我的代码:
这是一个可复制的演示:Expo Demo
这是视图:
<PinchGestureHandler
simultaneousHandlers={[panRef]}
ref={pinchRef}
onGestureEvent={pinchGestureHandler}>
<Animated.View style={animatedStyle}>
<PanGestureHandler
simultaneousHandlers={[pinchRef]}
ref={panRef}
onGestureEvent={panGestureHandler}></PanGestureHandler>
</Animated.View>
</PinchGestureHandler>
Run Code Online (Sandbox Code Playgroud)
这是我的处理程序:
const translateX = useSharedValue(0);
const translateY = useSharedValue(0);
const scale = useSharedValue(1);
const panRef = useRef();
const pinchRef = useRef();
const panGestureHandler = useAnimatedGestureHandler({
onStart: (_, ctx) => {
ctx.startX = translateX.value;
ctx.startY = translateY.value;
},
onActive: (event, ctx) => {
translateX.value = ctx.startX + event.translationX;
translateY.value = ctx.startY + event.translationY;
},
onEnd: (event, ctx) => {
translateX.value = withDecay({
velocity: event.velocityX, …Run Code Online (Sandbox Code Playgroud) javascript pinchzoom react-native react-native-gesture-handler
我正在使用来自 React-Native-Gesture-Handler 的 Swipeable 来合并滑动以在我的页面上删除。当我按删除时,联系人会被删除,但可滑动保持打开状态。
我希望它在按下后关闭,但我似乎不知道该怎么做。
这是我的代码:
const RightActions = (progress, dragX) => {
return (
<TouchableOpacity onPress={()=>{DeleteContact(i)}}>
<View style={[ContactsStyles.rightAction]}>
<Text style={ContactsStyles.actionText}>Delete</Text>
</View>
</TouchableOpacity>
)
}
Run Code Online (Sandbox Code Playgroud)
这是我可以滑动的地方:
<Swipeable renderRightActions={RightActions} >
<View style={ContactsStyles.UserContainer}>
<Text numberOfLines={1} style={[Fonts.Name]}> {obj.firstname} {obj.lastname} </Text>
{/* Message/Call Container */}
<View style={ContactsStyles.ImageCont}>
{/* Message */}
<TouchableOpacity onPress={() => Communications.text(obj.phone, 'Hey ' + obj.firstname + ', im in need of a Ryde. Are you able to pick me up? This is my current location: ' + location)} >
<View …Run Code Online (Sandbox Code Playgroud) 我正在创建一个项目来学习 React Native。我在这个项目中使用打字稿。我添加了react-navigation:为了使react-navigation正常工作,我必须这样做:
yarn add @react-navigation/native
yarn add @react-navigation/stack
yarn add react-native-screens react-native-safe-area-context
yarn add react-native-reanimated react-native-gesture-handler
Run Code Online (Sandbox Code Playgroud)
不幸的是,我的纱线启动上有这个警告:
WARN RCTBridge required dispatch_sync to load RNGestureHandlerModule. This may lead to deadlocks
LOG Running "TddReactNative" with {"rootTag":11,"initialProps":{}}
WARN [react-native-gesture-handler] Seems like you're using an old API with gesture components, check out new Gestures system!
PanGestureHandler@http://192.168.3.2:8081/index.bundle?platform=ios&dev=true&minify=false&modulesOnly=false&runModule=true&app=org.reactjs.native.example.TddReactNative:137194:38
PanGestureHandler@http://192.168.3.2:8081/index.bundle?platform=ios&dev=true&minify=false&modulesOnly=false&runModule=true&app=org.reactjs.native.example.TddReactNative:136501:34
RCTView
View
AnimatedComponent@http://192.168.3.2:8081/index.bundle?platform=ios&dev=true&minify=false&modulesOnly=false&runModule=true&app=org.reactjs.native.example.TddReactNative:68816:38
AnimatedComponentWrapper
RCTView
View
Card@http://192.168.3.2:8081/index.bundle?platform=ios&dev=true&minify=false&modulesOnly=false&runModule=true&app=org.reactjs.native.example.TddReactNative:135767:36
CardContainer@http://192.168.3.2:8081/index.bundle?platform=ios&dev=true&minify=false&modulesOnly=false&runModule=true&app=org.reactjs.native.example.TddReactNative:135324:34
RNSScreen
AnimatedComponent@http://192.168.3.2:8081/index.bundle?platform=ios&dev=true&minify=false&modulesOnly=false&runModule=true&app=org.reactjs.native.example.TddReactNative:68816:38
AnimatedComponentWrapper
MaybeFreeze@http://192.168.3.2:8081/index.bundle?platform=ios&dev=true&minify=false&modulesOnly=false&runModule=true&app=org.reactjs.native.example.TddReactNative:161553:23
Screen@http://192.168.3.2:8081/index.bundle?platform=ios&dev=true&minify=false&modulesOnly=false&runModule=true&app=org.reactjs.native.example.TddReactNative:161620:36
MaybeScreen@http://192.168.3.2:8081/index.bundle?platform=ios&dev=true&minify=false&modulesOnly=false&runModule=true&app=org.reactjs.native.example.TddReactNative:161373:24
RNSScreenContainer
ScreenContainer@http://192.168.3.2:8081/index.bundle?platform=ios&dev=true&minify=false&modulesOnly=false&runModule=true&app=org.reactjs.native.example.TddReactNative:161753:31
MaybeScreenContainer@http://192.168.3.2:8081/index.bundle?platform=ios&dev=true&minify=false&modulesOnly=false&runModule=true&app=org.reactjs.native.example.TddReactNative:161344:23
RCTView
View
Background@http://192.168.3.2:8081/index.bundle?platform=ios&dev=true&minify=false&modulesOnly=false&runModule=true&app=org.reactjs.native.example.TddReactNative:123808:21
CardStack@http://192.168.3.2:8081/index.bundle?platform=ios&dev=true&minify=false&modulesOnly=false&runModule=true&app=org.reactjs.native.example.TddReactNative:133002:36
RNCSafeAreaProvider
SafeAreaProvider@http://192.168.3.2:8081/index.bundle?platform=ios&dev=true&minify=false&modulesOnly=false&runModule=true&app=org.reactjs.native.example.TddReactNative:131859:24
SafeAreaProviderCompat@http://192.168.3.2:8081/index.bundle?platform=ios&dev=true&minify=false&modulesOnly=false&runModule=true&app=org.reactjs.native.example.TddReactNative:132694:24
RCTView
View …Run Code Online (Sandbox Code Playgroud) ios typescript react-native react-navigation react-native-gesture-handler
我正在尝试练习使用react-native-gesture-handler. 一切都渲染了,但我无法在屏幕上移动方块。我已经安装了react-native-reanimated适当的插件,清除了缓存并react-native-gesture-handler使用 expo 安装,但它在我的 Android 手机或 Android 模拟器上不起作用。有趣的是,它确实可以在网络浏览器上运行。以下是代码:
import {
PanGestureHandler,
PanGestureHandlerGestureEvent,
} from "react-native-gesture-handler";
import { StatusBar } from "expo-status-bar";
import React from "react";
import { StyleSheet, Text, View } from "react-native";
import Animated, {
useAnimatedGestureHandler,
useAnimatedStyle,
useSharedValue,
withSpring,
} from "react-native-reanimated";
const SIZE = 100.0;
const CIRCLE_RADIUS = SIZE * 2;
type ContextType = {
translateX: number;
translateY: number;
};
export default function App() {
const translateX = useSharedValue(0);
const translateY = …Run Code Online (Sandbox Code Playgroud) react-native-gesture-handler ×10
react-native ×8
expo ×2
ios ×2
javascript ×2
android ×1
babeljs ×1
cocoapods ×1
eas ×1
kotlin ×1
pinchzoom ×1
ruby ×1
swipe ×1
typescript ×1