expo-native-sheet-emojis 2.0.2 → 2.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -72,36 +72,62 @@ class EmojiCategoryStrip: UIView, UICollectionViewDataSource, UICollectionViewDe
|
|
|
72
72
|
func updateCategories(_ keys: [String]) {
|
|
73
73
|
categoryKeys = keys
|
|
74
74
|
selectedIndex = 0
|
|
75
|
-
|
|
75
|
+
reloadCategories()
|
|
76
76
|
}
|
|
77
77
|
|
|
78
78
|
func applyTheme(_ theme: EmojiSheetTheme) {
|
|
79
79
|
currentTheme = theme
|
|
80
80
|
backgroundColor = theme.categoryBarBackgroundColor
|
|
81
81
|
dividerLine.backgroundColor = theme.dividerColor
|
|
82
|
-
|
|
82
|
+
reloadCategories()
|
|
83
83
|
}
|
|
84
84
|
|
|
85
85
|
func applyLayoutDirection(_ attribute: UISemanticContentAttribute) {
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
86
|
+
UIView.performWithoutAnimation {
|
|
87
|
+
semanticContentAttribute = attribute
|
|
88
|
+
collectionView.semanticContentAttribute = attribute
|
|
89
|
+
collectionView.collectionViewLayout.invalidateLayout()
|
|
90
|
+
collectionView.layoutIfNeeded()
|
|
91
|
+
}
|
|
89
92
|
}
|
|
90
93
|
|
|
91
94
|
func selectCategory(at index: Int) {
|
|
92
95
|
guard !isSearchActive, index != selectedIndex, index >= 0, index < categoryKeys.count else { return }
|
|
93
96
|
selectedIndex = index
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
at: IndexPath(item: index, section: 0),
|
|
97
|
-
at: .centeredHorizontally,
|
|
98
|
-
animated: true
|
|
99
|
-
)
|
|
97
|
+
reloadCategories()
|
|
98
|
+
scrollToCategoryIfNeeded(at: index)
|
|
100
99
|
}
|
|
101
100
|
|
|
102
101
|
func setSearchActive(_ active: Bool) {
|
|
103
102
|
isSearchActive = active
|
|
104
|
-
|
|
103
|
+
reloadCategories()
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
private func reloadCategories() {
|
|
107
|
+
UIView.performWithoutAnimation {
|
|
108
|
+
collectionView.reloadData()
|
|
109
|
+
collectionView.layoutIfNeeded()
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
private func scrollToCategoryIfNeeded(at index: Int) {
|
|
114
|
+
guard index >= 0, index < categoryKeys.count else { return }
|
|
115
|
+
|
|
116
|
+
let indexPath = IndexPath(item: index, section: 0)
|
|
117
|
+
guard let attributes = collectionView.layoutAttributesForItem(at: indexPath) else {
|
|
118
|
+
return
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
let visibleBounds = CGRect(origin: collectionView.contentOffset, size: collectionView.bounds.size)
|
|
122
|
+
guard !visibleBounds.contains(attributes.frame) else {
|
|
123
|
+
return
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
collectionView.scrollToItem(
|
|
127
|
+
at: indexPath,
|
|
128
|
+
at: .centeredHorizontally,
|
|
129
|
+
animated: false
|
|
130
|
+
)
|
|
105
131
|
}
|
|
106
132
|
|
|
107
133
|
// MARK: - UICollectionViewDataSource
|
|
@@ -134,7 +160,7 @@ class EmojiCategoryStrip: UIView, UICollectionViewDataSource, UICollectionViewDe
|
|
|
134
160
|
func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
|
|
135
161
|
selectedIndex = indexPath.item
|
|
136
162
|
isSearchActive = false
|
|
137
|
-
|
|
163
|
+
reloadCategories()
|
|
138
164
|
delegate?.categoryStrip(self, didSelectCategoryAt: indexPath.item)
|
|
139
165
|
}
|
|
140
166
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Pod::Spec.new do |s|
|
|
2
2
|
s.name = 'EmojiSheetModule'
|
|
3
|
-
s.version = '2.0.
|
|
3
|
+
s.version = '2.0.3'
|
|
4
4
|
s.summary = 'Native emoji picker bottom sheet for React Native'
|
|
5
5
|
s.description = 'A fully native iOS/Android emoji picker presented in a bottom sheet with search, skin tones, and theming support.'
|
|
6
6
|
s.author = ''
|
|
@@ -96,6 +96,15 @@ public class EmojiSheetModule: Module {
|
|
|
96
96
|
// MARK: - Presentation via dedicated UIWindow
|
|
97
97
|
|
|
98
98
|
private func presentSheet(options: [String: Any], promise: Promise) {
|
|
99
|
+
guard currentPromise == nil, sheetViewController == nil else {
|
|
100
|
+
promise.resolve(["cancelled": true])
|
|
101
|
+
return
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
if overlayWindow != nil {
|
|
105
|
+
tearDownWindow()
|
|
106
|
+
}
|
|
107
|
+
|
|
99
108
|
guard let windowScene = UIApplication.shared.connectedScenes
|
|
100
109
|
.compactMap({ $0 as? UIWindowScene })
|
|
101
110
|
.first(where: { $0.activationState == .foregroundActive })
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "expo-native-sheet-emojis",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.3",
|
|
4
4
|
"description": "A fully native emoji picker bottom sheet for React Native. Built with Swift and Kotlin for maximum performance. Features search with multilingual keywords, skin tones, frequently used tracking, theming, and configurable layout.",
|
|
5
5
|
"main": "lib/commonjs/index.js",
|
|
6
6
|
"module": "lib/module/index.js",
|