Skip to content

Commit 70d7fb1

Browse files
committed
🎉 Add support for Expo SDK 48+
1 parent 0a48c10 commit 70d7fb1

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

index.js

+7
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,13 @@ function getRandomValues (array) {
4949
throw new QuotaExceededError('Can only request a maximum of 65536 bytes')
5050
}
5151

52+
// Expo SDK 48+
53+
if (global.expo && global.expo.modules && global.expo.modules.ExpoCrypto && global.expo.modules.ExpoCrypto.getRandomValues) {
54+
// ExpoCrypto.getRandomValues doesn't return the array
55+
global.expo.modules.ExpoCrypto.getRandomValues(array)
56+
return array
57+
}
58+
5259
// Calling getRandomBase64 in debug mode leads to the error
5360
// "Calling synchronous methods on native modules is not supported in Chrome".
5461
// So in that specific case we fall back to just using Math.random.

0 commit comments

Comments
 (0)