Installations
npm install react-native-input-scroll-view
Releases
Unable to fetch releases
Developer
baijunjie
Developer Guide
Module System
CommonJS
Min. Node Version
Typescript Support
Yes
Node Version
12.4.0
NPM Version
6.13.0
Statistics
352 Stars
130 Commits
75 Forks
10 Watching
1 Branches
10 Contributors
Updated on 08 Nov 2024
Languages
JavaScript (60.09%)
Java (20.65%)
Objective-C (14.71%)
Ruby (2.55%)
Starlark (2%)
Total Downloads
Cumulative downloads
Total Downloads
1,025,371
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
Daily Downloads
Weekly Downloads
Monthly Downloads
Yearly Downloads
Dependencies
1
react-native-input-scroll-view
Mainly to achieve the following functions:
- When the keyboard pops up, the
TextInput
will automatically adjust to the top of the keyboard. - When the keyboard pops up, the content of the
ScrollView
will not be obscured by the keyboard. - When multiline
TextInput
gets focus, the selected cursor will be automatically adjusted to the top of the keyboard. - When the multiline
TextInput
create new line, the new line will automatically adjust to the top of the keyboard. - Put your finger on top of
TextInput
and slideScrollView
, when you lift your finger, theTextInput
will not get focus.
Installation
npm
1$ npm install react-native-input-scroll-view --save
yarn
1$ yarn add react-native-input-scroll-view
Usage
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
.
Multiline TextInput in the Android
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};
Props
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 |
ENV
"react": "^16.0.0-alpha.12"
"react-native": ">=0.46.0"
Product case
License
MIT
No vulnerabilities found.
Reason
license file detected
Details
- Info: project has a license file: LICENSE:0
- Info: FSF or OSI recognized license: MIT License: LICENSE:0
Reason
binaries present in source code
Details
- Warn: binary detected: __test__/android/gradle/wrapper/gradle-wrapper.jar:1
Reason
Found 5/25 approved changesets -- score normalized to 2
Reason
project is archived
Details
- Warn: Repository is archived.
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
- Warn: no security policy file detected
- Warn: no security file to analyze
- Warn: no security file to analyze
- Warn: no security file to analyze
Reason
project is not fuzzed
Details
- Warn: no fuzzer integrations found
Reason
branch protection not enabled on development/release branches
Details
- Warn: branch protection not enabled for branch 'master'
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
- Warn: 0 commits out of 10 are checked with a SAST tool
Reason
50 existing vulnerabilities detected
Details
- Warn: Project is vulnerable to: GHSA-67hx-6x53-jw92
- Warn: Project is vulnerable to: GHSA-93q8-gq69-wqmw
- Warn: Project is vulnerable to: GHSA-fwr7-v2mv-hh25
- Warn: Project is vulnerable to: GHSA-grv7-fg5c-xmjg
- Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275
- Warn: Project is vulnerable to: GHSA-gxpj-cx7g-858c
- Warn: Project is vulnerable to: GHSA-w573-4hg7-7wgq
- Warn: Project is vulnerable to: GHSA-ww39-953v-wcq6
- Warn: Project is vulnerable to: GHSA-f5x2-xv93-4p23
- Warn: Project is vulnerable to: GHSA-gmpm-xp43-f7g6
- Warn: Project is vulnerable to: GHSA-pf27-929j-9pmm
- Warn: Project is vulnerable to: GHSA-327c-qx3v-h673
- Warn: Project is vulnerable to: GHSA-x4cf-6jr3-3qvp
- Warn: Project is vulnerable to: GHSA-mph8-6787-r8hw
- Warn: Project is vulnerable to: GHSA-7mhc-prgv-r3q4
- Warn: Project is vulnerable to: GHSA-43f8-2h32-f4cj
- Warn: Project is vulnerable to: GHSA-896r-f27r-55mw
- Warn: Project is vulnerable to: GHSA-9c47-m6qq-7p4h
- Warn: Project is vulnerable to: GHSA-29mw-wpgm-hmr9
- Warn: Project is vulnerable to: GHSA-35jh-r3h4-6jhm
- Warn: Project is vulnerable to: GHSA-952p-6rrq-rcjv
- Warn: Project is vulnerable to: GHSA-f8q6-p94x-37v3
- Warn: Project is vulnerable to: GHSA-xvch-5gv4-984h
- Warn: Project is vulnerable to: GHSA-r683-j2x4-v87g
- Warn: Project is vulnerable to: GHSA-w7rc-rwvf-8q5r
- Warn: Project is vulnerable to: GHSA-5fw9-fq32-wv5p
- Warn: Project is vulnerable to: GHSA-hj48-42vr-x3v9
- Warn: Project is vulnerable to: GHSA-4cpg-3vgw-4877
- Warn: Project is vulnerable to: GHSA-hrpp-h998-j3pp
- Warn: Project is vulnerable to: GHSA-rxrc-rgv4-jpvx
- Warn: Project is vulnerable to: GHSA-7f53-fmmv-mfjv
- Warn: Project is vulnerable to: GHSA-p8p7-x288-28g6
- Warn: Project is vulnerable to: GHSA-c2qf-rxjj-qqgw
- Warn: Project is vulnerable to: GHSA-m6fv-jmcg-4jfg
- Warn: Project is vulnerable to: GHSA-cm22-4g7w-348p
- Warn: Project is vulnerable to: GHSA-g4rg-993r-mgx7
- Warn: Project is vulnerable to: GHSA-gff7-g5r8-mg8m
- Warn: Project is vulnerable to: GHSA-jgrx-mgxx-jf9v
- Warn: Project is vulnerable to: GHSA-72xf-g2v4-qvf3
- Warn: Project is vulnerable to: GHSA-662x-fhqg-9p8v
- Warn: Project is vulnerable to: GHSA-394c-5j6w-4xmx
- Warn: Project is vulnerable to: GHSA-78cj-fxph-m83p
- Warn: Project is vulnerable to: GHSA-fhg7-m89q-25r3
- Warn: Project is vulnerable to: GHSA-j8xg-fqg3-53r7
- Warn: Project is vulnerable to: GHSA-6fc8-4gx4-v693
- Warn: Project is vulnerable to: GHSA-3h5v-q93c-6h6q
- Warn: Project is vulnerable to: GHSA-h6q6-9hqw-rwfv
- Warn: Project is vulnerable to: GHSA-5fg8-2547-mr8q
- Warn: Project is vulnerable to: GHSA-crh6-fp67-6883
- Warn: Project is vulnerable to: GHSA-c4w7-xm78-47vh
Score
1.9
/10
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