diff --git a/client/react-native/common/components/App.js b/client/react-native/common/components/App.js
index bd7e8c381f..f1b4ce039e 100644
--- a/client/react-native/common/components/App.js
+++ b/client/react-native/common/components/App.js
@@ -1,6 +1,6 @@
import { I18nextProvider } from 'react-i18next'
-import { Linking, Platform, View } from 'react-native'
-import { SafeAreaView, createAppContainer } from 'react-navigation'
+import { Linking, Platform, View, NativeModules } from 'react-native'
+import { SafeAreaView, createAppContainer, NavigationActions } from 'react-navigation'
import FlashMessage from 'react-native-flash-message'
import KeyboardSpacer from 'react-native-keyboard-spacer'
import ReactNativeLanguages from 'react-native-languages'
diff --git a/client/react-native/common/components/Screens/Chats/Detail.js b/client/react-native/common/components/Screens/Chats/Detail.js
index 3371315b91..b9e7ef1278 100644
--- a/client/react-native/common/components/Screens/Chats/Detail.js
+++ b/client/react-native/common/components/Screens/Chats/Detail.js
@@ -309,7 +309,7 @@ class Detail extends PureComponent {
}
onConversationRead = async () => {
- const res = await this.props.screenProps.context.mutations.conversationRead(
+ const res = await this.props.context.mutations.conversationRead(
{
id: this.props.navigation.getParam('id'),
}
diff --git a/client/react-native/common/components/Screens/Chats/Settings/List.js b/client/react-native/common/components/Screens/Chats/Settings/List.js
index 727df73767..a70e91227c 100644
--- a/client/react-native/common/components/Screens/Chats/Settings/List.js
+++ b/client/react-native/common/components/Screens/Chats/Settings/List.js
@@ -7,6 +7,7 @@ import { Screen, Menu, Header, Badge, Avatar } from '../../../Library'
import { choosePicture } from '../../../../helpers/react-native-image-picker'
import { colors } from '../../../../constants'
import { conversation as utils } from '../../../../utils'
+import withRelayContext from '../../../../helpers/withRelayContext'
class List extends PureComponent {
static contextType = RelayContext
@@ -63,7 +64,7 @@ class List extends PureComponent {
addMembers = async ({ contactsID }) => {
try {
const { id } = this.props.navigation.getParam('conversation')
- await this.props.screenProps.context.mutations.conversationInvite({
+ await this.props.context.mutations.conversationInvite({
conversationID: id,
contactsID,
})
@@ -85,115 +86,110 @@ class List extends PureComponent {
}
render () {
- const { navigation, t } = this.props
+ const { navigation, t, context } = this.props
const { edit } = this.state
const conversation = this.props.navigation.getParam('conversation')
const title = utils.getTitle(conversation)
+ this.context = context
return (
-
- {context =>
- (this.context = context) && (
-
-
+ )
+ })}
+
+ )}
+
+
+
+
+
)
}
}
-export default withNamespaces()(List)
+export default withRelayContext(withNamespaces()(List))
diff --git a/client/react-native/common/components/Screens/Contacts/ContactCardModal.js b/client/react-native/common/components/Screens/Contacts/ContactCardModal.js
index c66669c4c5..fd0d63cc83 100644
--- a/client/react-native/common/components/Screens/Contacts/ContactCardModal.js
+++ b/client/react-native/common/components/Screens/Contacts/ContactCardModal.js
@@ -7,8 +7,9 @@ import {
ContactIdentityActions,
ModalScreen,
} from '../../Library'
-import { QueryReducer, RelayContext } from '../../../relay'
+import { QueryReducer } from '../../../relay'
import { merge } from '../../../helpers'
+import withRelayContext from '../../../helpers/withRelayContext'
const modalWidth = 320
@@ -16,54 +17,50 @@ class ContactCardModal extends React.Component {
static router = ContactIdentity.router
render () {
- const { navigation } = this.props
+ const { navigation, context } = this.props
const data = {
id: navigation.getParam('id'),
displayName: navigation.getParam('displayName'),
}
return (
-
- {context => (
-
- {state =>
- console.log(state) || (
-
-
- }
- >
-
-
-
- )
- }
-
- )}
-
+
+ {state =>
+ console.log(state) || (
+
+
+ }
+ >
+
+
+
+ )
+ }
+
)
}
}
-export default withNavigation(ContactCardModal)
+export default withRelayContext(withNavigation(ContactCardModal))
diff --git a/client/react-native/common/components/Screens/Landing/index.js b/client/react-native/common/components/Screens/Landing/index.js
deleted file mode 100644
index 8f06f36b15..0000000000
--- a/client/react-native/common/components/Screens/Landing/index.js
+++ /dev/null
@@ -1,18 +0,0 @@
-import { PureComponent } from 'react'
-import { createStackNavigator } from 'react-navigation'
-
-class Landing extends PureComponent {
- render (props = this.props) {
- return null
- }
-}
-
-export default createStackNavigator(
- {
- 1: Landing,
- 2: Landing,
- 3: Landing,
- 4: Landing,
- },
- { initialRouteName: '1' }
-)
diff --git a/client/react-native/common/components/Screens/Settings/Devtools/Database.js b/client/react-native/common/components/Screens/Settings/Devtools/Database.js
index e96a1735f4..6038e001ef 100644
--- a/client/react-native/common/components/Screens/Settings/Devtools/Database.js
+++ b/client/react-native/common/components/Screens/Settings/Devtools/Database.js
@@ -3,11 +3,12 @@ import React, { PureComponent } from 'react'
import { Flex, Header, Menu, Screen, Text } from '../../../Library'
import { colors } from '../../../../constants'
+import withRelayContext from '../../../../helpers/withRelayContext'
import { RelayContext } from '../../../../relay'
const { CoreModule } = NativeModules
-export default class Database extends PureComponent {
+class Database extends PureComponent {
static contextType = RelayContext
static navigationOptions = ({ navigation }) => ({
header: () =>
@@ -23,7 +24,7 @@ export default class Database extends PureComponent {
generateFakeData = async () => {
try {
- await this.props.screenProps.context.mutations.generateFakeData({
+ await this.props.context.mutations.generateFakeData({
t: true,
})
} catch (err) {
@@ -79,3 +80,5 @@ export default class Database extends PureComponent {
)
}
}
+
+export default withRelayContext(Database)
diff --git a/client/react-native/common/components/Screens/Settings/Devtools/DeviceInfos.js b/client/react-native/common/components/Screens/Settings/Devtools/DeviceInfos.js
index 5c799d09dd..47037ed8d4 100644
--- a/client/react-native/common/components/Screens/Settings/Devtools/DeviceInfos.js
+++ b/client/react-native/common/components/Screens/Settings/Devtools/DeviceInfos.js
@@ -10,8 +10,9 @@ import React, { PureComponent } from 'react'
import { Header } from '../../../Library'
import { colors } from '../../../../constants'
import { padding } from '../../../../styles'
+import withRelayContext from '../../../../helpers/withRelayContext'
-export default class DeviceInfos extends PureComponent {
+class DeviceInfos extends PureComponent {
static navigationOptions = ({ navigation }) => ({
header: (
{
const {
- screenProps: {
- context: { queries },
- },
+ context: { queries },
} = this.props
this.setState({ refreshing: true }, async () => {
const data = await queries.DeviceInfos.fetch()
@@ -91,3 +90,5 @@ export default class DeviceInfos extends PureComponent {
)
}
}
+
+export default withRelayContext(DeviceInfos)
diff --git a/client/react-native/common/components/Screens/Settings/Devtools/EventDetails.js b/client/react-native/common/components/Screens/Settings/Devtools/EventDetails.js
index 61960ceea1..f5ac6592bb 100644
--- a/client/react-native/common/components/Screens/Settings/Devtools/EventDetails.js
+++ b/client/react-native/common/components/Screens/Settings/Devtools/EventDetails.js
@@ -4,8 +4,9 @@ import { RelayContext } from '../../../../relay'
import { Header } from '../../../Library'
import { colors } from '../../../../constants'
import { padding } from '../../../../styles'
+import withRelayContext from '../../../../helpers/withRelayContext'
-export default class EventDetails extends PureComponent {
+class EventDetails extends PureComponent {
static contextType = RelayContext
static navigationOptions = ({ navigation }) => ({
@@ -35,7 +36,7 @@ export default class EventDetails extends PureComponent {
]}
onPress={async () => {
try {
- await this.props.screenProps.context.mutations.debugRequeueEvent({ eventId: data.id })
+ await this.props.context.mutations.debugRequeueEvent({ eventId: data.id })
} catch (err) {
this.setState({ err })
console.error(err)
@@ -90,3 +91,5 @@ export default class EventDetails extends PureComponent {
)
}
}
+
+export default withRelayContext(EventDetails)
diff --git a/client/react-native/common/components/Screens/Settings/Devtools/EventList.js b/client/react-native/common/components/Screens/Settings/Devtools/EventList.js
index 3f50f20d90..4a0240595d 100644
--- a/client/react-native/common/components/Screens/Settings/Devtools/EventList.js
+++ b/client/react-native/common/components/Screens/Settings/Devtools/EventList.js
@@ -16,6 +16,7 @@ import { borderBottom, marginLeft, padding } from '../../../../styles'
import { colors } from '../../../../constants'
import { fragments, enums } from '../../../../graphql'
import Button from '../../../Library/Button'
+import withRelayContext from '../../../../helpers/withRelayContext'
const Item = fragments.Event(({ data, navigation }) => (