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.
* sk-schema-api:
Improve clarity of schema parsing and serialization
Add test that checks schema validation
Update README with new Schema API
Cleanup some code and comments to make it consistent
Convert tests to create objects with property objects
Update example apps with new schema API
Remove confusion between propTypes and objectTypes
Simplify object schema info returned from RPC
RPC now keeps object keys in the same order
Change schema API to take properties as an object
Add method to clear mutation listeners in RPC client
Plug small leak from not releasing a JSStringRef
Make RJSStringForValue use consistent exception style
Improve error messages inside RJSUtil
The RPC layer now only speaks in objectTypes, since they don't always equate to propTypes. We were overloading the use of propTypes for no good purpose.
The Results class was updated to match the style of List and include a flag (m_live) that determines if it should sync updates. If an object in the static Results is deleted, then it will return null.
The top-level package.json explicitly includes the directories it needs (vendor/.npmignore cuts down the cruft). The publish-beta.sh script essentially uses `npm pack` to package up the NPM module and then push it into an orphaned `beta` branch.
Specifically for objects with lists, since the mutation listener would fire on a list that no longer is attached. If during the mutation listener that error is thrown, then the listener will be removed and the error will not be propagated.
Previously we were not accounting for the byte offsets and misunderstood how the Uint8Array constructor worked. The tests now confirm everything works as expected with multiple different typed arrays and slices of the data.
React Native now leaves the original object accessible when it "polyfills" objects. So we check for that, but still have the previous logic in place in case they change their minds.
Rather than using Object.preventExtensions to throw exceptions when setting any out-of-bounds index, we must instead compromise by only throwing for the common cases, which are -1 and list.length. Having Object.keys() support is essential for List to work with React Native ListViewDataSource.
Resolves#80
Added a session ID, that actually tracks the Realm constructor in our RPC server's JS context. This conveniently let us remove the special casing for defaultPath as well as letting us call the Realm constructor with JSObjectCallAsConstructor.
Fixes#68
Since notifications are called synchronously after a write, we fake it by calling them manually for now. The future plan will be more involved, so some of that is stubbed out.
The deleteTestFiles() function is now added to the Realm object, so that it's easy for the RPC module to handle this as well. We can only do this in testing environments in the future.
An exception was thrown when parsing the JSON when only a string was passed. This is better and no longer uses the Objective-C API for converting the dictionary to a JSValue.