类型错误:null 不是对象(评估 'RNGestureHandlerModule.default.Direction') [英] TypeError: null is not an object (evaluating 'RNGestureHandlerModule.default.Direction')

查看:72
本文介绍了类型错误:null 不是对象(评估 'RNGestureHandlerModule.default.Direction')的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对模块 'react-navigation-stack' 有问题我已经从

解决方案

我如何解决 RNGestureHandlerModule.default.Direction 错误:

  1. 确保将该导入放在入口点脚本文件的顶部

    import 'react-native-gesture-handler';

  2. 干净的 Gradle

    cd ./android &&./gradlew 清洁 &&光盘..

  3. 启动 Android 应用程序

    react-native run-android --verbose

并确保您在捆绑器日志中看到该行:

<代码>>任务 :react-native-gesture-handler:compileDebugJavaWithJavac

如果您没有看到它,看起来 bundle 没有将 react-native-gesture-handler 链接到您的应用.

特别检查 1) 如果您有一个 monorepo 移动版本 index.js|tsx 在一个包中,整个应用程序在另一个包中 - 应在移动入口点的顶部添加导入脚本.

I have problem with module 'react-navigation-stack' I've written the same code from https://facebook.github.io/react-native/docs/navigation#react-navigation. Platform: Android. OS: ubuntu

import { createAppContainer } from 'react-navigation';
import { createStackNavigator } from 'react-navigation-stack';
import SearchScreen from './scr/screen/SearchScreen';

const navigator = createStackNavigator(
    {
        Search: SearchScreen
    },
    {
        initialRouteName: 'Search',
        defaultNavigationOptions: {
            title: 'App'
        }
    }
);
const App = createAppContainer(navigator);
export default App;

解决方案

How I have solved the RNGestureHandlerModule.default.Direction error:

  1. be sure that you put that import at the top of your entry point script file

    import 'react-native-gesture-handler';
    

  2. clean Gradle

    cd ./android && ./gradlew clean && cd ..
    

  3. start the Android app with

    react-native run-android --verbose
    

and be sure this you see that line in bundler logs:

> Task :react-native-gesture-handler:compileDebugJavaWithJavac

if you do not see it it looks like bundle did not link react-native-gesture-handler to your app.

Especially check 1) if you have a monorepo with a mobile version index.js|tsx in one package and the whole app in another - import should be added at the top of the mobile entry point script.

这篇关于类型错误:null 不是对象(评估 'RNGestureHandlerModule.default.Direction')的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆