reactjs


How to get DataSource length in react-native?


How do I get the DataSource's length of a ListView?
Suppose I have the following declaration:
const ds = new ListView.DataSource({ rowHasChanged });
...
someObjectsDs = ds.cloneWithRows(someObjectsArray);
I've tried someObjects.length but this returns me undefined.
You can view the amount of rows to be rendered by calling
someObjectsDs.getRowCount()
Official documentation
You can either dig into the datasource object to find the data and grab the length or you can set the data as a property of the component and refer to that:
this.someObjectsArray = someObjectsArray;
someObjectsDs = ds.cloneWithRows(this.someObjectsArray);
Now you will be able to do this.someObjectsArray.length, just make sure you're updating this variable anytime you're updating the datasource.

Related Links

Persisting events for a period of time with React / Redux
Add a success message after redirect in reactjs
react-router-dom usage in index.js
How do I change webpack dev server's default port from 8080 to a different port?
how can I cohabitate D3 and React.js or Vue.js?
Set default activeClassName for NavLink in React Router v4
Reactjs combine all the states to parent component
How to pass a function down the component's hierarchy without using props in React?
Meteor React createContainer rerender
Idiomatic way to chain redux state changes?
How to select unknown element in react native webview?
How to split props string in React?
TypeScript: Export React components as part of a namespace
How to find out what is initiating an (re)render in React
Get API response to a function and populate controls
Manage conflict between componentwillrecieveprops and onChange function

Categories

HOME
airflow
gulp
google-cloud-pubsub
ns2
gsm
fortran
x86-64
coordinates
mediarecorder
rmarkdown
wkhtmltopdf
wowza
solidity
http-status-codes
openstack-horizon
luis
web-parts
samba
gomobile
datazen-server
include-path
dev-c++
connectiq
onclicklistener
handle
functional-dependencies
formtastic
setup-project
ng2-bootstrap
javax
border-layout
rtsp
form-fields
queryover
motion
observer-pattern
ng-lightning
socketcluster
tapply
jvisualvm
pyexcel
result
gridgain
activeandroid
yank
rivets.js
emacs24
history
bioperl
webmatrix
blackberry
timex
scanf
therubyracer
joystick
deck.js
magick.net
laterjs
innertext
oryx
wordpress-plugin
fadein
clear
gtkwave
android-togglebutton
p4python
euro
log-analysis
mergecursor
system.io.packaging
mind-manager
pytz
dateadd
traceur
logo-lang
grunt-wiredep
ardor3d
octokit
qgraphicsscene
forward-declaration
spawn
pageload
microsoft-speech-platform
database-restore
screensharing
tasklist
inflate
certificate-revocation
erlide
datasheet
datejs
pex-and-moles
execjs
object-tag
xhtmlrenderer
llblgen
chromebug
versions

Resources

Encrypt Message



code
soft
python
ios
c
html
jquery
cloud
mobile