You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

报错:TypeError: null is not an object (evaluating 'Scene.props') 求排查方向

Fixing TypeError: null is not an object (evaluating 'Scene.props') in Your React Native App

Hey there, let's break down why you're hitting this error and get your app running smoothly again. Looking at your code, there are a few key issues that could be causing this:

1. Incorrect Import of Your Scenes

In your scene.js, you're exporting the scenes as a default export:

export default scenes

But in AppContainer.js, you're trying to import it as a named export using destructuring:

import {scenes} from '../routes/home/scenes'

This will result in scenes being undefined (or null in some cases), which breaks the Router component since it's expecting a valid scene configuration. Fix this by changing the import to:

import scenes from '../routes/home/scenes'

2. Broken PropTypes Definition

Your AppContainer's propTypes setup is incorrect. The line store:PropTypes.checkPropTypes() doesn't do what you think it does—checkPropTypes is a function used to manually validate props, not to define the type of a prop.

Replace that with a valid prop type definition for your Redux store. For example:

static propTypes={
  store: PropTypes.object.isRequired
}

If you want to be more specific, you can use PropTypes.shape() to define the structure of your store, but object.isRequired is a safe starting point. This ensures your component receives a valid Redux store, which is critical for the Provider and Router to work correctly.

3. Possible react-native-router-flux Version Compatibility

If the above fixes don't resolve the error, check your react-native-router-flux version. The Actions.create() method you're using in scene.js has been deprecated in newer versions of the library.

Instead of wrapping your scenes with Actions.create, try directly exporting the JSX structure:

// scene.js
import React from 'react';
import {Scene} from 'react-native-router-flux';
import HomeContainer from '../home/containers/HomeContainers';

export default (
  <Scene key="root">
    <Scene key="home" component={HomeContainer} title="home" initial/>
  </Scene>
)

Then pass this directly to the Router's scenes prop as you already are.


Try applying these fixes one by one, starting with the import and PropTypes issues—those are the most likely culprits here.

内容的提问来源于stack exchange,提问作者Asics

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.06 08:03:10