achive-mx-explorer v0.0.16
Achive MX Explorer
achive-mx-explorer
is a React Native module that provides the MXWidget component for easy integration of MX web views and context-driven API interactions into your React Native projects.
Installation
Install via NPM
If the package is published on npm, you can install it directly by running:
npm install achive-mx-explorer
Local Installation (before publishing to npm)
If you’re using the package locally (for testing before publishing it to npm), you can install it like this:
- In the achive-mx-explorer directory, create a .tgz file by running:
npm pack
- Move the .tgz file to your other project and install it:
npm install ./path-to/achive-mx-explorer-0.0.1.tgz
Note: You do not need to build the package yourself. The necessary files will already be included in the dist folder when you install the package.
Usage
Once installed, you can import and use the MXWidget component in your project by passing the accessToken like this:
Example
import React from 'react';
import { View } from 'react-native';
import { MXWidget } from 'achive-mx-explorer';
const App = () => {
const accessToken = 'your-access-token';
return (
<View style={{ flex: 1 }}>
<MXWidget accessToken={accessToken} />
</View>
);
};
export default App;
Props
• accessToken (string) - The access token required to authenticate API requests in the MX widget.
Optional: Context Usage
If your MXWidget depends on a context to pass the access token, you can wrap the widget in the relevant context provider:
import React from 'react';
import { WebViewContext } from 'achive-mx-explorer';
import { MXWidget } from 'achive-mx-explorer';
const App = () => {
const accessToken = 'your-access-token';
return (
<WebViewContext.Provider value={{ accessToken }}>
<MXWidget />
</WebViewContext.Provider>
);
};
export default App;
Development
Building the Package
If you are the developer working on the package, you can build the project to generate the dist/ folder by running:
npm run build
This compiles the TypeScript files into JavaScript for distribution.
License
This project is licensed under the MIT License.