Skip to content
This repository has been archived by the owner on Jan 3, 2024. It is now read-only.

convert testID to string to avoid android crash #4

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { Platform } from 'react-native'

export default function testID(id) {
id = typeof id !== 'string' ? id + '' : id; // fix android crash, when id is number
return Platform.OS === 'android' ?
{ accessible: true, accessibilityLabel: id } :
{ testID: id }
Expand Down