0.0.1 • Published 2 years ago
react-native-mway_sdk_rnative v0.0.1
React Native MWN SDK Library
The React Native MWN SDK Library provides a button component that allows you to open a MWN dashboards within your React Native application. This library simplifies the process of integrating the MWN SDK into your React Native projects.
Installation
Use npm or yarn to install the library:
npm install react-native-mway_sdk_rnative
or
yarn add react-native-mway_sdk_rnative
Usage
- Configure .env
REACT_APP_MWN_CLIENT_SSID=""
REACT_APP_MWN_CLIENT_SECRET=""
- Import the
MWNLauncher
component anduseMWN
hook from the library:
import { MWNLauncher, useMWN } from 'react-native-mway_sdk_rnative';
- Use the
MWNLauncher
component in your app:
// interface IMWNButton {
// style: {};
// text?: string;
// }
// interface IMWNConfig {
// ssid: string;
// secret: string;
// button?: IMWNButton;
// onStart?: () => {};
// onSuccess?: () => {};
// onError?: () => {};
// }
export default function App() {
let [config, mwnOpts] = useMWN({
ssid: process.env.REACT_APP_MWN_CLIENT_SSID,
secret: process.env.REACT_APP_MWN_CLIENT_SECRET,
});
const { loading, success, error, errorMsg, retry } = mwnOpts;
return (
<View style={styles.container}>
{loading && <p>Loading mwn launcher...</p>}
{success && <MWNLauncher config={config} />}
{error && <p>Error : {errorMsg} </p>}
</View>
);
}
The MWNLauncher
component accepts the following props:
config
(object): Button Configuration.
Make sure to adjust the styles and positioning of the component according to your application's layout requirements.
Compatibility
The React Native MWN SDK Library is compatible with both Android and iOS platforms.
License
This library is released under a custom EULA License.
Contributing
Contributions are welcome! If you have any suggestions, bug reports, or feature requests, please open an issue on the GitHub repository.