1. 程式人生 > >react-navigation踩坑記錄

react-navigation踩坑記錄

一、BUG記錄

在專案當中引入react-navition(2.13.0),執行的時候出現了以下錯誤:

TypeError: undefined is not an object (evaluating 'context.changedBits')

This error is located at:

    in SceneView (at SwitchView.js:12)

    in SwitchView (at createNavigator.js:57)

    in Navigator (at createNavigationContainer.js:376)

    in NavigationContainer (at Launch.js:181)

    in MySwitchNavigatorPage (at App.js:23)

    in Provider (at App.js:22)

    in App (at CodePush.js:510)

    in CodePushComponent (at TopView.js:214)

    in RCTView (at View.js:78)

    in View (at TopView.js:196)

    in PureView (at TopView.js:165)

    in RCTView (at View.js:78)

    in View (at createAnimatedComponent.js:147)

    in AnimatedComponent (at TopView.js:164)

    in RCTView (at View.js:78)

    in View (at TopView.js:163)

    in TopView (at TopView.js:213)

    in RootElement (at renderApplication.js:35)

    in RCTView (at View.js:78)

    in View (at AppContainer.js:102)

    in RCTView (at View.js:78)

    in View (at AppContainer.js:122)

    in AppContainer (at renderApplication.js:34)

pushProvider

    index.delta?platform=android&dev=true&minify=false:8052:44

updateContextProvider

    index.delta?platform=android&dev=true&minify=false:8567:23

beginWork

    index.delta?platform=android&dev=true&minify=false:8682:43

performUnitOfWork

    index.delta?platform=android&dev=true&minify=false:10568:31

workLoop

    index.delta?platform=android&dev=true&minify=false:10619:49

invokeGuardedCallback

    index.delta?platform=android&dev=true&minify=false:2753:21

invokeGuardedCallback

    index.delta?platform=android&dev=true&minify=false:2822:40

renderRoot

    index.delta?platform=android&dev=true&minify=false:10670:36

performWorkOnRoot

    index.delta?platform=android&dev=true&minify=false:11295:40

performWork

    index.delta?platform=android&dev=true&minify=false:11231:32

performSyncWork

    index.delta?platform=android&dev=true&minify=false:11212:22

requestWork

    index.delta?platform=android&dev=true&minify=false:11139:28

scheduleWorkImpl

    index.delta?platform=android&dev=true&minify=false:11012:28

scheduleWork

    index.delta?platform=android&dev=true&minify=false:10972:34

scheduleRootUpdate

    index.delta?platform=android&dev=true&minify=false:11530:23

updateContainerAtExpirationTime

    index.delta?platform=android&dev=true&minify=false:11555:36

updateContainer

    index.delta?platform=android&dev=true&minify=false:11575:51

render

    index.delta?platform=android&dev=true&minify=false:12014:41

renderApplication

    index.delta?platform=android&dev=true&minify=false:58997:23

run

    index.delta?platform=android&dev=true&minify=false:58655:35

runApplication

    index.delta?platform=android&dev=true&minify=false:58705:28

__callFunction

    index.delta?platform=android&dev=true&minify=false:2380:49

<unknown>

    index.delta?platform=android&dev=true&minify=false:2150:31

__guardSafe

    index.delta?platform=android&dev=true&minify=false:2342:13

callFunctionReturnFlushedQueue

index.delta?platform=android&dev=true&minify=false:2149:21

二、相關庫版本

"react": "^16.3.0-alpha.1",

"react-native": "0.54.2",

"react-navigation": "^2.13.1",

三、BUG原因

庫版本不相容或者包衝突。

四、解決方案

將react-native版本升級為0.55.4,react版本升級為16.3.1,再重新執行專案就OK了。