React Native: Change the default language used in permission requests and alerts - react-native

I am developing an app in React Native and want to change the default language across the whole app. More specifically, I want to localize the language used in system-generated alerts, e.g. permission request for push notification, permission request for camera roll access, etc.
Existing libararies, e.g., react-native-localize, let me localize the texts in components, but I do not think there is a way to set up the default language to display the system-generated alerts in those libraries.
Is there a way to do this in react native?
Thanks a lot in advance!

Related

React native share:-how to use share functionality with different message for different app

I have a requirement in share functionality in which i want to share different different messages for facebook twitter and other apps. But in react native share i have only one message variable in which we pass the data. Can anyone help me about how to pass different message in different apps. Like how i can identify that facebook is selected or twitter is selecr or other app is selected and then send specific message to. That app in react native.
Please help me i am new to react native. It will be a great help.

Is there a way to get app which set as default in React Native

Is there a way in React Native to find out, for example, which map app, browser, or whatever user has set by default on his device?
As we mentioned in the comments, opening apps from the phone can be handled by Linking

Website replicating in React Native, WebView vs code, notifications needed

first time asking here as i am looking for some guidance before i start coding.
I have been developing websites mostly in PHP/MySQL/Jquery for years. As I was requested to port a website to an app, I selected React Native in order not to learn 2 different languages for IOS-Android.
I subscribed to some react native lessons, as I found it very clear and fun to follow, and it indeed is.
But here I am finding that to replicate the website is a truly difficult task for me. A temporary version exists at https://app.thallo.care/app.php?language=en (view on mobile if you like). There are many fixed positioned things and floating menus that i cannot easily program on react native.
I tried webview, it works wonderfully, but i am not positive i will be able to implement notifications the way i want to, or custom app styling with inject javascript i am unsure it will work.
The only app difference comparing to the desktop version, is that the user will receive notifications. The website will have a calendar where he will add events, and i need to send notifications to the user device on the event datetime that he has set.
Now the question... Should i use webview and manage notifications on a third party app like amazon SNS or anything else, will i get per-user notifications on events with webview? (I dont need to open a specific page on the app, but it would be nice). Or should i insist on react native coding and try to replicate as much as possible, to be able to have proper notifications? Reminder - the events won't be sent by the app. they are stored in MySQL and should be stored on some other service as well (that i dont know of yet). I don't know also if the webview can handle the website programmed login-logout with $_SESSION php parameters.
I would really appreciate some guidance.
Thanks in advance,

Is AlertIOS in React Native an outdated component?

I am learning React Native and what I am learning from only talks about Alert, even for iOS. In the API/Docs I see AlertIOS and I am curious if it does something special or is lighter weight for an iOS only app than the regular Alert?
(I found no post that had a definitive answer, but all the AlertIOS posts seem to date back to 2015-ish.)
Thank you.
AlertIOS is special as it allows users to enter information into the alert using AlertIOS.prompt. According to the React Native documentation this is only a common pattern on iOS which is why they only made it available with an iOS specific API.
React Native still supports and recommends using Alert if you do not need iOS specific functionality.
From the alert docs
This is an API that works both on iOS and Android and can show static
alerts. To show an alert that prompts the user to enter some
information, see AlertIOS; entering text in an alert is common on iOS
only.
From the alertIOS docs
We recommend using the Alert.alert method for cross-platform support
if you don't need to create iOS-only prompts.

Geofencing in React Native

At the time of this post I believe that there are no geofencing modules available for react native so I would like to implement an alternative poor man's strategy. I discovered react native's geolocation module however the official doc is not clear:
1) Does the Geolocation module run in the background and get the current user coordinates automatically (even if the app is in the background)? If yes, are these stored in a variable or a state?
2) If (1) is true, how can I detect a change in state? Because once I detect a change in state (i.e. user's location) I would like to push this new location to a remote server and store it in a database. On the other hand I do not want to store each and every inch the user is moving!
Does this strategy make sense at all? My concerns are battery consumption as well of course..
1) You need to enable this feature in xcode Then save the location you get from the 'navigator.geolocation.getCurrentPosition' callback somewhere in you app e.g. in your AsyncStorage
2) The callback is only getting called if the location is changed. So you don't need explicitly detect any location change.