diff --git a/src/SegmentedControl/SegmentedControl.tsx b/src/SegmentedControl/SegmentedControl.tsx index a43a632..ab9d131 100644 --- a/src/SegmentedControl/SegmentedControl.tsx +++ b/src/SegmentedControl/SegmentedControl.tsx @@ -1,11 +1,9 @@ -import React, { createContext, useState, useEffect } from 'react'; -import { LayoutChangeEvent, StyleProp, View, ViewStyle } from 'react-native'; +import React, { createContext, useEffect, useState } from 'react'; +import { LayoutChangeEvent, View, ViewStyle } from 'react-native'; +import { PanGestureHandler, PanGestureHandlerGestureEvent } from 'react-native-gesture-handler'; import Animated, { Easing } from 'react-native-reanimated'; import { timing } from 'react-native-redash'; -import { - PanGestureHandler, - PanGestureHandlerGestureEvent, -} from 'react-native-gesture-handler'; + import { Segment, SegmentProps } from '../Segment'; import { clamp } from '../utils'; import styles from './SegmentedControlStyles'; @@ -18,7 +16,8 @@ export interface SegmentedControlProps { | React.ReactElement | React.ReactElement[]; onChangeValue?: (name: string) => void; - style?: StyleProp; + sliderStyle?: ViewStyle; + style?: ViewStyle; } export const SegmentedContext = createContext<{ @@ -32,6 +31,7 @@ export const SegmentedControl = ({ inactiveTintColor = '#000000', initialSelectedName, onChangeValue, + sliderStyle, style, }: SegmentedControlProps): JSX.Element => { const [_initialized, _setInitialized] = useState(false); @@ -133,15 +133,12 @@ export const SegmentedControl = ({ value={{ selectedName: _activeName, onChange: handleChangeValue }} > - + {typeof _activeName !== 'undefined' && ( )} diff --git a/src/SegmentedControl/SegmentedControlStyles.ts b/src/SegmentedControl/SegmentedControlStyles.ts index 5af6fa4..ec3a4bb 100644 --- a/src/SegmentedControl/SegmentedControlStyles.ts +++ b/src/SegmentedControl/SegmentedControlStyles.ts @@ -13,6 +13,9 @@ const styles = StyleSheet.create({ position: 'absolute', top: 0, left: 0, + zIndex: 1, + }, + sliderDefault: { height: '86%', backgroundColor: 'white', borderRadius: 7, @@ -21,7 +24,6 @@ const styles = StyleSheet.create({ shadowColor: '#a2a2a2', shadowOpacity: 0.5, shadowRadius: 2, - zIndex: 1, }, dividerContainer: { paddingTop: 7,