Installations
npm install react-native-smarter-scroll-view
Developer Guide
Typescript
No
Module System
CommonJS
Releases
Unable to fetch releases
Contributors
Unable to fetch Contributors
Languages
JavaScript (75.47%)
Objective-C (16.81%)
Java (7.73%)
Love this project? Help keep it running — sponsor us today! 🚀
Developer
davwheat
Download Statistics
Total Downloads
901
Last Day
5
Last Week
9
Last Month
21
Last Year
111
GitHub Statistics
107 Commits
1 Watching
8 Branches
1 Contributors
Package Meta Information
Latest Version
2.1.1
Package Id
react-native-smarter-scroll-view@2.1.1
Unpacked Size
2.02 MB
Size
1.77 MB
File Count
70
Total Downloads
Cumulative downloads
Total Downloads
901
Last day
0%
5
Compared to previous day
Last week
28.6%
9
Compared to previous week
Last month
75%
21
Compared to previous month
Last year
-15.9%
111
Compared to previous year
Daily Downloads
Weekly Downloads
Monthly Downloads
Yearly Downloads
Peer Dependencies
2
Dev Dependencies
3
react-native-smart-scroll-view
Based off of nikhilaravi/react-native-smart-scroll-view
A pure JS React Native Component for IOS.
A wrapper around react-native ScrollView to handle keyboard events and auto adjust input fields to be visible above keyboard on focus.
Takes in your components and recursively searches for any component (i.e. TextInput) that is given smartScrollOptions
as a prop. Further props are added to these components to ensure they are always visible above the keyboard and within the ScrollView when focused.
There is also the option to autofocus the next component with smartScrollOptions
on TextInput submission, and the ability to autofocus any component by setting the smartScrollOptions
props appropriately and specifying the index of the component (more info below) .
Great for use with forms which have multiple TextInput fields!
Getting Started
Installation
1$ yarn add react-native-smart-scroll-view
1$ npm i react-native-smart-scroll-view --save
Properties
In wrapping around the ScrollView and using the TextInput to control keyboard we have used their native properties to create our functionality. You can still add most props to TextInputs and we will allow you to pass some props to the ScrollView but do so with care.
SmartScrollView Props
Prop | Default | Type | Description |
---|---|---|---|
forceFocusField | undefined | number or string | Force scroll the view to the TextInput field at the specified index (smart children indexed in order from 0) or scrollRef you have given to your smart child (see smartScrollOptions below). |
scrollContainerStyle | {} | object | Style options for the View that wraps the ScrollView, the ScrollView will take up all available space. |
scrollPadding | 8 | number | Padding between the top of the keyboard/ScrollView and the focused TextInput field. |
contentContainerStyle | {} | object | The contentContainerStyle of the ScrollView prop |
zoomScale | 1 | number | Set to the ScrollView zoomScale prop |
showsVerticalScrollIndicator | true | bool | Set to the ScrollView showsVerticalScrollIndicator prop |
contentInset | { top: 0, left: 0, bottom: 0, right: 0 } | object | Set to the ScrollView contentInset prop |
onScroll | () => {} | func | Set to the ScrollView onScroll function. It will be called alongside our own. |
onRefFocus | () => {} | func | Gives back the ref of the node whenever a smart component is focused. |
bounces | false | bool | Controls bouncing of the underlying ScrollView. |
Smart Component Props
Smart components can be the native 'TextInput' s, other component like 'View' s or your own custom components.
For each component that you would like to use, provide the prop smartScrollOptions
alongside the normal props. Beware* some props of native components like TextInputs may be modified by the Smart Scroll View (see below).
smartScrollOptions - An object with the following keys:
Key | Type | Description |
---|---|---|
type | enum (text ,custom ) | For type 'text' the 'moveToNext' and 'onSubmitEditing' options can be set (see below). For type 'custom' further scrolling must be done by forcing the index |
moveToNext | bool | If true , the next TextInput field will be focused when the submit button on the keyboard is pressed. Should be set to false or omitted for the last input field on the page. Warning this will not work if keyboardType for the TextInput is set to 'number-pad', 'decimal-pad', 'phone-pad' or 'numeric' as they do not have a return key |
onSubmitEditing(next) | func | Optional function that takes a callback. When invoked, the callback will focus the next TextInput field. If no function is specified the next TextInput field is focused. Example: (next) => { if (condition) { next() } } |
scrollRef | string | To be used in conjunction with the 'forceFocusField' prop of the 'SmartScrollView'. Use 'scrollRef' to reference a particular component which can then be set to forceFocusField to have control where the focus is |
How We Modify TextInput Props
For any component which has 'smartScrollOptions.type = text', it is inferred that it is either a 'TextInput' component or contains a 'TextInput' component. The props of the enclosing 'TextInput' component are modified in the following way.
- We attach our own
onFocus
function and will call yours alongside. - If
moveToNext
insmartScrollOptions
is true:- The
onSubmitEditing
is replaced with our own. See above. blurOnSubmit
is set to false
- The
Example Usage
Code for the above gif is found here
Here is another example of the smart-scroll-view in action.
To run the code yourself and play around, open and run the Xcode project.
1open SuperScrollingFormExample/ios/SuperScrollingFormExample.xcodeproj
TODO
From original repo. I am not promising anything from this list...
- Allow for more types other than text input to have smart scroll functionality.
- i.e. a customisable picker component that can be used to replace keyboard to allow the user to select a value from a picker.
- Any image, button, slider
- Allow for header/banner above keyboard.
- Better animations
- Your issues/suggestions!
![Empty State](/_next/static/media/empty.e5fae2e5.png)
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: SuperScrollingFormExample/android/gradle/wrapper/gradle-wrapper.jar:1
Reason
Found 0/11 approved changesets -- score normalized to 0
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
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
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
SAST tool is not run on all commits -- score normalized to 0
Details
- Warn: 0 commits out of 22 are checked with a SAST tool
Reason
11 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-3xgq-45jj-v275
- Warn: Project is vulnerable to: GHSA-ww39-953v-wcq6
- Warn: Project is vulnerable to: GHSA-29mw-wpgm-hmr9
- Warn: Project is vulnerable to: GHSA-35jh-r3h4-6jhm
- Warn: Project is vulnerable to: GHSA-f8q6-p94x-37v3
- Warn: Project is vulnerable to: GHSA-xvch-5gv4-984h
- Warn: Project is vulnerable to: GHSA-hj48-42vr-x3v9
- Warn: Project is vulnerable to: GHSA-c2qf-rxjj-qqgw
- Warn: Project is vulnerable to: GHSA-j8xg-fqg3-53r7
Score
1.6
/10
Last Scanned on 2025-02-03
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