Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

superagent recommendation does not actually work #370

Closed
vishnevskiy opened this issue Mar 27, 2015 · 4 comments
Closed

superagent recommendation does not actually work #370

vishnevskiy opened this issue Mar 27, 2015 · 4 comments
Labels
Resolution: Locked This issue was locked by the bot.

Comments

@vishnevskiy
Copy link
Contributor

In the network section of the docs it recommends using superagent but when you npm install and require it you end up seeing something like this.

"Unexpected end of script"

https://www.dropbox.com/s/xcixxwmwrkhn2ly/Screenshot%202015-03-27%2015.18.40.png?dl=0

Removing the require resolves it.

@aackerman
Copy link

It appears to be an issue with the debug module dependency of superagent. The module has incorrectly determined that it is running in a node environment and is throwing an error.

But you're right, I'm seeing the same error.

@vishnevskiy
Copy link
Contributor Author

I actually tried importing superagent/lib/client directly and it resulted in the same problem.

@philipshurpik
Copy link

Hi!
You can try 'superagent/lib/client' but you need to modify require statements at the top of file:
var Emitter = require('component-emitter');
var reduce = require('reduce-component');
Because React Native doesn't correctly handle 'browser' section in package.json.

Also you can try my fork that is work with React Native:
https://github.com/philipshurpik/superagent
It has some other little fixes...

@amasad
Copy link
Contributor

amasad commented Apr 10, 2015

The packager now looks at the browser field. superagent should be usable once they publish a new version following this PR ladjs/superagent#621 which just makes it not depend on a location object on the global object.

@amasad amasad closed this as completed Apr 10, 2015
vjeux pushed a commit to vjeux/react-native that referenced this issue Apr 13, 2015
Summary:
Apparently we promote using superagent but it doesn't actually work. See issues facebook#370 facebook#10 facebook#375
The main issue stopping it from working is the `browser` field in package.json which both browserify and webpack implments.
This implements most of the spec found here https://gist.github.com/defunctzombie/4339901
The only thing we're not implementing is the `module-name: false` part to ignore a module because it doesn't seem to be as used. If someone complains about it we'll implement it then.

Test Plan:
./runJestTests.sh
* npm install superagent in JS
* test using superagent
jasongrishkoff referenced this issue Feb 24, 2017
Summary:
We really need a better list view - so here it is!

Main changes from existing `ListView`:

* Items are "virtualized" to limit memory - that is, items outside of the render window are unmounted and their memory is reclaimed. This means that instance state is not preserved when items scroll out of the render window.
* No `DataSource` - just a simple `data` prop of shape `Array<any>`. By default, they are expected to be of the shape `{key: string}` but a custom `rowExtractor` function can be provided for different shapes, e.g. graphql data where you want to map `id` to `key`. Note the underlying `VirtualizedList` is much more flexible.
* Fancy `scrollTo` functionality: `scrollToEnd`, `scrollToIndex`, and `scrollToItem` in addition to the normal `scrollToOffset`.
* Built-in pull to refresh support - set set the `onRefresh` and `refreshing` props.
* Rendering additional rows is usually done with low priority, after any interactions/animations complete, unless we're about to run out of rendered content. This should help apps feel more responsive.
* Component props replace render functions, e.g. `ItemComponent: ReactClass<{item: Item, index: number}>` replaces `renderRow: (...) => React.Element<*>`
* Supports dynamic items automatically by using `onLayout`, or `getItemLayout` can be provided for a perf boost and smoother `scrollToIndex` and scroll bar behavior.
* Visibility callback replaced with more powerful viewability callback and works in vertical and horizontal mode on at least Android and iOS, but probably other platforms as well. Extra power comes from the `viewablePercentThreshold` that lets the client decide when an item should be considered viewable.

Demo:

https://www.facebook.com/groups/576288835853049/permalink/753923058089625/

Reviewed By: yungsters

Differential Revision: D4412469

fbshipit-source-id: e2d891490bf76fe14df49294ecddf78a58adcf23
@facebook facebook locked as resolved and limited conversation to collaborators May 29, 2018
@react-native-bot react-native-bot added the Resolution: Locked This issue was locked by the bot. label Jul 23, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Resolution: Locked This issue was locked by the bot.
Projects
None yet
Development

No branches or pull requests

5 participants