2017-04-17 201 views
1

我試圖在我的React Native應用程序中使用React-Native-Drawer(但是出現與NativeBase抽屜相同的問題),但沒有在屏幕上顯示:無論是抽屜還是主要內容。但是,如果我記錄抽屜組件的jsx標籤,它既不是null也不是undefined。ReactNative抽屜:空白屏幕

這裏的相關片段:

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" 
    } 
} 

所以我的問題就是以下幾點:我錯過了一些東西,一些設置或抽屜中的屬性?我的代碼有什麼問題?

+0

現在面臨着同樣的問題,如果你找到解決辦法,請分享 – iamawebgeek

+0

遺憾的是仍然沒有解決。贊成與Expo SDK一起編寫應用程序。 – loloof64

+0

儘管我放棄了這個項目,但我認爲這個錯誤來自'content = {sideBar}'',應該用'content = {()=> sideBar}'代替。 – loloof64

回答