build: init-working-prototype

This commit is contained in:
Jakub Grzywacz 2021-07-07 12:00:45 +02:00
parent 3cce2c2e03
commit b06609e844
No known key found for this signature in database
GPG Key ID: 5BBB685871FF63C4
18 changed files with 15923 additions and 950 deletions

File diff suppressed because it is too large Load Diff

View File

@ -15,5 +15,10 @@ target 'EmojiKeyboardExample' do
use_flipper!({ 'Flipper' => '0.80.0' })
post_install do |installer|
flipper_post_install(installer)
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '9.0'
end
end
end
end

474
example/ios/Podfile.lock Normal file
View File

@ -0,0 +1,474 @@
PODS:
- boost-for-react-native (1.63.0)
- CocoaAsyncSocket (7.6.5)
- DoubleConversion (1.1.6)
- FBLazyVector (0.63.4)
- FBReactNativeSpec (0.63.4):
- Folly (= 2020.01.13.00)
- RCTRequired (= 0.63.4)
- RCTTypeSafety (= 0.63.4)
- React-Core (= 0.63.4)
- React-jsi (= 0.63.4)
- ReactCommon/turbomodule/core (= 0.63.4)
- Flipper (0.80.0):
- Flipper-Folly (~> 2.5)
- Flipper-RSocket (~> 1.3)
- Flipper-Boost-iOSX (1.76.0.1.11)
- Flipper-DoubleConversion (1.1.7)
- Flipper-Fmt (7.1.7)
- Flipper-Folly (2.6.7):
- Flipper-Boost-iOSX
- Flipper-DoubleConversion
- Flipper-Fmt (= 7.1.7)
- Flipper-Glog
- libevent (~> 2.1.12)
- OpenSSL-Universal (= 1.1.180)
- Flipper-Glog (0.3.6)
- Flipper-PeerTalk (0.0.4)
- Flipper-RSocket (1.4.3):
- Flipper-Folly (~> 2.6)
- FlipperKit (0.80.0):
- FlipperKit/Core (= 0.80.0)
- FlipperKit/Core (0.80.0):
- Flipper (~> 0.80.0)
- FlipperKit/CppBridge
- FlipperKit/FBCxxFollyDynamicConvert
- FlipperKit/FBDefines
- FlipperKit/FKPortForwarding
- FlipperKit/CppBridge (0.80.0):
- Flipper (~> 0.80.0)
- FlipperKit/FBCxxFollyDynamicConvert (0.80.0):
- Flipper-Folly (~> 2.5)
- FlipperKit/FBDefines (0.80.0)
- FlipperKit/FKPortForwarding (0.80.0):
- CocoaAsyncSocket (~> 7.6)
- Flipper-PeerTalk (~> 0.0.4)
- FlipperKit/FlipperKitHighlightOverlay (0.80.0)
- FlipperKit/FlipperKitLayoutPlugin (0.80.0):
- FlipperKit/Core
- FlipperKit/FlipperKitHighlightOverlay
- FlipperKit/FlipperKitLayoutTextSearchable
- YogaKit (~> 1.18)
- FlipperKit/FlipperKitLayoutTextSearchable (0.80.0)
- FlipperKit/FlipperKitNetworkPlugin (0.80.0):
- FlipperKit/Core
- FlipperKit/FlipperKitReactPlugin (0.80.0):
- FlipperKit/Core
- FlipperKit/FlipperKitUserDefaultsPlugin (0.80.0):
- FlipperKit/Core
- FlipperKit/SKIOSNetworkPlugin (0.80.0):
- FlipperKit/Core
- FlipperKit/FlipperKitNetworkPlugin
- Folly (2020.01.13.00):
- boost-for-react-native
- DoubleConversion
- Folly/Default (= 2020.01.13.00)
- glog
- Folly/Default (2020.01.13.00):
- boost-for-react-native
- DoubleConversion
- glog
- glog (0.3.5)
- libevent (2.1.12)
- OpenSSL-Universal (1.1.180)
- RCTRequired (0.63.4)
- RCTTypeSafety (0.63.4):
- FBLazyVector (= 0.63.4)
- Folly (= 2020.01.13.00)
- RCTRequired (= 0.63.4)
- React-Core (= 0.63.4)
- React (0.63.4):
- React-Core (= 0.63.4)
- React-Core/DevSupport (= 0.63.4)
- React-Core/RCTWebSocket (= 0.63.4)
- React-RCTActionSheet (= 0.63.4)
- React-RCTAnimation (= 0.63.4)
- React-RCTBlob (= 0.63.4)
- React-RCTImage (= 0.63.4)
- React-RCTLinking (= 0.63.4)
- React-RCTNetwork (= 0.63.4)
- React-RCTSettings (= 0.63.4)
- React-RCTText (= 0.63.4)
- React-RCTVibration (= 0.63.4)
- React-callinvoker (0.63.4)
- React-Core (0.63.4):
- Folly (= 2020.01.13.00)
- glog
- React-Core/Default (= 0.63.4)
- React-cxxreact (= 0.63.4)
- React-jsi (= 0.63.4)
- React-jsiexecutor (= 0.63.4)
- Yoga
- React-Core/CoreModulesHeaders (0.63.4):
- Folly (= 2020.01.13.00)
- glog
- React-Core/Default
- React-cxxreact (= 0.63.4)
- React-jsi (= 0.63.4)
- React-jsiexecutor (= 0.63.4)
- Yoga
- React-Core/Default (0.63.4):
- Folly (= 2020.01.13.00)
- glog
- React-cxxreact (= 0.63.4)
- React-jsi (= 0.63.4)
- React-jsiexecutor (= 0.63.4)
- Yoga
- React-Core/DevSupport (0.63.4):
- Folly (= 2020.01.13.00)
- glog
- React-Core/Default (= 0.63.4)
- React-Core/RCTWebSocket (= 0.63.4)
- React-cxxreact (= 0.63.4)
- React-jsi (= 0.63.4)
- React-jsiexecutor (= 0.63.4)
- React-jsinspector (= 0.63.4)
- Yoga
- React-Core/RCTActionSheetHeaders (0.63.4):
- Folly (= 2020.01.13.00)
- glog
- React-Core/Default
- React-cxxreact (= 0.63.4)
- React-jsi (= 0.63.4)
- React-jsiexecutor (= 0.63.4)
- Yoga
- React-Core/RCTAnimationHeaders (0.63.4):
- Folly (= 2020.01.13.00)
- glog
- React-Core/Default
- React-cxxreact (= 0.63.4)
- React-jsi (= 0.63.4)
- React-jsiexecutor (= 0.63.4)
- Yoga
- React-Core/RCTBlobHeaders (0.63.4):
- Folly (= 2020.01.13.00)
- glog
- React-Core/Default
- React-cxxreact (= 0.63.4)
- React-jsi (= 0.63.4)
- React-jsiexecutor (= 0.63.4)
- Yoga
- React-Core/RCTImageHeaders (0.63.4):
- Folly (= 2020.01.13.00)
- glog
- React-Core/Default
- React-cxxreact (= 0.63.4)
- React-jsi (= 0.63.4)
- React-jsiexecutor (= 0.63.4)
- Yoga
- React-Core/RCTLinkingHeaders (0.63.4):
- Folly (= 2020.01.13.00)
- glog
- React-Core/Default
- React-cxxreact (= 0.63.4)
- React-jsi (= 0.63.4)
- React-jsiexecutor (= 0.63.4)
- Yoga
- React-Core/RCTNetworkHeaders (0.63.4):
- Folly (= 2020.01.13.00)
- glog
- React-Core/Default
- React-cxxreact (= 0.63.4)
- React-jsi (= 0.63.4)
- React-jsiexecutor (= 0.63.4)
- Yoga
- React-Core/RCTSettingsHeaders (0.63.4):
- Folly (= 2020.01.13.00)
- glog
- React-Core/Default
- React-cxxreact (= 0.63.4)
- React-jsi (= 0.63.4)
- React-jsiexecutor (= 0.63.4)
- Yoga
- React-Core/RCTTextHeaders (0.63.4):
- Folly (= 2020.01.13.00)
- glog
- React-Core/Default
- React-cxxreact (= 0.63.4)
- React-jsi (= 0.63.4)
- React-jsiexecutor (= 0.63.4)
- Yoga
- React-Core/RCTVibrationHeaders (0.63.4):
- Folly (= 2020.01.13.00)
- glog
- React-Core/Default
- React-cxxreact (= 0.63.4)
- React-jsi (= 0.63.4)
- React-jsiexecutor (= 0.63.4)
- Yoga
- React-Core/RCTWebSocket (0.63.4):
- Folly (= 2020.01.13.00)
- glog
- React-Core/Default (= 0.63.4)
- React-cxxreact (= 0.63.4)
- React-jsi (= 0.63.4)
- React-jsiexecutor (= 0.63.4)
- Yoga
- React-CoreModules (0.63.4):
- FBReactNativeSpec (= 0.63.4)
- Folly (= 2020.01.13.00)
- RCTTypeSafety (= 0.63.4)
- React-Core/CoreModulesHeaders (= 0.63.4)
- React-jsi (= 0.63.4)
- React-RCTImage (= 0.63.4)
- ReactCommon/turbomodule/core (= 0.63.4)
- React-cxxreact (0.63.4):
- boost-for-react-native (= 1.63.0)
- DoubleConversion
- Folly (= 2020.01.13.00)
- glog
- React-callinvoker (= 0.63.4)
- React-jsinspector (= 0.63.4)
- React-jsi (0.63.4):
- boost-for-react-native (= 1.63.0)
- DoubleConversion
- Folly (= 2020.01.13.00)
- glog
- React-jsi/Default (= 0.63.4)
- React-jsi/Default (0.63.4):
- boost-for-react-native (= 1.63.0)
- DoubleConversion
- Folly (= 2020.01.13.00)
- glog
- React-jsiexecutor (0.63.4):
- DoubleConversion
- Folly (= 2020.01.13.00)
- glog
- React-cxxreact (= 0.63.4)
- React-jsi (= 0.63.4)
- React-jsinspector (0.63.4)
- React-RCTActionSheet (0.63.4):
- React-Core/RCTActionSheetHeaders (= 0.63.4)
- React-RCTAnimation (0.63.4):
- FBReactNativeSpec (= 0.63.4)
- Folly (= 2020.01.13.00)
- RCTTypeSafety (= 0.63.4)
- React-Core/RCTAnimationHeaders (= 0.63.4)
- React-jsi (= 0.63.4)
- ReactCommon/turbomodule/core (= 0.63.4)
- React-RCTBlob (0.63.4):
- FBReactNativeSpec (= 0.63.4)
- Folly (= 2020.01.13.00)
- React-Core/RCTBlobHeaders (= 0.63.4)
- React-Core/RCTWebSocket (= 0.63.4)
- React-jsi (= 0.63.4)
- React-RCTNetwork (= 0.63.4)
- ReactCommon/turbomodule/core (= 0.63.4)
- React-RCTImage (0.63.4):
- FBReactNativeSpec (= 0.63.4)
- Folly (= 2020.01.13.00)
- RCTTypeSafety (= 0.63.4)
- React-Core/RCTImageHeaders (= 0.63.4)
- React-jsi (= 0.63.4)
- React-RCTNetwork (= 0.63.4)
- ReactCommon/turbomodule/core (= 0.63.4)
- React-RCTLinking (0.63.4):
- FBReactNativeSpec (= 0.63.4)
- React-Core/RCTLinkingHeaders (= 0.63.4)
- React-jsi (= 0.63.4)
- ReactCommon/turbomodule/core (= 0.63.4)
- React-RCTNetwork (0.63.4):
- FBReactNativeSpec (= 0.63.4)
- Folly (= 2020.01.13.00)
- RCTTypeSafety (= 0.63.4)
- React-Core/RCTNetworkHeaders (= 0.63.4)
- React-jsi (= 0.63.4)
- ReactCommon/turbomodule/core (= 0.63.4)
- React-RCTSettings (0.63.4):
- FBReactNativeSpec (= 0.63.4)
- Folly (= 2020.01.13.00)
- RCTTypeSafety (= 0.63.4)
- React-Core/RCTSettingsHeaders (= 0.63.4)
- React-jsi (= 0.63.4)
- ReactCommon/turbomodule/core (= 0.63.4)
- React-RCTText (0.63.4):
- React-Core/RCTTextHeaders (= 0.63.4)
- React-RCTVibration (0.63.4):
- FBReactNativeSpec (= 0.63.4)
- Folly (= 2020.01.13.00)
- React-Core/RCTVibrationHeaders (= 0.63.4)
- React-jsi (= 0.63.4)
- ReactCommon/turbomodule/core (= 0.63.4)
- ReactCommon/turbomodule/core (0.63.4):
- DoubleConversion
- Folly (= 2020.01.13.00)
- glog
- React-callinvoker (= 0.63.4)
- React-Core (= 0.63.4)
- React-cxxreact (= 0.63.4)
- React-jsi (= 0.63.4)
- RNGestureHandler (1.10.3):
- React-Core
- Yoga (1.14.0)
- YogaKit (1.18.1):
- Yoga (~> 1.14)
DEPENDENCIES:
- DoubleConversion (from `../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec`)
- FBLazyVector (from `../node_modules/react-native/Libraries/FBLazyVector`)
- FBReactNativeSpec (from `../node_modules/react-native/Libraries/FBReactNativeSpec`)
- Flipper (= 0.80.0)
- Flipper-DoubleConversion (= 1.1.7)
- Flipper-Folly (~> 2.2)
- Flipper-Glog (= 0.3.6)
- Flipper-PeerTalk (~> 0.0.4)
- Flipper-RSocket (~> 1.1)
- FlipperKit (= 0.80.0)
- FlipperKit/Core (= 0.80.0)
- FlipperKit/CppBridge (= 0.80.0)
- FlipperKit/FBCxxFollyDynamicConvert (= 0.80.0)
- FlipperKit/FBDefines (= 0.80.0)
- FlipperKit/FKPortForwarding (= 0.80.0)
- FlipperKit/FlipperKitHighlightOverlay (= 0.80.0)
- FlipperKit/FlipperKitLayoutPlugin (= 0.80.0)
- FlipperKit/FlipperKitLayoutTextSearchable (= 0.80.0)
- FlipperKit/FlipperKitNetworkPlugin (= 0.80.0)
- FlipperKit/FlipperKitReactPlugin (= 0.80.0)
- FlipperKit/FlipperKitUserDefaultsPlugin (= 0.80.0)
- FlipperKit/SKIOSNetworkPlugin (= 0.80.0)
- Folly (from `../node_modules/react-native/third-party-podspecs/Folly.podspec`)
- glog (from `../node_modules/react-native/third-party-podspecs/glog.podspec`)
- RCTRequired (from `../node_modules/react-native/Libraries/RCTRequired`)
- RCTTypeSafety (from `../node_modules/react-native/Libraries/TypeSafety`)
- React (from `../node_modules/react-native/`)
- React-callinvoker (from `../node_modules/react-native/ReactCommon/callinvoker`)
- React-Core (from `../node_modules/react-native/`)
- React-Core/DevSupport (from `../node_modules/react-native/`)
- React-Core/RCTWebSocket (from `../node_modules/react-native/`)
- React-CoreModules (from `../node_modules/react-native/React/CoreModules`)
- React-cxxreact (from `../node_modules/react-native/ReactCommon/cxxreact`)
- React-jsi (from `../node_modules/react-native/ReactCommon/jsi`)
- React-jsiexecutor (from `../node_modules/react-native/ReactCommon/jsiexecutor`)
- React-jsinspector (from `../node_modules/react-native/ReactCommon/jsinspector`)
- React-RCTActionSheet (from `../node_modules/react-native/Libraries/ActionSheetIOS`)
- React-RCTAnimation (from `../node_modules/react-native/Libraries/NativeAnimation`)
- React-RCTBlob (from `../node_modules/react-native/Libraries/Blob`)
- React-RCTImage (from `../node_modules/react-native/Libraries/Image`)
- React-RCTLinking (from `../node_modules/react-native/Libraries/LinkingIOS`)
- React-RCTNetwork (from `../node_modules/react-native/Libraries/Network`)
- React-RCTSettings (from `../node_modules/react-native/Libraries/Settings`)
- 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`)
- Yoga (from `../node_modules/react-native/ReactCommon/yoga`)
SPEC REPOS:
trunk:
- boost-for-react-native
- CocoaAsyncSocket
- Flipper
- Flipper-Boost-iOSX
- Flipper-DoubleConversion
- Flipper-Fmt
- Flipper-Folly
- Flipper-Glog
- Flipper-PeerTalk
- Flipper-RSocket
- FlipperKit
- libevent
- OpenSSL-Universal
- YogaKit
EXTERNAL SOURCES:
DoubleConversion:
:podspec: "../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec"
FBLazyVector:
:path: "../node_modules/react-native/Libraries/FBLazyVector"
FBReactNativeSpec:
:path: "../node_modules/react-native/Libraries/FBReactNativeSpec"
Folly:
:podspec: "../node_modules/react-native/third-party-podspecs/Folly.podspec"
glog:
:podspec: "../node_modules/react-native/third-party-podspecs/glog.podspec"
RCTRequired:
:path: "../node_modules/react-native/Libraries/RCTRequired"
RCTTypeSafety:
:path: "../node_modules/react-native/Libraries/TypeSafety"
React:
:path: "../node_modules/react-native/"
React-callinvoker:
:path: "../node_modules/react-native/ReactCommon/callinvoker"
React-Core:
:path: "../node_modules/react-native/"
React-CoreModules:
:path: "../node_modules/react-native/React/CoreModules"
React-cxxreact:
:path: "../node_modules/react-native/ReactCommon/cxxreact"
React-jsi:
:path: "../node_modules/react-native/ReactCommon/jsi"
React-jsiexecutor:
:path: "../node_modules/react-native/ReactCommon/jsiexecutor"
React-jsinspector:
:path: "../node_modules/react-native/ReactCommon/jsinspector"
React-RCTActionSheet:
:path: "../node_modules/react-native/Libraries/ActionSheetIOS"
React-RCTAnimation:
:path: "../node_modules/react-native/Libraries/NativeAnimation"
React-RCTBlob:
:path: "../node_modules/react-native/Libraries/Blob"
React-RCTImage:
:path: "../node_modules/react-native/Libraries/Image"
React-RCTLinking:
:path: "../node_modules/react-native/Libraries/LinkingIOS"
React-RCTNetwork:
:path: "../node_modules/react-native/Libraries/Network"
React-RCTSettings:
:path: "../node_modules/react-native/Libraries/Settings"
React-RCTText:
:path: "../node_modules/react-native/Libraries/Text"
React-RCTVibration:
:path: "../node_modules/react-native/Libraries/Vibration"
ReactCommon:
:path: "../node_modules/react-native/ReactCommon"
RNGestureHandler:
:path: "../node_modules/react-native-gesture-handler"
Yoga:
:path: "../node_modules/react-native/ReactCommon/yoga"
SPEC CHECKSUMS:
boost-for-react-native: 39c7adb57c4e60d6c5479dd8623128eb5b3f0f2c
CocoaAsyncSocket: 065fd1e645c7abab64f7a6a2007a48038fdc6a99
DoubleConversion: cde416483dac037923206447da6e1454df403714
FBLazyVector: 3bb422f41b18121b71783a905c10e58606f7dc3e
FBReactNativeSpec: f2c97f2529dd79c083355182cc158c9f98f4bd6e
Flipper: ed161911b24ac3f237ed57febeed5d71d432d9bf
Flipper-Boost-iOSX: fd1e2b8cbef7e662a122412d7ac5f5bea715403c
Flipper-DoubleConversion: 38631e41ef4f9b12861c67d17cb5518d06badc41
Flipper-Fmt: 60cbdd92fc254826e61d669a5d87ef7015396a9b
Flipper-Folly: 83af37379faa69497529e414bd43fbfc7cae259a
Flipper-Glog: 1dfd6abf1e922806c52ceb8701a3599a79a200a6
Flipper-PeerTalk: 116d8f857dc6ef55c7a5a75ea3ceaafe878aadc9
Flipper-RSocket: d9d9ade67cbecf6ac10730304bf5607266dd2541
FlipperKit: 57764956d2f0f972c1af5075a9c8f05ca5b12349
Folly: b73c3869541e86821df3c387eb0af5f65addfab4
glog: 40a13f7840415b9a77023fbcae0f1e6f43192af3
libevent: 4049cae6c81cdb3654a443be001fb9bdceff7913
OpenSSL-Universal: 1aa4f6a6ee7256b83db99ec1ccdaa80d10f9af9b
RCTRequired: 082f10cd3f905d6c124597fd1c14f6f2655ff65e
RCTTypeSafety: 8c9c544ecbf20337d069e4ae7fd9a377aadf504b
React: b0a957a2c44da4113b0c4c9853d8387f8e64e615
React-callinvoker: c3f44dd3cb195b6aa46621fff95ded79d59043fe
React-Core: d3b2a1ac9a2c13c3bcde712d9281fc1c8a5b315b
React-CoreModules: 0581ff36cb797da0943d424f69e7098e43e9be60
React-cxxreact: c1480d4fda5720086c90df537ee7d285d4c57ac3
React-jsi: a0418934cf48f25b485631deb27c64dc40fb4c31
React-jsiexecutor: 93bd528844ad21dc07aab1c67cb10abae6df6949
React-jsinspector: 58aef7155bc9a9683f5b60b35eccea8722a4f53a
React-RCTActionSheet: 89a0ca9f4a06c1f93c26067af074ccdce0f40336
React-RCTAnimation: 1bde3ecc0c104c55df246eda516e0deb03c4e49b
React-RCTBlob: a97d378b527740cc667e03ebfa183a75231ab0f0
React-RCTImage: c1b1f2d3f43a4a528c8946d6092384b5c880d2f0
React-RCTLinking: 35ae4ab9dc0410d1fcbdce4d7623194a27214fb2
React-RCTNetwork: 29ec2696f8d8cfff7331fac83d3e893c95ef43ae
React-RCTSettings: 60f0691bba2074ef394f95d4c2265ec284e0a46a
React-RCTText: 5c51df3f08cb9dedc6e790161195d12bac06101c
React-RCTVibration: ae4f914cfe8de7d4de95ae1ea6cc8f6315d73d9d
ReactCommon: 73d79c7039f473b76db6ff7c6b159c478acbbb3b
RNGestureHandler: a479ebd5ed4221a810967000735517df0d2db211
Yoga: 4bd86afe9883422a7c4028c00e34790f560923d6
YogaKit: f782866e155069a2cca2517aafea43200b01fd5a
PODFILE CHECKSUM: 6fed3d06e93e3778fb148779217629dd83a22b34
COCOAPODS: 1.10.1

View File

@ -10,7 +10,8 @@
},
"dependencies": {
"react": "16.13.1",
"react-native": "0.63.4"
"react-native": "0.63.4",
"react-native-gesture-handler": "^1.10.3"
},
"devDependencies": {
"@babel/core": "^7.12.10",

View File

@ -1,31 +1,46 @@
import * as React from 'react';
import { StyleSheet, View, Text } from 'react-native';
import EmojiKeyboard from 'react-native-emoji-keyboard';
import { StyleSheet, Text, SafeAreaView, TouchableOpacity } from 'react-native';
import EmojiPicker from 'react-native-emoji-keyboard';
export default function App() {
const [result, setResult] = React.useState<number | undefined>();
const [result, setResult] = React.useState<string>();
const [isModalOpen, setIsModalOpen] = React.useState<boolean>(false);
React.useEffect(() => {
EmojiKeyboard.multiply(3, 7).then(setResult);
}, []);
const handlePick = (emoji: any) => {
console.log(emoji);
setResult(emoji.emoji);
setIsModalOpen((prev) => !prev);
};
return (
<View style={styles.container}>
<Text>Result: {result}</Text>
</View>
<SafeAreaView style={styles.container}>
<Text style={styles.text}>Result: {result}</Text>
<TouchableOpacity onPress={() => setIsModalOpen(true)}>
<Text>Open</Text>
</TouchableOpacity>
<EmojiPicker
onEmojiSelected={handlePick}
isOpen={isModalOpen}
onClose={() => setIsModalOpen(false)}
/>
</SafeAreaView>
);
}
const styles = StyleSheet.create({
container: {
flex: 1,
alignItems: 'center',
justifyContent: 'center',
},
box: {
width: 60,
height: 60,
marginVertical: 20,
text: {
textAlign: 'center',
margin: 64,
fontSize: 18,
},
containerStyles: {
backgroundColor: '#efefef',
borderTopLeftRadius: 24,
borderTopRightRadius: 24,
elevation: 20,
},
});

4495
example/yarn.lock Normal file

File diff suppressed because it is too large Load Diff

View File

@ -149,5 +149,9 @@
}
]
]
},
"dependencies": {
"react-native-gesture-handler": "^1.10.3",
"unicode-emoji-json": "^0.2.1"
}
}

101
src/EmojiKeyboard.tsx Normal file
View File

@ -0,0 +1,101 @@
import * as React from 'react';
import {
StyleSheet,
View,
FlatList,
ViewStyle,
useWindowDimensions,
Animated,
NativeSyntheticEvent,
NativeScrollEvent,
} from 'react-native';
import { CATEGORIES, CategoryTypes, EmojiType } from './types';
import { EmojiCategory } from './components/EmojiCategory';
import { KeyboardContext } from './KeyboardContext';
import { Categories } from './components/Categories';
type EmojiKeyboardProps = {
onEmojiSelected: (emoji: EmojiType) => void;
containerStyles?: ViewStyle;
numberOfColumns?: number;
emojiSize?: number;
};
export const EmojiKeyboard = ({
onEmojiSelected,
containerStyles,
numberOfColumns = 7,
emojiSize = 28,
}: EmojiKeyboardProps) => {
const { width } = useWindowDimensions();
const flatListRef = React.useRef<FlatList>(null);
const scrollX = React.useRef(new Animated.Value(0)).current;
const scrollNav = React.useRef(new Animated.Value(0)).current;
const getItemLayout = (
_: CategoryTypes[] | null | undefined,
index: number
) => ({
length: width,
offset: width * index,
index,
});
const renderItem = React.useCallback(
(props) => <EmojiCategory {...props} />,
[]
);
const onScroll = Animated.event(
[{ nativeEvent: { contentOffset: { x: scrollX } } }],
{
listener: ({
nativeEvent: {
contentOffset: { x },
},
}: NativeSyntheticEvent<NativeScrollEvent>) => {
Animated.spring(scrollNav, {
toValue: (x / width) * (28 + 9),
useNativeDriver: false,
}).start();
},
useNativeDriver: false,
}
);
return (
<KeyboardContext.Provider
value={{
onEmojiSelected,
numberOfColumns,
emojiSize,
}}
>
<View style={[styles.container, containerStyles]}>
<FlatList
data={CATEGORIES}
keyExtractor={(item) => item}
renderItem={renderItem}
removeClippedSubviews={true}
ref={flatListRef}
onScrollToIndexFailed={() => {}}
horizontal
showsHorizontalScrollIndicator={false}
pagingEnabled
scrollEventThrottle={16}
decelerationRate="fast"
getItemLayout={getItemLayout}
onScroll={onScroll}
/>
<Categories flatListRef={flatListRef} scrollNav={scrollNav} />
</View>
</KeyboardContext.Provider>
);
};
const styles = StyleSheet.create({
container: {
flex: 1,
paddingTop: 16,
},
});

109
src/EmojiPicker.tsx Normal file
View File

@ -0,0 +1,109 @@
import * as React from 'react';
import {
SafeAreaView,
Modal,
Animated,
useWindowDimensions,
StyleSheet,
} from 'react-native';
import type { EmojiKeyboardProps } from './types';
import { EmojiKeyboard } from './EmojiKeyboard';
import {
PanGestureHandler,
PanGestureHandlerGestureEvent,
State,
} from 'react-native-gesture-handler';
type EmojiPickerProps = {
isOpen: boolean;
onClose: () => void;
};
export const EmojiPicker = ({
onEmojiSelected,
isOpen,
onClose,
}: EmojiPickerProps & EmojiKeyboardProps) => {
const { height: screenHeight } = useWindowDimensions();
const offsetY = React.useRef(new Animated.Value(0)).current;
const height = React.useRef(new Animated.Value(screenHeight * 0.4)).current;
const handleGesture = ({
nativeEvent: { translationY, state },
}: PanGestureHandlerGestureEvent) => {
if (state === State.ACTIVE) {
offsetY.setValue(translationY);
}
if (state === State.END) {
// reset offset => return to current position
Animated.spring(offsetY, {
useNativeDriver: false,
toValue: 0,
}).start();
// slide => expand/collapse keyboard
if (translationY < -30) {
Animated.spring(height, {
useNativeDriver: false,
toValue: screenHeight * 0.8,
}).start();
} else if (translationY > 100) {
height.setValue(screenHeight * 0.4);
offsetY.setValue(0);
onClose();
} else {
Animated.spring(height, {
useNativeDriver: false,
toValue: screenHeight * 0.4,
}).start();
}
}
};
return (
<Modal visible={isOpen} animationType="slide" transparent={true}>
<SafeAreaView style={styles.modalContainer}>
<PanGestureHandler
onGestureEvent={handleGesture}
onHandlerStateChange={handleGesture}
>
<Animated.View style={styles.knob} />
</PanGestureHandler>
<Animated.View style={{ height: Animated.subtract(height, offsetY) }}>
<EmojiKeyboard
onEmojiSelected={(emoji) => {
height.setValue(screenHeight * 0.4);
offsetY.setValue(0);
onEmojiSelected(emoji);
onClose();
}}
containerStyles={styles.container}
/>
</Animated.View>
</SafeAreaView>
</Modal>
);
};
const styles = StyleSheet.create({
modalContainer: { flex: 1, justifyContent: 'flex-end' },
container: {
backgroundColor: '#fff',
borderRadius: 16,
shadowColor: 'black',
shadowOpacity: 0.15,
shadowOffset: { width: 0, height: 0 },
shadowRadius: 5,
},
knob: {
height: 8,
width: 50,
backgroundColor: '#fff',
marginBottom: 10,
alignSelf: 'center',
borderRadius: 4,
shadowColor: 'black',
shadowOpacity: 0.15,
shadowOffset: { width: 0, height: 0 },
shadowRadius: 5,
},
});

10
src/KeyboardContext.tsx Normal file
View File

@ -0,0 +1,10 @@
import * as React from 'react';
import type { EmojiType } from './types';
export const defaultKeyboardContext = {
onEmojiSelected: (_emoji: EmojiType) => {},
numberOfColumns: 7,
emojiSize: 24,
};
export const KeyboardContext = React.createContext(defaultKeyboardContext);

View File

@ -1 +0,0 @@
it.todo('write a test');

View File

@ -0,0 +1,72 @@
import * as React from 'react';
import { View, Animated, StyleSheet, FlatList } from 'react-native';
import { CATEGORIES, CATEGORIES_NAVIGATION, CategoryTypes } from '../types';
import { CategoryItem } from './CategoryItem';
type CategoriesProps = {
flatListRef: React.RefObject<FlatList>;
scrollNav: Animated.Value;
};
export const Categories = ({ flatListRef, scrollNav }: CategoriesProps) => {
const handleScrollToCategory = (category: CategoryTypes) => {
flatListRef?.current?.scrollToIndex({
index: CATEGORIES.indexOf(category),
});
};
return (
<View style={styles.bottomBar}>
<View style={styles.navigation}>
<FlatList
data={CATEGORIES_NAVIGATION}
keyExtractor={(item) => item.category}
renderItem={({ item }) => (
<CategoryItem
item={item}
handleScrollToCategory={handleScrollToCategory}
/>
)}
ItemSeparatorComponent={() => <View style={styles.separator} />}
scrollEnabled={false}
horizontal={true}
onScrollToIndexFailed={(e) => console.log(e)}
ListHeaderComponent={() => {
return (
<Animated.View
style={[styles.activeIndicator, { left: scrollNav }]}
/>
);
}}
/>
</View>
</View>
);
};
const styles = StyleSheet.create({
bottomBar: {
position: 'absolute',
bottom: 20,
left: 20,
right: 20,
alignItems: 'center',
},
navigation: {
backgroundColor: '#e3dbcd',
padding: 3,
borderRadius: 8,
},
separator: {
width: 1,
height: 28,
backgroundColor: '#00000011',
marginHorizontal: 4,
},
activeIndicator: {
position: 'absolute',
width: 28,
height: 28,
backgroundColor: 'white',
borderRadius: 6,
},
});

View File

@ -0,0 +1,31 @@
import * as React from 'react';
import { View, Text, StyleSheet, TouchableOpacity } from 'react-native';
import type { CategoryTypes } from '../types';
type CategoryItemProps = {
item: any;
handleScrollToCategory: (category: CategoryTypes) => void;
};
export const CategoryItem = ({
item,
handleScrollToCategory,
}: CategoryItemProps) => (
<TouchableOpacity onPress={() => handleScrollToCategory(item.category)}>
<View style={styles.container}>
<Text style={styles.icon}>{item.icon}</Text>
</View>
</TouchableOpacity>
);
const styles = StyleSheet.create({
container: {
width: 28,
height: 28,
justifyContent: 'center',
alignItems: 'center',
padding: 3,
borderRadius: 6,
},
icon: { textAlign: 'center' },
});

View File

@ -0,0 +1,72 @@
import * as React from 'react';
import {
StyleSheet,
View,
Text,
FlatList,
useWindowDimensions,
} from 'react-native';
import emojisByGroup from 'unicode-emoji-json/data-by-group.json';
import type { CategoryTypes, EmojiType } from 'src/types';
import { SingleEmoji } from './SingleEmoji';
import { KeyboardContext } from '../KeyboardContext';
export const EmojiCategory = ({ item }: { item: CategoryTypes }) => {
const { width } = useWindowDimensions();
const ctx = React.useContext(KeyboardContext);
const numberOfColumns = React.useRef<number>(
Math.floor(width / (ctx.emojiSize + 16))
);
const [data, setData] = React.useState<EmojiType[]>([]);
// console.log(width);
React.useEffect(() => {
const newData = emojisByGroup[item];
const fillWithEmpty = new Array(
numberOfColumns.current -
(emojisByGroup[item].length % numberOfColumns.current)
).fill('a');
setData([...newData, ...fillWithEmpty]);
}, [item]);
const getItemLayout = (_: EmojiType[] | null | undefined, index: number) => ({
length: ctx.emojiSize,
offset: ctx.emojiSize * Math.ceil(index / ctx.numberOfColumns),
index,
});
const renderItem = React.useCallback(
(props) => <SingleEmoji {...props} />,
[]
);
return (
<View style={[styles.container, { width: width }]}>
<Text style={styles.sectionTitle}>{item}</Text>
<FlatList
data={data}
keyExtractor={(emoji) => emoji.name}
numColumns={numberOfColumns.current}
renderItem={renderItem}
removeClippedSubviews={true}
getItemLayout={getItemLayout}
ListFooterComponent={() => <View style={styles.footer} />}
/>
</View>
);
};
const styles = StyleSheet.create({
container: {
flex: 1,
paddingHorizontal: 10,
marginTop: 12,
},
sectionTitle: {
opacity: 0.6,
marginBottom: 12,
marginLeft: 12,
},
footer: { height: 70 },
});

View File

@ -0,0 +1,22 @@
import * as React from 'react';
import { View, Text, TouchableOpacity, StyleSheet } from 'react-native';
import { KeyboardContext } from '../KeyboardContext';
import type { EmojiType } from '../types';
export const SingleEmoji = ({ item }: { item: EmojiType }) => {
const ctx = React.useContext(KeyboardContext);
return (
<TouchableOpacity
onPress={() => ctx.onEmojiSelected(item)}
style={styles.container}
>
<View>
<Text style={{ fontSize: ctx.emojiSize }}>{item.emoji}</Text>
</View>
</TouchableOpacity>
);
};
const styles = StyleSheet.create({
container: { flex: 1, padding: 8 },
});

View File

@ -1,5 +1,6 @@
export default {
multiply(a: number, b: number) {
return Promise.resolve(a * b);
},
};
import { EmojiKeyboard } from './EmojiKeyboard';
import { EmojiPicker } from './EmojiPicker';
export { EmojiKeyboard };
export default EmojiPicker;

57
src/types.ts Normal file
View File

@ -0,0 +1,57 @@
import type { ViewStyle } from 'react-native';
export type EmojiType = {
emoji: string;
emoji_version: string;
name: string;
skin_tone_support: boolean;
slug: string;
unicode_version: string;
};
export type CategoryTypes =
| 'Smileys & Emotion'
| 'People & Body'
| 'Animals & Nature'
| 'Food & Drink'
| 'Travel & Places'
| 'Activities'
| 'Objects'
| 'Symbols'
| 'Flags';
export const CATEGORIES: CategoryTypes[] = [
'Smileys & Emotion',
'People & Body',
'Animals & Nature',
'Food & Drink',
'Travel & Places',
'Activities',
'Objects',
'Symbols',
'Flags',
];
type CategoryNavigationItem = {
icon: string;
category: CategoryTypes;
};
export const CATEGORIES_NAVIGATION: CategoryNavigationItem[] = [
{ icon: '😀', category: 'Smileys & Emotion' },
{ icon: '👋', category: 'People & Body' },
{ icon: '🐵', category: 'Animals & Nature' },
{ icon: '🍇', category: 'Food & Drink' },
{ icon: '🌍', category: 'Travel & Places' },
{ icon: '🎃', category: 'Activities' },
{ icon: '👓', category: 'Objects' },
{ icon: '🏧', category: 'Symbols' },
{ icon: '🏁', category: 'Flags' },
];
export type EmojiKeyboardProps = {
onEmojiSelected: (emoji: EmojiType) => void;
containerStyles?: ViewStyle;
numberOfColumns?: number;
emojiSize?: number;
};

9604
yarn.lock Normal file

File diff suppressed because it is too large Load Diff