React Native Release發(fā)布時,程序閃退了劝赔,而明明在Debug時沒有任何問題誓焦。最后注冊了sentry,使用了React-native-sentry 抓住了出錯誤的地方
TypeError
TypeError: TypeError: TypeError: Invalid attempt to spread non-iterable instance
This error is located at:
in Rect
in RNSVGGroup
in G
in RNSVGGroup
in G
in RNSVGSvgView
in Svg
in RCTView
in RCTView
in _
in l
in f
in RCTView
in n
in RCTView
in RCTView
in n
in v
in RCTView
in RCTView
in l
in RCTView
in n
in RCTView
in n
in _
in k
in k
in v
in v
in RCTView
in RCTView
in RCTView
in f
in RCTView
in f
in C
in n
in P
in RCTView
in n
in RCTView
in f
in b
in y
in L
in RCTView
in h
in C
in k
in v
in v
in l
in k
in k
in v
in RCTView
in RCTView
in c
This error is located at:
in k
in v
in v
in RCTView
in RCTView
in RCTView
in f
in RCTView
in f
in C
in n
in P
in RCTView
in n
in RCTView
in f
in b
in y
in L
in...
最后發(fā)現(xiàn)是react-native-svg中的Rect出了錯着帽,給了一個錯誤的style:
// 錯誤的
<Rect x="25" y="25" width={this.state.battery} height="90"
stroke="rgb(255, 255, 255)" fill="rgb(106, 131, 109)" strokeWidth="5" opacity="1"
style="fill:green;stroke:rgba(255,255, 255, 1);
stroke-width:5;opacity:0.5" />
// 正確的杂伟,刪除了style
<Rect x="25" y="25" width={this.state.battery} height="90"
stroke="rgb(255, 255, 255)" fill="rgb(106, 131, 109)" strokeWidth="5" opacity="1"
/>