在React Native中使用react-navigation的堆栈痕迹不显示位置。

问题描述 投票:0回答:1

我在iOS模拟器中从React Native得到的堆栈痕迹在我的应用中没有给出有用的行号。即使如此,我也已经做得很好了,然而有时要找到异常的来源是相当困难的。

有什么方法可以得到更好的信息吗?

下面是一个堆栈跟踪的示例。StackView是我的React功能视图。SceneView是来自react-navigation。

Error: firebase.firestore().collection().where(_, _, *) 'value' argument expected.

This error is located at:
    in StackView (at SceneView.tsx:98)
    in StaticContainer
    in StaticContainer (at SceneView.tsx:89)
    in EnsureSingleNavigator (at SceneView.tsx:88)
    in SceneView (at useDescriptors.tsx:125)
    in RCTView (at CardContainer.tsx:190)
    ...

这是SceneView.tsx的节选。

          {'component' in screen && screen.component !== undefined ? (
            // @ts-ignore
            <screen.component navigation={navigation} route={route} /> // THIS LINE
          ) : 'children' in screen && screen.children !== undefined ? (
            // @ts-ignore
            screen.children({ navigation, route })
          ) : null}
react-native react-navigation
1个回答
0
投票

我也有同样的问题。

我的代码。

static getBy(appLanguage, arrayContains) {
    return new Promise((resolve) => {
        this.unSubscribe = collection
            .where('language', '==', appLanguage)
            .where('code', 'in', arrayContains)
            .onSnapshot((querySnapshot) => {
                const behaviorChange = [];
                querySnapshot.forEach((profile) => {
                    const item = profile.data();
                    const { icon } = item;
                    behaviorChange.push({
                        id: profile.id,
                        ...item,
                    });
                });
                resolve(behaviorChange);
            });
    });
}

// ERROR 
this.getBy(arrayContains);

我的错误是没有把第一个变量(appLanguage)作为参数发送。

© www.soinside.com 2019 - 2024. All rights reserved.