fix: android active indicator

This commit is contained in:
Jakub Grzywacz 2021-07-08 23:43:04 +02:00
parent 935fe7009f
commit f6f9d40647
No known key found for this signature in database
GPG Key ID: 5BBB685871FF63C4
2 changed files with 6 additions and 5 deletions

View File

@ -33,7 +33,6 @@ export const Categories = ({ flatListRef, scrollNav }: CategoriesProps) => {
const activeIndicator = React.useCallback( const activeIndicator = React.useCallback(
() => ( () => (
// <Animated.View style={[styles.activeIndicator, { left: scrollNav }]} />
<Animated.View <Animated.View
style={[ style={[
styles.activeIndicator, styles.activeIndicator,
@ -58,6 +57,7 @@ export const Categories = ({ flatListRef, scrollNav }: CategoriesProps) => {
horizontal={true} horizontal={true}
onScrollToIndexFailed={(e) => console.log(e)} onScrollToIndexFailed={(e) => console.log(e)}
ListHeaderComponent={activeIndicator} ListHeaderComponent={activeIndicator}
ListHeaderComponentStyle={styles.activeIndicatorContainer}
extraData={ctx?.activeCategoryIndex} extraData={ctx?.activeCategoryIndex}
/> />
</View> </View>
@ -91,4 +91,9 @@ const styles = StyleSheet.create({
backgroundColor: 'white', backgroundColor: 'white',
borderRadius: 6, borderRadius: 6,
}, },
activeIndicatorContainer: {
position: 'absolute',
width: 28,
height: 28,
},
}); });

View File

@ -30,10 +30,6 @@ export const EmojiCategory = ({ item }: { item: CategoryTypes }) => {
const [empty, setEmpty] = React.useState<EmojiType[]>([]); const [empty, setEmpty] = React.useState<EmojiType[]>([]);
React.useEffect(() => { React.useEffect(() => {
console.log(
numberOfColumns.current -
(emojisByGroup[item].length % numberOfColumns.current)
);
const fillWithEmpty = new Array( const fillWithEmpty = new Array(
numberOfColumns.current - numberOfColumns.current -
(emojisByGroup[item].length % numberOfColumns.current) (emojisByGroup[item].length % numberOfColumns.current)