The callbacks are stored by their id in the RPCServer so they are properly uniqued. This prevents the same callback from being added multiple times as a change listener.
All realm operations for the RPC are now done in their own thread so it can be allowed to block on waiting for callback results. The recursive and multi-threaded nature of this makes it pretty tricky, but it works!
Turns out the JSC included with React Native on Android includes a buggy implementation of ArrayIterator that is missing an exposed next() method, so we implement it ourselves instead.
It still only tries localhost for the simulator, but for devices, we now get a list of possible IP addresses to attempt to connect to before throw a more helpful exception.
Resolves#284 and fixes#276
The method name changed to sortedBy to reflect that it returns a new Results object and to be more succinct. Also, the second optional argument instead reflects descending (or rather, reverse) since it's an anti-pattern to have an optional argument default to true in JS, and this also follows precedences set by other JS libraries and by Python's sorted function.
* master: (207 commits)
Convert to using new React Native MainActivity template
Create RealmReactPackage for our Android plugin
Fix doc for Android
NPM ignore react-native/android folder
Skip building Android module under Xcode
Skip building Android module for iOS tests
gitignore Android downloads folder
Update README with instructions to run on Android
Use un-patched RN for Android by installing hook into JSC
cleanup build system
Use Realm in node_modules for ReactTests on Android
Change Demo => ReactTests
adding a 'publishAndroid' task to generate the AAR with prebuilt .so files
Adjust POM_NAME
Use consistent package naming
Remove old Demo files
Add copyright to JNI file
Cleanup platform.hpp
Make our Android module buildable as a dependency
Add `npm test` command
...
This component is fully backwards compatible with the original React ListView, but is compatible with Realm Results and List objects to use their snapshot functionality along with more efficiently checking if each row should update.