chore: Migrate List room to ts
This commit is contained in:
parent
6e5df501cb
commit
dc3e21056e
|
@ -1,7 +1,6 @@
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { FlatList, StyleSheet } from 'react-native';
|
import { FlatList, StyleSheet } from 'react-native';
|
||||||
import Animated from 'react-native-reanimated';
|
import Animated from 'react-native-reanimated';
|
||||||
import PropTypes from 'prop-types';
|
|
||||||
|
|
||||||
import { isIOS } from '../../../utils/deviceInfo';
|
import { isIOS } from '../../../utils/deviceInfo';
|
||||||
import scrollPersistTaps from '../../../utils/scrollPersistTaps';
|
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
|
<AnimatedFlatList
|
||||||
testID='room-view-messages'
|
testID='room-view-messages'
|
||||||
ref={listRef}
|
ref={listRef}
|
||||||
keyExtractor={item => item.id}
|
keyExtractor={(item: any) => item.id}
|
||||||
contentContainerStyle={styles.contentContainer}
|
contentContainerStyle={styles.contentContainer}
|
||||||
style={styles.list}
|
style={styles.list}
|
||||||
inverted
|
inverted
|
||||||
|
@ -35,8 +39,4 @@ const List = ({ listRef, ...props }) => (
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
|
|
||||||
List.propTypes = {
|
|
||||||
listRef: PropTypes.object
|
|
||||||
};
|
|
||||||
|
|
||||||
export default List;
|
export default List;
|
|
@ -1,6 +1,5 @@
|
||||||
import React, { useCallback, useState } from 'react';
|
import React, { useCallback, useState } from 'react';
|
||||||
import { StyleSheet, View } from 'react-native';
|
import { StyleSheet, View } from 'react-native';
|
||||||
import PropTypes from 'prop-types';
|
|
||||||
import Animated, { call, cond, greaterOrEq, useCode } from 'react-native-reanimated';
|
import Animated, { call, cond, greaterOrEq, useCode } from 'react-native-reanimated';
|
||||||
|
|
||||||
import { themes } from '../../../constants/colors';
|
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 { theme } = useTheme();
|
||||||
const [show, setShow] = useState(false);
|
const [show, setShow] = useState(false);
|
||||||
const handleOnPress = useCallback(() => onPress());
|
const handleOnPress = useCallback(() => onPress(), []); // TODO - check this
|
||||||
const toggle = v => setShow(v);
|
const toggle = (v: boolean) => setShow(v);
|
||||||
|
|
||||||
useCode(
|
useCode(
|
||||||
() =>
|
() =>
|
||||||
|
@ -65,10 +70,4 @@ const NavBottomFAB = ({ y, onPress, isThread }) => {
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
NavBottomFAB.propTypes = {
|
|
||||||
y: Animated.Value,
|
|
||||||
onPress: PropTypes.func,
|
|
||||||
isThread: PropTypes.bool
|
|
||||||
};
|
|
||||||
|
|
||||||
export default NavBottomFAB;
|
export default NavBottomFAB;
|
Loading…
Reference in New Issue