Gathering detailed insights and metrics for react-native-input-scroll-view
Gathering detailed insights and metrics for react-native-input-scroll-view
Gathering detailed insights and metrics for react-native-input-scroll-view
Gathering detailed insights and metrics for react-native-input-scroll-view
npm install react-native-input-scroll-view
Module System
Min. Node Version
Typescript Support
Node Version
NPM Version
352 Stars
130 Commits
75 Forks
10 Watching
1 Branches
10 Contributors
Updated on 08 Nov 2024
JavaScript (60.09%)
Java (20.65%)
Objective-C (14.71%)
Ruby (2.55%)
Starlark (2%)
Cumulative downloads
Total Downloads
Last day
16.7%
643
Compared to previous day
Last week
7.2%
3,216
Compared to previous week
Last month
0.7%
13,855
Compared to previous month
Last year
-7.6%
178,612
Compared to previous year
1
Mainly to achieve the following functions:
TextInput
will automatically adjust to the top of the keyboard.ScrollView
will not be obscured by the keyboard.TextInput
gets focus, the selected cursor will be automatically adjusted to the top of the keyboard.TextInput
create new line, the new line will automatically adjust to the top of the keyboard.TextInput
and slide ScrollView
, when you lift your finger, the TextInput
will not get focus.
npm
1$ npm install react-native-input-scroll-view --save
yarn
1$ yarn add react-native-input-scroll-view
1import InputScrollView from 'react-native-input-scroll-view'; 2... 3state = { 4 text: '', 5}; 6 7render() { 8 const { text } = this.state; 9 return ( 10 <InputScrollView> 11 <TextInput /> 12 <TextInput /> 13 <TextInput value={text} 14 onChangeText={text => this.setState({ text })} 15 multiline /> 16 </InputScrollView> 17 ); 18}
React-native-input-scroll-view automatically modify onContentSizeChange, onSelectionChange, and onChange TextInput
props. It is not yet designed to pass them down if the TextInput
is wrapped into another component so don’t forget to do it:
1import InputScrollView from 'react-native-input-scroll-view'; 2... 3 4const MyComponent = props => ( 5 <View> 6 <TextInput {...props} /> 7 </View> 8); 9... 10 11state = { 12 text: '', 13}; 14 15render() { 16 const { text } = this.state; 17 return ( 18 <InputScrollView> 19 <MyComponent value={text} 20 onChangeText={text => this.setState({ text })} 21 /> 22 </InputScrollView> 23 ); 24}
Note that if the cursor is to be correctly adjusted to the top of the keyboard, you must bind value
to TextInput
.
If your ReactNative version is on or above v0.57
, skip this section.
Before a certain version of ReactNative, multiline TextInput
height on an Android device could not change properly based on its content, so we need to add additional processing code
1import InputScrollView from 'react-native-input-scroll-view'; 2... 3 4state = { 5 text: '', 6 textareaHeight: null, 7}; 8 9render() { 10 const { text, textareaHeight } = this.state; 11 return ( 12 <InputScrollView> 13 <TextInput /> 14 <TextInput /> 15 <TextInput style={{ height: textareaHeight }} 16 value={text} 17 onChangeText={text => this.setState({ text })} 18 onContentSizeChange={this._onContentSizeChange} 19 multiline /> 20 </InputScrollView> 21 ); 22} 23 24_onContentSizeChange = ({nativeEvent:event}) => { 25 this.setState({ textareaHeight: event.contentSize.height }); 26};
Property | Type | Default | Description |
---|---|---|---|
topOffset | number | undefined | The offset of the InputScrollView relative to the top of the window. When the screen contains TopBar , it is usually set to the height of TopBar . If not explicitly set, the program will automatically determine, but may cause problems. issues#43。 |
keyboardOffset | number | 40 | When automatic adjustment, the cursor relative to the top of the keyboard offset. |
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 . |
useAnimatedScrollView | bool | false | Replace regular ScrollView component with Animated.ScrollView component. |
supportHardwareKeyboard | bool | false | beta If your device does not use a soft keyboard, try using this parameter to solve the problem. issues#69 |
keyboardAvoidingViewProps | props | null | KeyboardAvoidingView component Props. Check them here: https://facebook.github.io/react-native/docs/keyboardavoidingview |
...ScrollView.props | props | All props from ScrollView are inherited. Check them here: https://facebook.github.io/react-native/docs/scrollview.html |
"react": "^16.0.0-alpha.12"
"react-native": ">=0.46.0"
MIT
No vulnerabilities found.
Reason
license file detected
Details
Reason
binaries present in source code
Details
Reason
Found 5/25 approved changesets -- score normalized to 2
Reason
project is archived
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Reason
50 existing vulnerabilities detected
Details
Score
Last Scanned on 2024-11-25
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More