0

您能否將參數(如初始道具)傳遞給根本組件?將參數傳遞到根組件

E.G.

import { AppRegistry } from 'react-native' 
import { Volcalc } from './app' 

AppRegistry.registerComponent('volcalc_m',() => Volcalc({height:10,width:10})) 

我收到錯誤:

​​

如果你想不同:

Unable to execute JS call: fbBatchedBridge is undefined

回答

1

由於Volcalc是你的根組件,只是方法的構造函數中指定組件屬性高度取決於平臺(iOS和Android),然後在index.android.jsindex.ios.js之間創建一個根組件,渲染Volcalc組件:<Volcalc height={10} width={10} />