From f42d289df93fd853c2be85930c2be2eaa98f010b Mon Sep 17 00:00:00 2001 From: Godefroy Ponsinet Date: Tue, 21 Aug 2018 14:55:04 +0200 Subject: [PATCH 1/2] feat(rn): setup relay Signed-off-by: Godefroy Ponsinet --- client/react-native/.babelrc | 2 + client/react-native/common/components/App.js | 4 +- .../common/components/Forms/ContactRequest.js | 72 ++- .../ContactRequestMutation.graphql.js | 98 +++ client/react-native/common/index.js | 2 +- client/react-native/common/relay.js | 35 ++ client/react-native/common/schema.graphql | 454 ++++++++++++++ client/react-native/mobile/package.json | 6 +- client/react-native/package.json | 5 +- client/react-native/web/config/paths.js | 1 - .../web/config/webpack.config.dev.js | 6 + .../web/config/webpack.config.prod.js | 1 - client/react-native/web/package.json | 9 +- .../web/{src => }/registerServiceWorker.js | 0 client/react-native/web/scripts/start.js | 101 ++-- client/react-native/web/yarn.lock | 557 +++++++++++++++++- client/react-native/yarn.lock | 238 +++++++- 17 files changed, 1482 insertions(+), 109 deletions(-) create mode 100644 client/react-native/common/components/Forms/__generated__/ContactRequestMutation.graphql.js create mode 100644 client/react-native/common/relay.js create mode 100644 client/react-native/common/schema.graphql rename client/react-native/web/{src => }/registerServiceWorker.js (100%) diff --git a/client/react-native/.babelrc b/client/react-native/.babelrc index 38a6582715..658b0c2d94 100644 --- a/client/react-native/.babelrc +++ b/client/react-native/.babelrc @@ -1,6 +1,8 @@ { "presets": ["react-native", "react-app"], "plugins": [ + "relay", + "@babel/plugin-proposal-function-bind", "@babel/plugin-proposal-export-default-from", diff --git a/client/react-native/common/components/App.js b/client/react-native/common/components/App.js index dcecf8e499..f8ec81b702 100644 --- a/client/react-native/common/components/App.js +++ b/client/react-native/common/components/App.js @@ -3,8 +3,6 @@ import { ContactRequest } from './Forms' export default class App extends Component { render = () => { - return ( - - ) + return } } diff --git a/client/react-native/common/components/Forms/ContactRequest.js b/client/react-native/common/components/Forms/ContactRequest.js index 6feeb2467d..354938b69e 100644 --- a/client/react-native/common/components/Forms/ContactRequest.js +++ b/client/react-native/common/components/Forms/ContactRequest.js @@ -1,12 +1,7 @@ import React, { Component } from 'react' -import { - TextInput, - Text, - View, - Button, - Alert, - StyleSheet -} from 'react-native' +import { TextInput, Text, View, Button, Alert, StyleSheet } from 'react-native' +import { graphql, commitMutation } from 'react-relay' +import environment from '../../relay.js' var fields = { id: '', @@ -18,13 +13,25 @@ export default class ContactRequest extends Component { render = () => { return ( - - - -