chore: Migrate List room to ts

This commit is contained in:
AlexAlexandre 2021-12-02 19:11:16 -03:00
parent 6e5df501cb
commit dc3e21056e
2 changed files with 16 additions and 17 deletions

View File

@ -1,7 +1,6 @@
import React from 'react';
import { FlatList, StyleSheet } from 'react-native';
import Animated from 'react-native-reanimated';
import PropTypes from 'prop-types';
import { isIOS } from '../../../utils/deviceInfo';
import scrollPersistTaps from '../../../utils/scrollPersistTaps';
@ -17,11 +16,16 @@ const styles = StyleSheet.create({
}
});
const List = ({ listRef, ...props }) => (
interface IRoomListProps {
listRef: any;
}
const List = ({ listRef, ...props }: IRoomListProps) => (
// @ts-ignore
<AnimatedFlatList
testID='room-view-messages'
ref={listRef}
keyExtractor={item => item.id}
keyExtractor={(item: any) => item.id}
contentContainerStyle={styles.contentContainer}
style={styles.list}
inverted
@ -35,8 +39,4 @@ const List = ({ listRef, ...props }) => (
/>
);
List.propTypes = {
listRef: PropTypes.object
};
export default List;

View File

@ -1,6 +1,5 @@
import React, { useCallback, useState } from 'react';
import { StyleSheet, View } from 'react-native';
import PropTypes from 'prop-types';
import Animated, { call, cond, greaterOrEq, useCode } from 'react-native-reanimated';
import { themes } from '../../../constants/colors';
@ -30,11 +29,17 @@ const styles = StyleSheet.create({
}
});
const NavBottomFAB = ({ y, onPress, isThread }) => {
interface IRoomNavBottomFAB {
y: number;
onPress: Function;
isThread: boolean;
}
const NavBottomFAB = ({ y, onPress, isThread }: IRoomNavBottomFAB) => {
const { theme } = useTheme();
const [show, setShow] = useState(false);
const handleOnPress = useCallback(() => onPress());
const toggle = v => setShow(v);
const handleOnPress = useCallback(() => onPress(), []); // TODO - check this
const toggle = (v: boolean) => setShow(v);
useCode(
() =>
@ -65,10 +70,4 @@ const NavBottomFAB = ({ y, onPress, isThread }) => {
);
};
NavBottomFAB.propTypes = {
y: Animated.Value,
onPress: PropTypes.func,
isThread: PropTypes.bool
};
export default NavBottomFAB;