2016-07-09 34 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