React Native 抽屉:空白屏幕
ReactNative drawer : blank screen
我正在尝试在我的 React Native 应用程序中使用 React-Native-Drawer(但同样的问题出现在 NativeBase 抽屉中),但屏幕上没有任何显示:无论是抽屉还是主要内容。但是,如果我记录抽屉组件的jsx标签,它既不是null也不是undefined。
这里是相关的片段:
render(){
const mainZone = <Text>Hello drawer !</Text>
const sideBar = <Text>My drawer item</Text>
const drawerZone = <Drawer
ref={(ref) => { this.drawer = ref; }}
content={sideBar}
onClose={() => this.closeDrawer()}
tapToClose
>
{mainZone}
</Drawer>;
return drawerZone;
}
这里是版本
$ react-native --version
react-native-cli: 2.0.1
react-native: 0.43.3
package.json
{
"name": "custom-app",
"version": "0.0.1",
"private": true,
"scripts": {
"start": "node node_modules/react-native/local-cli/cli.js start",
"android": "curl 'http://localhost:8081/index.android.bundle?platform=android' -o 'android/app/src/main/assets/index.android.bundle' && node node_modules/react-native/local-cli/cli.js run-android",
"test": "jest"
},
"dependencies": {
"chess-lib-js": "0.0.5",
"native-base": "^2.1.1",
"react": "16.0.0-alpha.6",
"react-native": "0.43.3",
"react-native-fetch-blob": "^0.10.4",
"react-native-splash-screen": "^2.0.0",
"react-native-svg": "^5.1.7"
},
"devDependencies": {
"babel-jest": "19.0.0",
"babel-preset-react-native": "1.9.1",
"jest": "19.0.2",
"react-test-renderer": "16.0.0-alpha.6"
},
"jest": {
"preset": "react-native"
}
}
所以我的问题如下:我是否遗漏了某些东西、一些设置或抽屉中的 属性?我的代码有什么问题?
NativeBase-KitchenSink 展示了所有 NativeBase 组件。
检查 Drawer 实现
我正在尝试在我的 React Native 应用程序中使用 React-Native-Drawer(但同样的问题出现在 NativeBase 抽屉中),但屏幕上没有任何显示:无论是抽屉还是主要内容。但是,如果我记录抽屉组件的jsx标签,它既不是null也不是undefined。
这里是相关的片段:
render(){
const mainZone = <Text>Hello drawer !</Text>
const sideBar = <Text>My drawer item</Text>
const drawerZone = <Drawer
ref={(ref) => { this.drawer = ref; }}
content={sideBar}
onClose={() => this.closeDrawer()}
tapToClose
>
{mainZone}
</Drawer>;
return drawerZone;
}
这里是版本
$ react-native --version
react-native-cli: 2.0.1
react-native: 0.43.3
package.json
{
"name": "custom-app",
"version": "0.0.1",
"private": true,
"scripts": {
"start": "node node_modules/react-native/local-cli/cli.js start",
"android": "curl 'http://localhost:8081/index.android.bundle?platform=android' -o 'android/app/src/main/assets/index.android.bundle' && node node_modules/react-native/local-cli/cli.js run-android",
"test": "jest"
},
"dependencies": {
"chess-lib-js": "0.0.5",
"native-base": "^2.1.1",
"react": "16.0.0-alpha.6",
"react-native": "0.43.3",
"react-native-fetch-blob": "^0.10.4",
"react-native-splash-screen": "^2.0.0",
"react-native-svg": "^5.1.7"
},
"devDependencies": {
"babel-jest": "19.0.0",
"babel-preset-react-native": "1.9.1",
"jest": "19.0.2",
"react-test-renderer": "16.0.0-alpha.6"
},
"jest": {
"preset": "react-native"
}
}
所以我的问题如下:我是否遗漏了某些东西、一些设置或抽屉中的 属性?我的代码有什么问题?
NativeBase-KitchenSink 展示了所有 NativeBase 组件。
检查 Drawer 实现