-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: add custom compontents: NoOptionsComponent and OptionComponent * fix: eslint errors
- Loading branch information
Showing
7 changed files
with
140 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import React from 'react'; | ||
import { SafeAreaView, Text, TouchableOpacity, View } from 'react-native'; | ||
import { OptionComponentProps, Select } from '@mobile-reality/react-native-select-pro'; | ||
|
||
import { DATA } from '../App'; | ||
|
||
const MyOption = ({ option, onPressOption }: OptionComponentProps) => { | ||
return ( | ||
<TouchableOpacity onPress={onPressOption}> | ||
<Text>{option.label}</Text> | ||
</TouchableOpacity> | ||
); | ||
}; | ||
|
||
const NoOptions = () => { | ||
return ( | ||
<View> | ||
<Text>Custom component no options</Text> | ||
</View> | ||
); | ||
}; | ||
|
||
export const CustomComponent = () => { | ||
return ( | ||
<SafeAreaView> | ||
<Select | ||
OptionComponent={(props) => <MyOption {...props} />} | ||
options={DATA} | ||
selectControlStyle={{ width: 200 }} | ||
/> | ||
<Select | ||
NoOptionsComponent={<NoOptions />} | ||
options={[]} | ||
selectControlStyle={{ width: 200 }} | ||
/> | ||
</SafeAreaView> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters