2016-07-09 35 views
3

我有一個反應,原生簡單的聊天應用程序,它看起來像這樣反應母語調整<ScrollView/>當鍵盤打開

+----------------- 
|  Header  | 
+----------------+ 
|    | 
|    | 
| Messages | 
|    | 
|    | 
+----------------+ 
| Write here | 
+----------------+ 

我想達到的目標是,當我打開鍵盤郵件視圖縮小(降低高度),我可以看到標題和文本輸入,就像我現在看到的那樣,當我打開鍵盤時,應用程序保持尺寸,但鍵盤將所有內容推到頂部。

回答

1

我們已經與https://github.com/Andr3wHur5t/react-native-keyboard-spacer成功。

你可以設置它像這樣爲你的例子:

<View style={[{flex: 1}]}> 
    <Header style={{height: 80}}/> 
    <Messages style={{flex: 1}}/> 
    <WriteHere style={{height: 80}}/> 

    {/* The view that will animate to match the keyboards height */} 
    <KeyboardSpacer/> 
    </View> 
在什麼平臺上
+1

?我使用的是android – Hiero

+1

我相信它可以在android上工作(儘管是自述文件)。 –

+0

會試一試,謝謝! – Hiero