fix: deps and emoji render

This commit is contained in:
Jakub Grzywacz 2021-07-16 14:20:44 +02:00
parent acaf8922e3
commit f58aa52e40
No known key found for this signature in database
GPG Key ID: 5BBB685871FF63C4
5 changed files with 38 additions and 16 deletions

View File

@ -13,11 +13,11 @@ export default function App() {
const handlePick = (emojiObject: EmojiType) => {
console.log(emojiObject);
/* example emojiObject = { {
/* example emojiObject = {
"emoji": "❤️",
"name": "red heart",
"slug": "red_heart",
},
}
*/
};
@ -40,10 +40,6 @@ or
```sh
npm install @jake7/react-native-emoji-keyboard
```
## Full Example
```js
TODO
```
## Accepted props (current implemented)
| Name | Type | Default Value | Required | Description |
|---|---|---|---|---|
@ -95,5 +91,36 @@ translation={{
}}
```
*If you have written a translation into your language, we strongly encourage you to create a Pull Request and add your language to the package, following the example of other langs.*
## Full Example
```ts
import * as React from 'react';
import { Text, SafeAreaView, TouchableOpacity } from 'react-native';
import EmojiPicker from '@jake7/react-native-emoji-keyboard';
import { EmojiType } from '@jake7/react-native-emoji-keyboard/lib/typescript/types';
export default function App() {
const [result, setResult] = React.useState<string>();
const [isModalOpen, setIsModalOpen] = React.useState<boolean>(false);
const handlePick = (emoji: EmojiType) => {
setResult(emoji.emoji);
setIsModalOpen((prev) => !prev);
};
return (
<SafeAreaView>
<Text>Selected emoji: {result}</Text>
<TouchableOpacity onPress={() => setIsModalOpen(true)}>
<Text>Open</Text>
</TouchableOpacity>
<EmojiPicker
onEmojiSelected={handlePick}
open={isModalOpen}
onClose={() => setIsModalOpen(false)}
/>
</SafeAreaView>
);
}
```
## License
**[MIT](/LICENSE)**

View File

@ -297,8 +297,6 @@ PODS:
- React-Core (= 0.63.4)
- React-cxxreact (= 0.63.4)
- React-jsi (= 0.63.4)
- RNGestureHandler (1.10.3):
- React-Core
- RNSVG (12.1.1):
- React
- Yoga (1.14.0)
@ -352,7 +350,6 @@ DEPENDENCIES:
- React-RCTText (from `../node_modules/react-native/Libraries/Text`)
- React-RCTVibration (from `../node_modules/react-native/Libraries/Vibration`)
- ReactCommon/turbomodule/core (from `../node_modules/react-native/ReactCommon`)
- RNGestureHandler (from `../node_modules/react-native-gesture-handler`)
- RNSVG (from `../node_modules/react-native-svg`)
- Yoga (from `../node_modules/react-native/ReactCommon/yoga`)
@ -424,8 +421,6 @@ EXTERNAL SOURCES:
:path: "../node_modules/react-native/Libraries/Vibration"
ReactCommon:
:path: "../node_modules/react-native/ReactCommon"
RNGestureHandler:
:path: "../node_modules/react-native-gesture-handler"
RNSVG:
:path: "../node_modules/react-native-svg"
Yoga:
@ -470,7 +465,6 @@ SPEC CHECKSUMS:
React-RCTText: 5c51df3f08cb9dedc6e790161195d12bac06101c
React-RCTVibration: ae4f914cfe8de7d4de95ae1ea6cc8f6315d73d9d
ReactCommon: 73d79c7039f473b76db6ff7c6b159c478acbbb3b
RNGestureHandler: a479ebd5ed4221a810967000735517df0d2db211
RNSVG: 551acb6562324b1d52a4e0758f7ca0ec234e278f
Yoga: 4bd86afe9883422a7c4028c00e34790f560923d6
YogaKit: f782866e155069a2cca2517aafea43200b01fd5a

View File

@ -1,13 +1,14 @@
import * as React from 'react';
import { StyleSheet, Text, SafeAreaView, TouchableOpacity } from 'react-native';
import EmojiPicker from 'react-native-emoji-keyboard';
import EmojiPicker from '@jake7/react-native-emoji-keyboard';
import type { EmojiType } from 'lib/typescript/types';
export default function App() {
const [result, setResult] = React.useState<string>();
const [isModalOpen, setIsModalOpen] = React.useState<boolean>(false);
const handlePick = (emoji: any) => {
const handlePick = (emoji: EmojiType) => {
console.log(emoji);
setResult(emoji.emoji);
setIsModalOpen((prev) => !prev);

View File

@ -72,7 +72,7 @@ export const EmojiCategory = ({
removeClippedSubviews={true}
getItemLayout={getItemLayout}
ListFooterComponent={() => <View style={styles.footer} />}
windowSize={10}
windowSize={20}
/>
</View>
);

View File

@ -2,7 +2,7 @@
"compilerOptions": {
"baseUrl": "./",
"paths": {
"react-native-emoji-keyboard": ["./src/index"]
"@jake7/react-native-emoji-keyboard": ["./src/index"]
},
"allowUnreachableCode": false,
"allowUnusedLabels": false,