Created
February 17, 2019 17:29
-
-
Save JakeCoxon/9fccdac4af49fd28ffc246487e714f5d to your computer and use it in GitHub Desktop.
React navigation header hooks example
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
function MyScreen({}) { | |
const [numSelected setNumSelected] = useState(false); | |
useHeaderTitle(numSelected > 0 ? `${numSelected} tasks selected` : 'Task selection'); | |
return ... | |
} |
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
function MyScreen({}) { | |
const [doApiRequest, isLoading] = useMyApi(); | |
useHeaderRight( | |
isLoading ? <ActivityIndicator /> : | |
<Button onPress={doApiRequest}>Done</Button> | |
) | |
return ... | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment