I am trying to get the title on the header on my react native application. i have been following a video lecture, but I till can't seem to get it right
import { StyleSheet, Text, View } from 'react-native'
import React from 'react'
import { DOC } from '../Data/dummy-data'
const Doctors = props => {
// destructure
const { docId } = props.route.params
const selectedCategory = DOC.find(doc => doc.id === docId)
return (
<View style={styles.screen}>
<Text>{selectedCategory.title}</Text>
</View>
)
}
Doctors.navigationOptions = (navigationData) => {
const docId = navigationData.navigation.getParam('docId')
const selectedCategory = DOC.find(doc => doc.id === docId)
return {
headerTitle:selectedCategory.title
}
}
export default Doctors
const styles = StyleSheet.create({
screen:{
flex:1,
justifyContent:'center',
alignItems:'center'
}
})