Skip to content

Commit 49b2b4e

Browse files
committed
refactor: simplify ios/android key checks
1 parent 9864fb9 commit 49b2b4e

File tree

1 file changed

+2
-11
lines changed

1 file changed

+2
-11
lines changed

packages/runtime/src/runtimeHelpers.ts

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,8 @@
11
export const ELEMENT_REF = Symbol(__DEV__ ? `elementRef` : ``)
22

3-
export const isAndroidKey = (key: string) =>
4-
key[0] === 'a' &&
5-
key[1] === 'n' &&
6-
key[2] === 'd' &&
7-
key[3] === 'r' &&
8-
key[4] === 'o' &&
9-
key[5] === 'i' &&
10-
key[6] === 'd' &&
11-
key[7] === ':'
3+
export const isAndroidKey = (key: string) => key.startsWith('android:')
124

13-
export const isIOSKey = (key: string) =>
14-
key[0] === 'i' && key[1] === 'o' && key[2] === 's' && key[3] === ':'
5+
export const isIOSKey = (key: string) => key.startsWith('ios:')
156

167
export const isBoolean = (value: unknown): boolean => {
178
return typeof value === 'boolean' || value instanceof Boolean

0 commit comments

Comments
 (0)