diff --git a/README.md b/README.md index b08f377..02d4e3d 100644 --- a/README.md +++ b/README.md @@ -60,6 +60,7 @@ export default function App() { | onCategoryChangeFailed | function | warn(info) | no | Callback on category change failed (info: {index, highestMeasuredFrameIndex, averageItemLength}) | | translation | CategoryTranslation | en | no | Translation object *see translation section* | | disabledCategory | CategoryTypes[] | [] | no | Hide categories by passing their slugs | +| categoryPosition | CategoryPosition | categoryPosition | no | Specify category container position | ## 📊 Comparison @@ -112,12 +113,16 @@ You can clone the repo and run `yarn example ios` or `yarn example android` to p ![Preview](/example/assets/dark-preview.jpg) ### [Translated](/example/src/Translated/Translated.tsx) ![Preview](/example/assets/translated-preview.jpg) -### [DisabledCategories](/example/src/DisabledCategories/DisabledCategories.tsx) +### [Disabled Categories](/example/src/DisabledCategories/DisabledCategories.tsx) ![Preview](/example/assets/categories-preview.jpg) -### [StaticModal (without knob)](/example/src/StaticModal/StaticModal.tsx) +### [Static Modal (without knob)](/example/src/StaticModal/StaticModal.tsx) ![Preview](/example/assets/static-modal-preview.jpg) ### [Static](/example/src/Static/Static.tsx) ![Preview](/example/assets/static-preview.jpg) +### [Categories Top](/example/src/TopCategory/TopCategory.tsx) +![Preview](/example/assets/categories-top-preview.jpg) +### [Categories Bottom](/example/src/BottomCategory/BottomCategory.tsx) +![Preview](/example/assets/categories-bottom-preview.jpg) ## 📈 Future plans * Skin tone palette selector. * Search bar. diff --git a/example/assets/categories-bottom-preview.jpg b/example/assets/categories-bottom-preview.jpg new file mode 100644 index 0000000..226ebcd Binary files /dev/null and b/example/assets/categories-bottom-preview.jpg differ diff --git a/example/assets/categories-top-preview.jpg b/example/assets/categories-top-preview.jpg new file mode 100644 index 0000000..4d73af2 Binary files /dev/null and b/example/assets/categories-top-preview.jpg differ diff --git a/example/src/App.tsx b/example/src/App.tsx index 67c9a24..320eeab 100644 --- a/example/src/App.tsx +++ b/example/src/App.tsx @@ -9,6 +9,8 @@ import Translated from './Translated/Translated'; import DisabledCategories from './DisabledCategories/DisabledCategories'; import StaticModal from './StaticModal/StaticModal'; import Static from './Static/Static'; +import TopCategory from './TopCategory/TopCategory'; +import BottomCategory from './BottomCategory/BottomCategory'; const Stack = createStackNavigator(); export default () => { @@ -25,6 +27,8 @@ export default () => { /> + + ); diff --git a/example/src/BottomCategory/BottomCategory.tsx b/example/src/BottomCategory/BottomCategory.tsx new file mode 100644 index 0000000..6247895 --- /dev/null +++ b/example/src/BottomCategory/BottomCategory.tsx @@ -0,0 +1,43 @@ +import * as React from 'react'; +import { StyleSheet, Text, TouchableOpacity } from 'react-native'; +import { SafeAreaView } from 'react-native-safe-area-context'; +import EmojiPicker from 'rn-emoji-keyboard'; +import type { EmojiType } from 'src/types'; + +const BottomCategory = () => { + const [result, setResult] = React.useState(); + const [isModalOpen, setIsModalOpen] = React.useState(false); + + const handlePick = (emoji: EmojiType) => { + setResult(emoji.emoji); + setIsModalOpen((prev) => !prev); + }; + return ( + + Result: {result} + setIsModalOpen(true)}> + Open + + + setIsModalOpen(false)} + categoryPosition="bottom" + /> + + ); +}; + +const styles = StyleSheet.create({ + container: { + flex: 1, + }, + text: { + textAlign: 'center', + margin: 64, + fontSize: 18, + }, +}); + +export default BottomCategory; diff --git a/example/src/Examples/Examples.tsx b/example/src/Examples/Examples.tsx index 64a11b2..675a11a 100644 --- a/example/src/Examples/Examples.tsx +++ b/example/src/Examples/Examples.tsx @@ -11,6 +11,8 @@ type RootStackParamList = { DisabledCategories: undefined; StaticModal: undefined; Static: undefined; + TopCategory: undefined; + BottomCategory: undefined; }; type Props = StackScreenProps; @@ -26,14 +28,25 @@ const Examples = ({ navigation }: Props) => { onPress={() => navigation.navigate('Translated')} />