-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support for using sdk in React-Native #5771
Comments
Thanks for reporting @ehvattum Can you elaborate on the kind of incompatible dependencies that you have encountered when using the libraries that depend on Or if you can point us to a sample app using react-native and say the blob library with steps to replicate the problem, that would be helpful too. |
@ramya-rao-a Issue updated: This is a related issue: #4917 - mentions xmlbuilder and xml2js as examples. |
Is there any updates/plans on this issue ? |
@AndriiDidkivsky sorry we don't have any concrete plan yet on the timeline. We know that one of our dependencies |
I am receiving this error while bundling the react native project. Sharing this as it may help for integration.
|
@jeremymeng Is there any new update? I saw it was tagged with milestones. |
I've been investigating what it would take to support react native with our SDKs today and with some changes I've been able to use some Here's what I've found so far. package.json#react-native fieldThe react native bundler (metro) respects the {
"react-native": {
"./dist/index.js": "./dist-esm/src/index.js"
}
} Lack of Node.js and Browser APIsreact native uses JavaScriptCore for executing JavaScript code, and includes shims for a few APIs like This means we really need to treat react native as a 3rd runtime, and many places where we have cryptoThe DOMParserReact Native doesn't provide a way to build or parse XML. In node.js we use I did find another library - base64React Native doesn't include a utility to do base64 encoding/decoding (e.g. atob/btoa). It appears that they used to have a utility package that was removed sometime prior to 0.60.x. Lack of some language-level featuresfor...awaitThe react-native toolchain handles TypeScript compilation itself. AuthenticationCurrently the credentials available in It is possible to use the Rough example: import { authorize } from "react-native-app-auth";
import { TokenCredential } from "@azure/core-auth";
export class ReactNativeAadTokenCredential implements TokenCredential {
constructor(private clientId: string, private redirectUrl: string, private tenant: string) {}
getToken(scopes: string | string[]) {
if (!Array.isArray(scopes)) {
scopes = [scopes];
}
return authorize({
clientId: this.clientId,
redirectUrl: this.redirectUrl,
issuer: `https://login.microsoftonline.com/${tenant}/v2.0`,
scopes: scopes,
}).then((result) => {
const expiry = new Date(result.accessTokenExpirationDate).getTime();
return {
token: result.accessToken,
expiresOnTimestamp: expiry,
};
});
}
} AMQPCurrently the biggest blocker for AMQP-based services (service-bus/event-hubs) is lack of react-native support in |
@egemenuzunali just an update. I am waiting for the work to move app-configuration to our newer version of core libraries ##15809 first which should remove the need of hacky workaround. I should have an update before April. |
@jeremymeng Thanks a lot for the update 👍 , looking forward to taking it for a spin here at the Municipality of Amsterdam. |
Some (late) updates: at this time, I was able to run some samples of Storage blob/file share/file datalake/queue, Text Analytics, App Configuration, Data Tables in a React Native Expo project on the Android Emulator. Connection Strings/keys are used in testing. @azure/identity does not work at the moment. However, if an AAD access token is available via third party plugins/libraries, they can be used via a wrapper credential that implements the For reference, if anyone is interested to give a try:
import 'react-native-url-polyfill/auto';
import "react-native-get-random-values";
import "text-encoding-polyfill";
const getRandomValues = global.crypto.getRandomValues;
import * as crypto from "isomorphic-webcrypto";
global.crypto = crypto;
global.crypto.getRandomValues = getRandomValues;
"dependencies": {
"@azure/ai-text-analytics": "5.2.0-beta.2",
"@azure/app-configuration": "1.4.0-beta.1",
"@azure/data-tables": "13.1.2-alpha.20220503.1",
"@azure/storage-blob": "12.10.0",
"@azure/storage-file-datalake": "12.9.0",
"@azure/storage-file-share": "12.10.0",
"@azure/storage-queue": "12.9.0",
"@types/react": "^17.0.43",
"@types/react-native": "^0.67.3",
"babel-plugin-inline-dotenv": "^1.7.0",
"expo": "~44.0.0",
"expo-status-bar": "~1.2.0",
"isomorphic-webcrypto": "^2.3.8",
"react": "17.0.1",
"react-dom": "17.0.1",
"react-native": "0.64.3",
"react-native-get-random-values": "~1.7.0",
"react-native-url-polyfill": "^1.3.0",
"react-native-web": "0.17.1",
"text-encoding-polyfill": "^0.6.7"
},
"devDependencies": {
"@babel/core": "^7.12.9",
"@babel/plugin-proposal-async-generator-functions": "^7.16.8",
"stream": "^0.0.2",
"timers": "^0.1.1"
},
module.exports = function(api) {
api.cache(true);
return {
presets: ["babel-preset-expo"],
plugins: [
"@babel/plugin-proposal-async-generator-functions",
["inline-dotenv", { unsafe: true }],
],
};
}; |
@prakashbask @egemenuzunali Please see this PR for a react-native (Expo) sample of using AppConfig SDK #21907 |
any news? thank you |
@yahorsi which package(s) are you trying to use in react-native? |
Update: I just merged PR #23610, which adds a sample showing Event Hubs and Service Bus JS SDK usage in React-Native. Now we have samples show the usage of
|
Great, will check and migrate to SDK in the next App release if everything is ok |
Hi @ehvattum, 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. |
My issue is regards to blob storage, but is suspect the issue is universal to the sdk.
It is impossible to use this client, or to generate a working client from the spec that can run in react native.
There are always incompatible dependencies included, especially from this projects' core-http.
Compounding the problem: the spec is not valid swagger, so using a different generator does not work at all.
Updates:
The text was updated successfully, but these errors were encountered: