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

React app only at production. Error: Unexpected token < in JSON at position 0
ERROR in ./~/react-tap-event-plugin/src/injectTapEventPlugin.js
react-route display blank page
react native router flux: override android hardware back key
can't type in input fields when using material-ui-redux-form due to re rendering
undefined within the react component - but not in action
Updating a nested state in redux using Object.assign
Typescript input onchange event.target.value
ReactComponentTreeHook unexpected : Webpack 2
ReactJS: Uncaught TypeError: Cannot read property 'subscribe' of undefined(…)
Draft-js apply inline-styles to readonly editor
About injectScript in WebView for React-Native
My flux store gets re-instantiated on reload
React Mobx - component not updating after store change
Property not found - flowtype / react, using this
Render React nested components

Categories

HOME
youtube-api
virtual-machine
oracle-sqldeveloper
compression
qemu
customization
casting
webvr
stdout
singleton
bitbucket
pip
obd-ii
segmentation-fault
select2
drush
eclipse-orion
loss
taxonomy
filehelpers
google-street-view
aiml
django-rest-auth
scotty
inline-assembly
quality-center
suitescript
inspec
typeclass
r-factor
paper-trail-gem
directions
javax
asp.net-webhooks
maven-2
matrix-multiplication
google-chrome-console
autodesk-data-management
flume-ng
text-extraction
f#-fake
html-entities
history
beanshell
enet
dynamic-linking
cc
bipartite
group
breadcrumbs
cedar-bdd
symantec
boost-range
foreground
airwatch
bytearray
php-java-bridge
oryx
android-facebook
sdkman
quickfixn
report-builder2.0
lwuit
formbuilder
pnunit
javacompiler
android-relativelayout
code-smell
internet-radio
kohana-orm
violation
cocotron
architectural-patterns
metapost
jquery-ui-map
project-files
fileoutputstream
scsf
umfpack
mscorlib
opendir
file-processing
jqtransform
lwp
chromebug
focus-stealing

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App