Skip to content
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

Specific development only for electron platform like web/android/ios #79

Open
alexis-regnaud opened this issue May 2, 2019 · 6 comments

Comments

@alexis-regnaud
Copy link

alexis-regnaud commented May 2, 2019

Is there a way to do a specific development only for electron device ? Use file.electron.js and the object Platform.select({electron: .... }), same to .ios / .android / .web

Thansk in advance !

@alexis-regnaud alexis-regnaud changed the title Specific development only for electron device like web/android/ios Specific development only for electron platform like web/android/ios May 2, 2019
@piranna
Copy link
Collaborator

piranna commented May 2, 2019

Electron platform is just web platform displayed inside Electron, so the platform is web. Why do you want to have a specific electron platform? Can't you be able to detect it as if it were another web browser? Maybe with presence of some Electron-only APIs?

@alexis-regnaud
Copy link
Author

Thank for your answer, just to know if it was possible to do that (with same logical that .web, .android, .ios => .electron)
Specifically I had a problem with the navigation because I use "react-navigation" to mobile case and "react-router-dom" to web and electron cases. Except that web need BrowserRouter and electron need HashRouter, but I solve my problem with a conditional test with the help of "is-electron" lib.

@piranna
Copy link
Collaborator

piranna commented May 6, 2019

Thank for your answer, just to know if it was possible to do that (with same logical that .web, .android, .ios => .electron)

Technically it's possible, but I don't know how to register the .electron prefix to use it when generating for Electron platform, and more specially if it's just web platform packaged inside Electron.

Specifically I had a problem with the navigation because I use "react-navigation" to mobile case and "react-router-dom" to web and electron cases.

Why don't you use react-router-native for mobile? The re-start_router template has already an example how to unify both APIs...

Except that web need BrowserRouter and electron need HashRouter, but I solve my problem with a conditional test with the help of "is-electron" lib.

Is that true? I didn't have any problem with default BrowserRouter in Electron...

@alexis-regnaud
Copy link
Author

alexis-regnaud commented May 6, 2019

Why don't you use react-router-native for mobile? The re-start_router template has already an example how to unify both APIs...

Because I think that "react-navigation" have a better approach to mobile UI (Native design according to platform, respect of safe area, ...). "react-router-native" work but have a web approach.

Is that true? I didn't have any problem with default BrowserRouter in Electron...

If I use BrowserRouter only, in the Electron view I see the navbar but there is no action when I click on link (Router content doesn't change). And with BrowserRouter in web and HashRouter in Electron, it works..

@piranna
Copy link
Collaborator

piranna commented May 6, 2019

If I use BrowserRouter only, in the Electron view I see the navbar but there is no action when I click on link (Router content doesn't change).

Does it shows the navbar? It shouldn't... anyway, you should not touch the navbar at all...

@alexis-regnaud
Copy link
Author

Yes there is the navbar but whatever the url (ex /first-page, /second-page, /third-page ,...), it's always the first screen define wich is display in the router content.
Here there is the same problem with the solution that I used : how-to-use-react-router-with-electron

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants