diff --git a/README.md b/README.md index e48e737..2ba1349 100644 --- a/README.md +++ b/README.md @@ -55,14 +55,14 @@ const App = () => { @@ -81,7 +81,10 @@ const styles = StyleSheet.create({ justifyContent: 'center', alignItems: 'center', }, - pickerDevider: { + containerStyle: { + width: 120, + }, + pickerDivider: { borderColor: 'rgba(0,0,0,0.1)', borderTopWidth: 1, borderBottomWidth: 1, @@ -106,5 +109,6 @@ const styles = StyleSheet.create({ | withTranslateZ | no | false | Enable | | withScale | no | false | | | withOpacity | no | false | | -| deviderStyle | no | | Styles for the Devider | +| containerStyle | no | | Styles for the outer container | +| dividerStyle | no | | Styles for the Divider | | labelStyle | no | | Styles for label Items | diff --git a/src/picker.tsx b/src/picker.tsx index 93466ed..cb14fcf 100644 --- a/src/picker.tsx +++ b/src/picker.tsx @@ -1,5 +1,5 @@ import React, { useMemo } from 'react'; -import { View, StyleSheet, Text } from 'react-native'; +import {View, StyleSheet, Text, ViewStyle, TextStyle} from 'react-native'; import Animated, { interpolateNode, Extrapolate, @@ -18,7 +18,6 @@ const perspective = 1600; interface PickerProps { values: { value: number | string; label: string }[]; - containerWidth: number; visibleItems: number; itemHeight: number; defaultValue?: number | string; @@ -26,21 +25,22 @@ interface PickerProps { withTranslateZ?: boolean; withScale?: boolean; withOpacity?: boolean; - deviderStyle?: any; - labelStyle?: any; + containerStyle?: ViewStyle; + dividerStyle?: ViewStyle; + labelStyle?: TextStyle; } -const Picker = ({ - containerWidth, - values, - defaultValue, - visibleItems, - itemHeight, - onChange, +const Picker = ({ + values, + defaultValue, + visibleItems, + itemHeight, + onChange, withTranslateZ, withScale, withOpacity, - deviderStyle, + containerStyle, + dividerStyle, labelStyle, }: PickerProps) => { const translateY = useValue(0); @@ -72,7 +72,7 @@ const Picker = ({ extrapolate: Extrapolate.CLAMP, } ); - + transform.push({ scale }); } @@ -114,7 +114,7 @@ const Picker = ({ ), []); return ( - + @@ -156,4 +156,4 @@ const styles = StyleSheet.create({ textAlign: 'center', textAlignVertical: 'center', }, -}); \ No newline at end of file +});