1
我下面描述的步骤作出反应本地文件阵营本地集成与现有的应用程序和图像
https://facebook.github.io/react-native/docs/integration-with-existing-apps.html
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mReactRootView = new ReactRootView(this);
mReactInstanceManager = ReactInstanceManager.builder()
.setApplication(getApplication())
.setBundleAssetName("index.android.bundle")
.setJSMainModuleName("index.android")
.addPackage(new MainReactPackage())
.setUseDeveloperSupport(BuildConfig.DEBUG)
.setInitialLifecycleState(LifecycleState.RESUMED)
.build();
mReactRootView.startReactApplication(mReactInstanceManager, "HelloWorld", null);
setContentView(mReactRootView);
}
然而,当我尝试做使用具有图像分量图像从我的Android资产,它没有显示。
https://facebook.github.io/react-native/docs/images.html#images-from-hybrid-app-s-resources
任何整合一个反应机应用到从资产一个Android应用和所使用的图像?
我试图
<Image source={{uri:'file:///data/data/com.sampleproject/files/blankProject2/0.1/img/sample.jpeg'}} style={{width: 300, height: 300}}/>
和
<Image source={{uri: 'img_sample.jpeg'}} />
两种情况失败。
'<图像源= {{URI:“img_sample.jpeg '}} style = {{width:300,height:300}} />'试着指定宽度和高度? – liupeixin
我试过了,它也没有工作。 – Oximer