diff --git a/src/components/Media/ImageGalleryButton.js b/src/components/Media/ImageGalleryButton.tsx similarity index 54% rename from src/components/Media/ImageGalleryButton.js rename to src/components/Media/ImageGalleryButton.tsx index 236df8b..7075bfa 100644 --- a/src/components/Media/ImageGalleryButton.js +++ b/src/components/Media/ImageGalleryButton.tsx @@ -17,41 +17,36 @@ * along with Campus INSAT. If not, see . */ -// @flow - import * as React from 'react'; import {TouchableRipple} from 'react-native-paper'; -import {StackNavigationProp} from '@react-navigation/stack'; import {Image} from 'react-native-animatable'; -import type {ViewStyleProp} from 'react-native/Libraries/StyleSheet/StyleSheet'; +import {useNavigation} from '@react-navigation/native'; +import {ViewStyle} from 'react-native'; type PropsType = { - navigation: StackNavigationProp, - images: Array<{url: string}>, - style: ViewStyleProp, + images: Array<{url: string}>; + style: ViewStyle; }; -class ImageGalleryButton extends React.Component { - onPress = () => { - const {navigation, images} = this.props; - navigation.navigate('gallery', {images}); +function ImageGalleryButton(props: PropsType) { + const navigation = useNavigation(); + + const onPress = () => { + navigation.navigate('gallery', {images: props.images}); }; - render(): React.Node { - const {style, images} = this.props; - return ( - - - - ); - } + return ( + + + + ); } export default ImageGalleryButton;