Skip to content

Commit

Permalink
fix(EN): Modal.prompt keyboard avoid view
Browse files Browse the repository at this point in the history
close #1489
  • Loading branch information
paranoidjk committed Jul 21, 2017
1 parent b4bf59a commit 610008c
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions components/modal/PromptContainer.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* tslint:disable:jsx-no-multiline-js */
import React from 'react';
import { View, Text, TextInput } from 'react-native';
import { View, Text, TextInput, KeyboardAvoidingView } from 'react-native';
import Modal from './Modal';
import promptStyles, { IPromptStyle } from './style/prompt';

Expand Down Expand Up @@ -118,7 +118,7 @@ export default class PropmptContainer extends React.Component<PropmptContainerPr
footer={footer}
onAnimationEnd={onAnimationEnd}
>
<View>
<KeyboardAvoidingView behavior="padding">
{message && message.length && <Text style={styles.message}>{message}</Text>}
<View style={styles.inputGroup}>
{ type !== 'secure-text' && (
Expand Down Expand Up @@ -148,7 +148,8 @@ export default class PropmptContainer extends React.Component<PropmptContainerPr
)
}
</View>
</View>
<View style={{ height: 60 }} />
</KeyboardAvoidingView>
</Modal>
);
}
Expand Down

7 comments on commit 610008c

@linhanyang
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

此处没有判断android平台,在android平台KeyboardAvoidingView不适用,会出现偏离特别远。
我在自定义部分一般都这么判断:<KeyboardAvoidingView behavior={Platform.OS === 'ios' ? 'padding' : 'height'}>

@paranoidjk
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@linhanyang 这两种模式有什么区别?我手边没有 android 测试机

@linhanyang
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

height属性默认属性,不做任何处理,官方没有做相应的说明,在android平台上,不需要设置KeyboardAvoidingView也能自适应,所以我就在这个地方判断了以下。

@paranoidjk
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@linhanyang 来个 Pull Request 帮忙修复一下吧 😄

@linhanyang
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

嗯,我测试下。

@paranoidjk
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@warmhug
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.