This file contains 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
class ProfileName extends React.Component { | |
componentDidMount() { | |
profileInfoViewed('ProfileName', this.props.profile); | |
} | |
render() { | |
return ( | |
<View> | |
<Text>{this.profile.name}</Text> | |
</View> |
This file contains 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
#!/bin/bash | |
set -e | |
echo "Rename files" | |
for file in $(find src/ -name "*.js" | grep -v __generated__ | grep -v __tests__); do | |
mv "$file" "${file%.js}.ts" | |
done | |
echo "Removing type import keyword..." |
This file contains 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
// ScreenA | |
const ScreenAQuery = graphql` | |
query ScreenAQuery { | |
root { | |
me { | |
name | |
} | |
} | |
} | |
`; |
This file contains 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
import useLazyLoadQuery from 'react-relay/lib/relay-experimental/useLazyLoadQuery'; | |
function Component () { | |
const { root } = useLazyLoadQuery(ScreenAQuery, null, { | |
fetchPolicy: 'store-or-network', | |
}); | |
... | |
} |
This file contains 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
import RelayEnvironmentProvider from 'react-relay/lib/relay-experimental/RelayEnvironmentProvider'; | |
import useLazyLoadQuery from 'react-relay/lib/relay-experimental/useLazyLoadQuery'; | |
// ScreenA | |
function ScreenA() { | |
const { root } = useLazyLoadQuery(ScreenAQuery, null, { | |
fetchPolicy: 'store-or-network', | |
}); | |
return ( | |
<RelayEnvironmentProvider environment={environment}> |
This file contains 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
_traverse(node: NormalizationNode, dataID: DataID): void { | |
const status = this._mutator.getStatus(dataID); | |
if (status === UNKNOWN) { | |
this._handleMissing(); | |
} | |
if (status === EXISTENT) { | |
this._traverseSelections(node.selections, dataID); | |
} | |
} | |
This file contains 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
case 'store-or-network': { | |
shouldFetch = !hasFullQuery; | |
shouldAllowRender = canPartialRender; | |
break; | |
} | |
// https://github.com/facebook/relay/blob/66e747a68b8fac474fa44b4eb441c72c72daf89e/packages/relay-experimental/QueryResource.js#L392-L395 |
This file contains 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
// ScreenB | |
const ScreenBQuery = graphql` | |
query ScreenBQuery { | |
root { | |
events(first: $first) { | |
edges { | |
node { | |
title | |
} | |
} |
This file contains 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
// ScreenBDetail | |
const ScreenBDetailQuery = graphql` | |
query ScreenBDetailQuery { | |
root { | |
event(id: $someId) { | |
title | |
} | |
} | |
} | |
`; |
This file contains 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
{ | |
"events": { | |
"edges": [{ | |
"node": { | |
"eventId": 1, | |
"title": "My event" | |
} | |
}] | |
} | |
} |