Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wheel picker custom cancel button and title and container custom styling #2648

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions demo/src/screens/componentScreens/PickerScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -125,19 +125,23 @@ export default class PickerScreen extends Component {
label="Wheel Picker"
placeholder="Pick a Language"
useWheelPicker
// useWheelPicker
value={this.state.nativePickerValue}
onChange={nativePickerValue => this.setState({nativePickerValue})}
trailingAccessory={<Icon source={dropdown}/>}
// containerStyle={{marginTop: 20}}
// renderPicker={() => {
// return (
// <View>
// <Text>Open Native Picker!</Text>
// </View>
// );
// }}
// topBarProps={{doneLabel: 'YES', cancelLabel: 'NO'}}
topBarProps={{
doneLabel: 'YES',
cancelLabel: 'NO',
Comment on lines +139 to +140
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd change to labels to something more clear, maybe Cancel and 'Done`? 😅

title: 'Wheel Picker',
containerStyle: {paddingHorizontal: 40},
titleStyle: {color: Colors.grey40}
}}
>
{_.map(options, option => (
<Picker.Item key={option.value} value={option.value} label={option.label} disabled={option.disabled}/>
Expand Down
9 changes: 7 additions & 2 deletions src/components/picker/PickerItemsList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,13 @@ const PickerItemsList = (props: PickerItemsListProps) => {
const renderWheel = () => {
return (
<View>
<View row spread padding-page>
<Text>{topBarProps?.title}</Text>
<View row spread padding-page centerV style={topBarProps?.containerStyle}>
{topBarProps?.cancelLabel &&
<Text text70 $textPrimary accessibilityRole={'button'} onPress={topBarProps?.onCancel}>
{topBarProps?.cancelLabel}
</Text>
}
<Text style={topBarProps?.titleStyle}>{topBarProps?.title}</Text>
<Text text70 $textPrimary accessibilityRole={'button'} onPress={() => context.onPress(wheelPickerValue)}>
{topBarProps?.doneLabel ?? 'Select'}
</Text>
Expand Down