Core platform abstractions for React Native Harness
npm install @react-native-harness/platforms[![mit licence][license-badge]][license]
[![npm downloads][npm-downloads-badge]][npm-downloads]
[![Chat][chat-badge]][chat]
[![PRs Welcome][prs-welcome-badge]][prs-welcome]
Core platform abstractions for React Native Harness - provides the base types and factory functions for creating platform implementations.
``bash`
npm install @react-native-harness/platformsor
pnpm add @react-native-harness/platformsor
yarn add @react-native-harness/platforms
This package provides the core abstractions for creating platform implementations. It's typically used by platform-specific packages rather than directly by end users.
`typescript
import { createHarnessPlatform } from '@react-native-harness/platforms';
const platform = createHarnessPlatform({
name: 'my-platform',
getInstance: async () => ({
startApp: async () => {
/ implementation /
},
restartApp: async () => {
/ implementation /
},
stopApp: async () => {
/ implementation /
},
dispose: async () => {
/ implementation /
},
}),
});
`
Creates a new harness platform instance.
Parameters:
- params.name - Unique name for the platformparams.getInstance
- - Function that returns a platform instance
Returns: HarnessPlatform
Core platform interface.
Properties:
- name - Platform namegetInstance()
- - Returns a platform instance
Platform instance interface with lifecycle methods.
Methods:
- startApp() - Starts the applicationrestartApp()
- - Restarts the applicationstopApp()
- - Stops the applicationdispose()
- - Cleans up resources
#### AppNotInstalledError
Thrown when an app is not installed on a device.
Properties:
- bundleId - The bundle ID that wasn't founddeviceName
- - The device name
#### DeviceNotFoundError
Thrown when a device is not found.
Properties:
- deviceName - The device name that wasn't found
- TypeScript support
- Node.js runtime
MIT
react-native-harness` is an open source project and will always remain free to use. If you think it's cool, please star it 🌟. [Callstack][callstack-readme-with-love] is a group of React and React Native geeks, contact us at hello@callstack.com if you need any help with these or just want to say hi!
Like the project? ⚛️ Join the team who does amazing stuff for clients and drives React Native Open Source! 🔥
[callstack-readme-with-love]: https://callstack.com/?utm_source=github.com&utm_medium=referral&utm_campaign=react-native-harness&utm_term=readme-with-love
[license-badge]: https://img.shields.io/npm/l/react-native-harness?style=for-the-badge
[license]: https://github.com/callstackincubator/react-native-harness/blob/main/LICENSE
[npm-downloads-badge]: https://img.shields.io/npm/dm/react-native-harness?style=for-the-badge
[npm-downloads]: https://www.npmjs.com/package/react-native-harness
[prs-welcome-badge]: https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=for-the-badge
[prs-welcome]: ./CONTRIBUTING.md
[chat-badge]: https://img.shields.io/discord/426714625279524876.svg?style=for-the-badge
[chat]: https://discord.gg/xgGt7KAjxv