Skip to content
This repository was archived by the owner on Jul 27, 2021. It is now read-only.

Commit 6370260

Browse files
author
baijunjie
committed
v1.8.4
1 parent bbe2c57 commit 6370260

File tree

6 files changed

+19
-6
lines changed

6 files changed

+19
-6
lines changed

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ _onContentSizeChange = ({nativeEvent:event}) => {
101101
| `keyboardOffset` | `number` | `40` | When automatic adjustment, the cursor relative to the top of the keyboard offset. |
102102
| `multilineInputStyle` | `Style` | `null` | If your multiline `TextInput` has a specific style, to ensure that the cursor can be accurately adjusted to the top of the keyboard, this is set as a multiline `TextInput` style, The style attributes that mainly include `fontSize``fontFamily``lineHeight` etc. affect the position of the cursor. **Be careful not to include `width` and `height`**. |
103103
| `useAnimatedScrollView` | `bool` | `false` | Replace regular `ScrollView` component with `Animated.ScrollView` component. |
104+
| `keyboardAvoidingViewProps` | `props` | `null` | `KeyboardAvoidingView` component Props. Check them here: https://facebook.github.io/react-native/docs/keyboardavoidingview |
104105
| `...ScrolView.props` | `props` | | All props from ScrollView are inherited. Check them here: https://facebook.github.io/react-native/docs/scrollview.html |
105106

106107

__test__/react-native-input-scroll-view/index.js

+7-2
Original file line numberDiff line numberDiff line change
@@ -72,12 +72,14 @@ export default class extends PureComponent {
7272
PropTypes.number,
7373
]),
7474
useAnimatedScrollView: PropTypes.bool,
75+
keyboardAvoidingViewProps: PropTypes.object
7576
};
7677

7778
static defaultProps = {
7879
keyboardOffset: 40,
7980
multilineInputStyle: null,
8081
useAnimatedScrollView: false,
82+
keyboardAvoidingViewProps: null
8183
};
8284

8385
state = {
@@ -106,11 +108,14 @@ export default class extends PureComponent {
106108
const {
107109
keyboardOffset,
108110
multilineInputStyle,
109-
children,
110111
useAnimatedScrollView,
112+
keyboardAvoidingViewProps,
113+
children,
111114
...otherProps
112115
} = this.props;
113116

117+
const kavProps = Object.assign({ behavior: isIOS ? 'padding' : null }, keyboardAvoidingViewProps);
118+
114119
const {
115120
measureInputVisible,
116121
measureInputValue,
@@ -122,7 +127,7 @@ export default class extends PureComponent {
122127
const ScrollComponent = useAnimatedScrollView ? Animated.ScrollView : ScrollView;
123128

124129
return (
125-
<KeyboardAvoidingView behavior={isIOS ? 'padding' : null}>
130+
<KeyboardAvoidingView {...kavProps}>
126131
<View style={styles.wrap}>
127132
<ScrollComponent ref={this._onRef}
128133
onFocus={this._onFocus}

index.d.ts

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ export interface InputScrollViewProps extends ScrollViewProperties {
55
readonly keyboardOffset?: number;
66
readonly multilineInputStyle?: TextStyle;
77
readonly useAnimatedScrollView?: boolean;
8+
readonly keyboardAvoidingViewProps?: object;
89
}
910

1011
declare class InputScrollView extends React.Component<InputScrollViewProps> {

index.js

+7-2
Original file line numberDiff line numberDiff line change
@@ -72,12 +72,14 @@ export default class extends PureComponent {
7272
PropTypes.number,
7373
]),
7474
useAnimatedScrollView: PropTypes.bool,
75+
keyboardAvoidingViewProps: PropTypes.object
7576
};
7677

7778
static defaultProps = {
7879
keyboardOffset: 40,
7980
multilineInputStyle: null,
8081
useAnimatedScrollView: false,
82+
keyboardAvoidingViewProps: null
8183
};
8284

8385
state = {
@@ -106,11 +108,14 @@ export default class extends PureComponent {
106108
const {
107109
keyboardOffset,
108110
multilineInputStyle,
109-
children,
110111
useAnimatedScrollView,
112+
keyboardAvoidingViewProps,
113+
children,
111114
...otherProps
112115
} = this.props;
113116

117+
const kavProps = Object.assign({ behavior: isIOS ? 'padding' : null }, keyboardAvoidingViewProps);
118+
114119
const {
115120
measureInputVisible,
116121
measureInputValue,
@@ -122,7 +127,7 @@ export default class extends PureComponent {
122127
const ScrollComponent = useAnimatedScrollView ? Animated.ScrollView : ScrollView;
123128

124129
return (
125-
<KeyboardAvoidingView behavior={isIOS ? 'padding' : null}>
130+
<KeyboardAvoidingView {...kavProps}>
126131
<View style={styles.wrap}>
127132
<ScrollComponent ref={this._onRef}
128133
onFocus={this._onFocus}

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-native-input-scroll-view",
3-
"version": "1.8.0",
3+
"version": "1.8.4",
44
"description": "Perfect TextInput ScrollView",
55
"main": "index.js",
66
"types": "index.d.ts",

中文说明.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,8 @@ _onContentSizeChange = ({nativeEvent:event}) => {
9999
| ----------------------- | -------- | ------- | ---------------------------------------- |
100100
| `keyboardOffset` | `number` | `40` | 当自动调整时,光标相对于键盘顶部的偏移量。 |
101101
| `multilineInputStyle` | `Style` | `null` | 如果你的多行输入框有特定的样式,那么为了光标能够精准调整到键盘上方,应该将多行文本的样式也设置在这里,主要包含 `fontSize``fontFamily``lineHeight` 等会影响到光标位置的样式属性。**注意,不要包含 `width``height`**|
102-
| `useAnimatedScrollView` | `bool` | `false` |`Animated.ScrollView` 组件替换 `ScrollView` 组件。 |
102+
| `useAnimatedScrollView` | `bool` | `false` |`Animated.ScrollView` 组件替换 `ScrollView` 组件。 |
103+
| `keyboardAvoidingViewProps` | `props` | `null` | `KeyboardAvoidingView` 组件的 Props。详细请查阅: https://facebook.github.io/react-native/docs/keyboardavoidingview |
103104
| `...ScrolView.props` | `props` | | 继承 `ScrollView` 组件的所有属性。详细请查阅: https://facebook.github.io/react-native/docs/scrollview.html |
104105

105106

0 commit comments

Comments
 (0)