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

issue hosting on firebase with React-Redux app?
How to convey error information through Relay render when the response includes errors and data?
Unable to trigger Redux action after ajax
React native iOS open message app with default text
How to make synchronous API call request in react js
ReactJS: Turn object into array and render
redux-form - Register all fields from state
how to map values in material ui auto-complete
handle change event not working for input types?
Redux passing down actions
Pass data to child React component?
Dynamically change input's name in .map inside React JSX
When initialize action trigger?
How to render nested array elements in React?
creating a bar chart using Highcharts with React - getting an error that rendering div isn't found
Election: Passing Session Cookie to Front end (Backend Functional)

Categories

HOME
oop
algolia
qemu
weblogic
casting
android-ndk
where
crash
grid
kendo-asp.net-mvc
clip-path
pip
ndepend
tracking
appsettings
css-float
orange
dev-c++
beaker-notebook
gsuite
windowserror
workflow-foundation
javapns
textview
mplab
keil
ports
pymunk
anypoint-studio
susy
vertical-alignment
colorbox
firefox-developer-edition
grails-2.0
jscoverage
business-catalyst
pyautogui
easy68k
mavlink
python-rq
factorization
trendline
alchemy
encode
ruby-1.8.7
maven-antrun-plugin
recode
libgcrypt
self-join
xml-simple
targetprocess
ultraedit
google-experiments
fiware-health
quickfixn
aiff
switchpreference
mvcgrid
rails-migrations
power-management
html5-filesystem
mysql-error-1146
ardor3d
codeigniter-form-helper
screensharing
m3u
flatten
unordered-set
capitalization
parallel-python
object-tag
quazip
excellibrary
s60
iphone-maps
large-data-volumes
time-management
projectgen

Resources

Encrypt Message