Skip to content

Commit

Permalink
add useIsEmulator
Browse files Browse the repository at this point in the history
  • Loading branch information
acro5piano authored and mikehardy committed Nov 3, 2019
1 parent a92997c commit 796035e
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
15 changes: 15 additions & 0 deletions README.md
Expand Up @@ -1548,6 +1548,21 @@ const { loading, result } = useHasSystemFeature('amazon.hardware.fire_tv'); // {
<Text>{loading ? 'loading...' : result}</Text>;
```
### useIsEmulator
Get whether the application is running in an emulator.
#### Example
```jsx
import { useIsEmulator } from 'react-native-device-info';

const { loading, result } = useDeviceName(); // { loading: true, result: false }

<Text>{loading ? 'loading...' : result}</Text>;
```
---
=======
## Native interoperatibily
Expand Down
5 changes: 5 additions & 0 deletions src/index.ts
Expand Up @@ -1259,6 +1259,10 @@ export function useHasSystemFeature(feature: string): AsyncHookResult<boolean> {
return useOnMount(asyncGetter, false);
}

export function useIsEmulator(): AsyncHookResult<boolean> {
return useOnMount(isEmulator, false);
}

export default {
getUniqueId,
getInstanceId,
Expand Down Expand Up @@ -1381,4 +1385,5 @@ export default {
useFirstInstallTime,
useDeviceName,
useHasSystemFeature,
useIsEmulator,
};

0 comments on commit 796035e

Please sign in to comment.