Created
April 21, 2020 03:23
-
-
Save codyromano/e87f3d1b300c4837a3f91f04811667fb to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const GET_CONVERSATION = gql` | |
query GetConversation($request: GetConversationInput!) { | |
getConversation(request: $request) { | |
conversation { | |
id | |
} | |
} | |
} | |
`; | |
type ExampleComponentProps = { | |
userName: string; | |
route: { | |
params: { | |
conversationId: string; | |
} | |
} | |
}; | |
type QueryResponse = { | |
getConversation: { | |
conversation: { | |
status: string; | |
} | |
} | |
}; | |
type QueryVars = { | |
variables: { | |
request: { | |
id: string; | |
} | |
} | |
}; | |
const ExampleComponent = ({ | |
data, | |
userName, | |
}: ExampleComponentProps & WithFocusQueryProps<QueryResponse, QueryVars>) => ( | |
<SafeAreaView> | |
<Text>Hello, {userName}! {data.getConversation.conversation.status}</Text> | |
</SafeAreaView> | |
); | |
export default withFocusQuery({ | |
query: GET_CONVERSATION, | |
getQueryVars: (props: ExampleComponentProps) => ({ | |
variables: { | |
request: { | |
id: props.route.params.conversationId, | |
}, | |
} | |
}), | |
})(ExampleComponent); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment