-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
react native support #1112
Comments
You can build TDLib for any platform that is supported by React Native. You need just to load and use the prebuilt shared library in React Native project. |
not seeing anything that is supporting for react-native |
You need to just wrap TDLib JSON interface, containing only 5 methods in pure C, using Native module: https://reactnative.dev/docs/native-modules-android.html. |
Sorry for silly question. What exactly I need to wrap ? |
@Ilya93 TDLib JSON interface: https://github.com/tdlib/td/blob/master/td/telegram/td_json_client.h. |
@ajai06 reach out to me I have a full fledged react native component working for both android and ios |
I'm also looking to build a react-native app using the telegram API, though I'm having trouble finding many resources for help. I've successfully built tdlib for node.js, but I'm unsure what to do from here. I'm still fairly new to this stuff, so if anyone has any tips id greatly appreciate it! |
if you want to work with nodejs i can recommend you to use https://github.com/airgram/airgram. |
Thanks for the response @jumoog, I'm actually already using Airgram, but I can't figure out how to integrate it with my react-native project. This is what I have so far:
I can log in with my telegram account and make API calls, but I don't know where to begin with react-native. My understanding of node and server-side programming is quite limited, so I'm really lost at this point. Am I supposed to create and express server and make calls to my API instance? How would I get real-time updates to my react-native app? I have too many questions and barely any answers, I can hardly find anything online. If you have any additional information please let me know, thanks! |
hello @AndrewEyesman, how have you made airgram js work for you? I passed the tdlib folder to my node project and entered the path in C:\Users\Oscar Humberto\Desktop\javascript\telenode\node_modules\airgram\node_modules\ffi-napi\lib\dynamic_library.js:75 Error: Dynamic Linking Error: Win32 error 126 |
@ymsstudios @xvitaly I would have to do some work to open source the implementation as I have not added any examples to it. If you guys are interested and ready to contribute we can work towards taking it out as open source we would need to add test cases and some use case example |
@ymsstudios @xvitaly if you guys want I can setup and initial meeting or add a slack or gitter to kick start this |
@vidit-bhatia I just did some research regarding react-native and tdlib and stumbled upon this issue. Did you already kick-start anything or have a repo/slack/gitter set up? Your progress sounds awesome! 👏 @zaunermax and me are currently trying to build a minimal RN telegram client and might be able to help to add examples or tests. |
Hey @oscar-rey-mosquera sorry for the late response. I honestly can't remember exactly what I did to get it working. Have you tried installing
|
@bemayr I added you guys a to a gitter workspace to initiate the discussion around this |
@vidit-bhatia @bemayr Hey guys, I find myself in a similar situation where I need to use TDLib with React Native. Will the approach discussed above work on both Android and iOS? Or only Android? |
Hi @rashadg1030, I did not try the solution above yet so sadly I can't say whether it will work or not. But @vidit-bhatia, are there any updates on on your project or gitter.im? Thanks in advance! |
Hi @vidit-bhatia @bemayr, Can you please show me some example repo, how can I use TDlib in a react-native project? |
Hi @ankitjain-1, unfortunately I didn't get any response from @vidit-bhatia and didn't have the time to continue with this project, but if I get back to it, I will ping you 👌 |
Has anyone found out how to make it work? |
Bring me on board please |
I don't have much experience in React Native, but here's probably what you need to do. Get compiled TDLib
Link libraries to your native iOS & Android appsMake sure to have pre-generated
Connect libraries to ReactNative via native modules
For async code with Use TDLib in your ReactNative (JS) codeYou will get something like this after Native module setup. const {
TDLibModule
} = ReactNative.NativeModules;
// Sync code
var client = TDLibModule.td_json_client_create();
var tdlibResponse = TDLibModule.td_json_client_execute(client, {
"@type": "getTextEntities",
"text": "@telegram /test_command https://telegram.org telegram.me",
"@extra": ["5", 7.0, "\\u00e4"]
});
console.log(`Response from TDLib ${tdlibResponse}`);
// Async Code
TDLibModule.td_json_client_send({
"@type": "setTdlibParameters",
"parameters": {
"database_directory": "tdlib",
"use_message_database": true,
"use_secret_chats": true,
"api_id": 94575,
"api_hash": "a3406de8d171bb422bb6ddf3bbd800e2",
"system_language_code": "en",
"device_model": "mobile",
"application_version": "1.0",
"enable_storage_optimizer": true
}
}
(jsonResponse) => {
console.log(`Response from TDLib ${responseJson}`);
}
); Well, it's not very trivial, but still possible. |
is there any support or package for react-native ?
The text was updated successfully, but these errors were encountered: