Fix iOS 12 haptics crash

This commit is contained in:
Zhiyuan Zheng 2021-12-31 15:37:36 +01:00
parent b08e24e233
commit cb46dedd71
2 changed files with 4 additions and 1 deletions

View File

@ -33,7 +33,7 @@ jobs:
run: bundle install
- name: -- Step 7 -- Run fastlane
env:
DEVELOPER_DIR: /Applications/Xcode_13.0.app/Contents/Developer
DEVELOPER_DIR: /Applications/Xcode_13.2.1.app/Contents/Developer
ENVIRONMENT: ${{ steps.branch.outputs.branch }}
LC_ALL: en_US.UTF-8
LANG: en_US.UTF-8

View File

@ -4,6 +4,9 @@ import { Platform } from 'react-native'
const haptics = (
type: 'Success' | 'Warning' | 'Error' | 'Light' | 'Medium' | 'Heavy'
) => {
if (Platform.OS === 'ios' && parseInt(Platform.Version, 10) <= 12) {
return
}
if (Platform.OS === 'android') {
if (type === 'Error') {
Haptics.impactAsync(Haptics.ImpactFeedbackStyle['Light']).catch(() => {})