chore: add new prop activeCategoryContainerColor
This commit is contained in:
parent
7e2c0d112c
commit
fa340ee6a0
|
@ -56,6 +56,7 @@ export default function App() {
|
||||||
| categoryColor | string | "#000000" | no | Change category item color |
|
| categoryColor | string | "#000000" | no | Change category item color |
|
||||||
| activeCategoryColor | string | "#005b96" | no | Change active category item color |
|
| activeCategoryColor | string | "#005b96" | no | Change active category item color |
|
||||||
| categoryContainerColor | string | "#e3dbcd" | no | Change category container color |
|
| categoryContainerColor | string | "#e3dbcd" | no | Change category container color |
|
||||||
|
| activeCategoryContainerColor | string | "#ffffff" | no | Change selected category container color |
|
||||||
| onCategoryChangeFailed | function | warn(info) | no | Callback on category change failed (info: {index, highestMeasuredFrameIndex, averageItemLength}) |
|
| onCategoryChangeFailed | function | warn(info) | no | Callback on category change failed (info: {index, highestMeasuredFrameIndex, averageItemLength}) |
|
||||||
| translation | CategoryTranslation | en | no | Translation object *see translation section* |
|
| translation | CategoryTranslation | en | no | Translation object *see translation section* |
|
||||||
| disabledCategory | CategoryTypes[] | [] | no | Hide categories by passing their slugs |
|
| disabledCategory | CategoryTypes[] | [] | no | Hide categories by passing their slugs |
|
||||||
|
|
|
@ -22,6 +22,7 @@ export type KeyboardProps = {
|
||||||
categoryColor?: string;
|
categoryColor?: string;
|
||||||
activeCategoryColor?: string;
|
activeCategoryColor?: string;
|
||||||
categoryContainerColor?: string;
|
categoryContainerColor?: string;
|
||||||
|
activeCategoryContainerColor?: string;
|
||||||
onCategoryChangeFailed?: (info: {
|
onCategoryChangeFailed?: (info: {
|
||||||
index: number;
|
index: number;
|
||||||
highestMeasuredFrameIndex: number;
|
highestMeasuredFrameIndex: number;
|
||||||
|
|
|
@ -28,6 +28,7 @@ export const defaultKeyboardContext: Required<KeyboardProps> = {
|
||||||
categoryColor: '#000000',
|
categoryColor: '#000000',
|
||||||
activeCategoryColor: '#005b96',
|
activeCategoryColor: '#005b96',
|
||||||
categoryContainerColor: '#e3dbcd',
|
categoryContainerColor: '#e3dbcd',
|
||||||
|
activeCategoryContainerColor: '#ffffff',
|
||||||
onCategoryChangeFailed: (info) => {
|
onCategoryChangeFailed: (info) => {
|
||||||
console.warn(info);
|
console.warn(info);
|
||||||
},
|
},
|
||||||
|
|
|
@ -20,6 +20,7 @@ export const Categories = ({ flatListRef, scrollNav }: CategoriesProps) => {
|
||||||
categoryContainerColor,
|
categoryContainerColor,
|
||||||
onCategoryChangeFailed,
|
onCategoryChangeFailed,
|
||||||
disabledCategory,
|
disabledCategory,
|
||||||
|
activeCategoryContainerColor,
|
||||||
} = React.useContext(KeyboardContext);
|
} = React.useContext(KeyboardContext);
|
||||||
|
|
||||||
const handleScrollToCategory = React.useCallback(
|
const handleScrollToCategory = React.useCallback(
|
||||||
|
@ -49,13 +50,16 @@ export const Categories = ({ flatListRef, scrollNav }: CategoriesProps) => {
|
||||||
<Animated.View
|
<Animated.View
|
||||||
style={[
|
style={[
|
||||||
styles.activeIndicator,
|
styles.activeIndicator,
|
||||||
|
{
|
||||||
|
backgroundColor: activeCategoryContainerColor,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
transform: [{ translateX: scrollNav }],
|
transform: [{ translateX: scrollNav }],
|
||||||
},
|
},
|
||||||
]}
|
]}
|
||||||
/>
|
/>
|
||||||
),
|
),
|
||||||
[scrollNav]
|
[activeCategoryContainerColor, scrollNav]
|
||||||
);
|
);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
@ -104,7 +108,6 @@ const styles = StyleSheet.create({
|
||||||
position: 'absolute',
|
position: 'absolute',
|
||||||
width: 28,
|
width: 28,
|
||||||
height: 28,
|
height: 28,
|
||||||
backgroundColor: 'white',
|
|
||||||
borderRadius: 6,
|
borderRadius: 6,
|
||||||
},
|
},
|
||||||
activeIndicatorContainer: {
|
activeIndicatorContainer: {
|
||||||
|
|
Loading…
Reference in New Issue