-
Notifications
You must be signed in to change notification settings - Fork 5.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
[expo-localization] Add hooks, config plugin changes and more features to expo-localization #22763
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
aleqsio
changed the title
Add hooks, config plugin changes and more features to expo-localization
[expo-localization] Add hooks, config plugin changes and more features to expo-localization
Jun 7, 2023
expo-bot
added
bot: passed checks
ExpoBot has nothing to complain about
and removed
bot: suggestions
ExpoBot has some suggestions
labels
Jun 7, 2023
aleqsio
commented
Jun 12, 2023
...ges/expo-localization/android/src/main/java/expo/modules/localization/LocalizationPackage.kt
Show resolved
Hide resolved
tsapeta
reviewed
Jun 12, 2023
...ages/expo-localization/android/src/main/java/expo/modules/localization/LocalizationModule.kt
Outdated
Show resolved
Hide resolved
...ages/expo-localization/android/src/main/java/expo/modules/localization/LocalizationModule.kt
Outdated
Show resolved
Hide resolved
tsapeta
approved these changes
Jun 19, 2023
douglowder
added a commit
that referenced
this pull request
Jun 20, 2023
douglowder
added a commit
that referenced
this pull request
Jun 21, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Why
#22638
https://linear.app/expo/issue/ENG-6296/add-event-based-hooks-to-expo-localization-to-allow-listening-to
How
Hooks (https://linear.app/expo/issue/ENG-6296/add-event-based-hooks-to-expo-localization-to-allow-listening-to)
We add hooks to JS and event listeners on native side.
On iOS it's easy as we can just use
NotificationCenter
.On Android we need to add
|locale|layoutDirection
to[configChanges](android:configChanges)
.To do this we need to add a mod to a config plugin.
We also need to use the old Package api and create a static notifier object that will inform our Module that a Package has received a
onConfigurationChanged
event.User settings (#22638)
We take two separate locales, and for settings that are overridable by the user (decimal separators, number separators, ect.) we use the current locale instead of the locale computed from the language.
I'm not confident this is the best solution.
On Android it's just a list of locales, on iOS we get one locale and a list of preferred languages. There's also no way to check if settings are default for the locale or overridden by the user.
Other options:
Test Plan
Tested manually in a standalone app – this makes both Android and iOS update locale settings without loosing react state.
Checklist
npx expo prebuild
& EAS Build (eg: updated a module plugin).