azure-sdk-for-js icon indicating copy to clipboard operation
azure-sdk-for-js copied to clipboard

React-Native support

Open jeremymeng opened this issue 3 years ago • 4 comments

This tracks investigation and development towards supporting React Native in JS SDK libraries. Work includes

  • Necessary SDK code changes
  • Samples and documentation for customer

jeremymeng avatar Mar 11 '22 17:03 jeremymeng

Label prediction was below confidence level 0.6 for Model:ServiceLabels: 'Cosmos:0.2598161,Storage:0.17497268,Azure.Core:0.08992475'

azure-sdk avatar Mar 11 '22 17:03 azure-sdk

Hi all,

I'm not sure why there hasn't been any development on that. RN is now so widespread that that would make perfect sense.

In my current project, I have to implement nodejs-mobile-react-native just to get @azure/identity working.

I really hope there will be much interest in this integration.

dittmarconsulting avatar Mar 24 '22 21:03 dittmarconsulting

@dittmarconsulting thank you for the interests! I am looking into this, currently investigating what's needed to be able to use @azure/app-configuration package in react-native.

Thank you for the pointer to nodejs-mobile-react-native. Would you mind explaining in more details what the package does and how you use it with @azure/identity?

jeremymeng avatar Mar 25 '22 16:03 jeremymeng

Hi @jeremymeng,

Sorry for the delay.

I have successfully integrated azure-iot-device-mqtt and azure-iot-device into my RN app by installing nodejs-mobile-react-native.

It creates a NodeJS environment within the RN app including its own node_modules folder and package.json file.

The entry point is the main.js file where I hooked up the iot stuff because it's a node env like that

rn_bridge.channel.on('send-image-data', dataObj => {
  const data = JSON.stringify({
    ...dataObj,
    deviceId: 'iot-nextjs',
  });
  const message = new Message(data);
  mqttClient.sendEvent(message, error => {
    if (error) {
      rn_bridge.channel.post('system-message', `Send error ${error}`);
      return;
    }
    rn_bridge.channel.post('system-message', 'Message sent!');
  });
});

The only downside is the app size that will include the extra size of the node_modules folder but I think that can be managed by removing unused modules and some build tool to convert the packages into one small JS file.

I hope that helps.

dittmarconsulting avatar Apr 02 '22 06:04 dittmarconsulting

Hi @jeremymeng, we deeply appreciate your input into this project. Regrettably, this issue has remained inactive for over 2 years, leading us to the decision to close it. We've implemented this policy to maintain the relevance of our issue queue and facilitate easier navigation for new contributors. If you still believe this topic requires attention, please feel free to create a new issue, referencing this one. Thank you for your understanding and ongoing support.

github-actions[bot] avatar Apr 19 '24 18:04 github-actions[bot]