Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
This repository was archived by the owner on Oct 23, 2018. It is now read-only.
This repository was archived by the owner on Oct 23, 2018. It is now read-only.

Conditionally set HttpLink URI #98

Open
@DevanB

Description

There is an issue with fetch in React Native that prevents the usage of localhost.

A proposed solution is to use Platform.select to set the ApolloClient's HttpLink uri to one of several options:

const SERVER_URL = __DEV__
 ? Platform.select({
 ios: 'GET_USERS_IP_ADDRESS_AND_APPEND_PORT_4000',
 android: 'http://10.0.2.2:4000'
 })
 : 'USE_PRODUCTION_GRAPHQL_SERVER_ENV_VAR';

Android apparently allows 10.0.2.2 to equal localhost, but I haven't confirmed this myself.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

        AltStyle によって変換されたページ (->オリジナル) /