@screeb/react-native 2.0.20 → 2.0.21
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.
- package/ios/ScreebModule.swift +23 -15
- package/package.json +1 -1
package/ios/ScreebModule.swift
CHANGED
|
@@ -149,22 +149,30 @@ class ScreebModule: RCTEventEmitter {
|
|
|
149
149
|
}
|
|
150
150
|
}
|
|
151
151
|
|
|
152
|
-
private func mapToAnyEncodable(map: [String: Any]) -> [String: AnyEncodable?] {
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
152
|
+
private func mapToAnyEncodable(map: [String: Any?]?) -> [String: AnyEncodable?] {
|
|
153
|
+
var anyEncodableMap: [String: AnyEncodable?] = [:]
|
|
154
|
+
map?.forEach { key, value in
|
|
155
|
+
if let nsValue = value as? NSNumber {
|
|
156
|
+
if CFBooleanGetTypeID() == CFGetTypeID(nsValue) {
|
|
157
|
+
anyEncodableMap[key] = AnyEncodable(nsValue.boolValue)
|
|
158
|
+
} else if let value = value as? Int {
|
|
159
|
+
anyEncodableMap[key] = AnyEncodable(value)
|
|
160
|
+
} else if let value = value as? Double {
|
|
161
|
+
anyEncodableMap[key] = AnyEncodable(value)
|
|
162
|
+
} else if let value = value as? Float {
|
|
163
|
+
anyEncodableMap[key] = AnyEncodable(value)
|
|
164
|
+
} else {
|
|
165
|
+
anyEncodableMap[key] = nil
|
|
166
|
+
}
|
|
167
|
+
} else if let value = value as? String {
|
|
168
|
+
anyEncodableMap[key] = AnyEncodable(value)
|
|
169
|
+
} else if let value = value as? [String: Any?] {
|
|
170
|
+
anyEncodableMap[key] = AnyEncodable(self.mapToAnyEncodable(map: value))
|
|
171
|
+
} else {
|
|
172
|
+
anyEncodableMap[key] = nil
|
|
173
|
+
}
|
|
167
174
|
}
|
|
175
|
+
return anyEncodableMap
|
|
168
176
|
}
|
|
169
177
|
|
|
170
178
|
override func supportedEvents() -> [String]! {
|