react-navigation#NavigationContext JavaScript Examples

The following examples show how to use react-navigation#NavigationContext. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ArrowBack.js    From Alfredo-Mobile with MIT License 6 votes vote down vote up
ArrowBack = (props) => {
  const {...restProps} = props
  const navigation = useContext(NavigationContext)

  return (
    <TouchableOpacity activeOpacity={0.9} style={styles.container} onPress={() => navigation.goBack()}>
      <Icon name="chevron-left" size={35} color={apply('gray-900')} />
    </TouchableOpacity>
  )
}
Example #2
Source File: CardProduct.js    From Alfredo-Mobile with MIT License 6 votes vote down vote up
CardProduct = (props) => {
  const [width, setWidth] = useState(0)
  const [height, setHeight] = useState(0)
  const {item, ...restProps} = props
  const navigation = useContext(NavigationContext)

  return (
    <TouchableOpacity activeOpacity={0.9} style={styles.card} {...restProps}>
      <Image source={{ uri: item?.thumbnail }} style={styles.thumb} resizeMode="cover" />
      <View style={styles.content}>
        <Text style={styles.price}>{'Rp' + new Format().formatMoney(item?.price ?? 0)}</Text>
        <Text style={styles.title}>{item?.title}</Text>
      </View>
    </TouchableOpacity>
  )
}