我正在使用一个干净的项目,不能在我的代码中的任何部分使用require,例如在图像中:
<Image
style={styles.stretch}
source={require('./img/favicon.png')}
/>
无论是在这里还是使用react-native-router-flux插件的其他部分,我都希望能够覆盖返回按钮图像,但由于'require'未定义,我无法更改它。
<Scene backButtonImage={require('./custom_icon.png')} />
这是我的 package.json 文件。
{
"name": "CleanProject",
"version": "0.0.1",
"private": true,
"scripts": {
"start": "node node_modules/react-native/local-cli/cli.js start",
"test": "jest"
},
"dependencies": {
"react": "15.4.2",
"react-native": "0.40.0",
"react-native-router-flux": "^3.37.0"
},
"devDependencies": {
"babel-eslint": "^7.1.1",
"babel-jest": "18.0.0",
"babel-preset-react-native": "1.9.1",
"eslint": "^3.12.0",
"eslint-plugin-react": "^6.8.0",
"jest": "18.1.0",
"react-test-renderer": "~15.4.0-rc.4"
},
"jest": {
"preset": "react-native"
}
}
你有任何想法吗?