-
-
Notifications
You must be signed in to change notification settings - Fork 212
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
move isAutoTimeAndDate / isAutoTimeZone from react-native-device-info #65
Conversation
debug.keystore is in the .gitignore from react-native init, but it is required for the example to run as-is on android
These are from react-native-device-info - this module already handles timezone and locale things very well, and seems like a natural home for these things within the react-native-community versus having time/date information split across packages
android/src/main/java/com/reactcommunity/rnlocalize/RNLocalizeModule.java
Outdated
Show resolved
Hide resolved
Thanks for considering this and after you think on it I will of course make whatever changes you like so the code is comfortable over here. I'm doing a little research on iOS APIs too, maybe we can actually have an implementation for iOS who knows? |
Okay, I searched through the API docs from Apple, and couldn't find anything. I asked the original author of the API here in case they know react-native-device-info/react-native-device-info#583 (comment) - but I think this is simply not available on iOS, so once you decide exactly how you want to specify returns for platform-specific stuff I'll shape this up for a second review. Thanks @zoontek |
@mikehardy I would rather go with: type Option<T> = T | undefined
usesAutoDateAndTime(): Option<boolean>
usesAutoTimeZone(): Option<boolean> I find it less confusing 🙂 |
got it! I will do exactly that. Also the author of the original PR researched and came to the same conclusion I did - there is simply no API for iOS for these, so we're not missing anything - the PR is multi-platform "complete" such as it is. I'll tag you when I've pushed and feel like this is ready. Thanks! |
Okay @zoontek I think it's ready for a look again, here are the changes I made - some of which were in existing code, all with the idea of API-similarity:
Let me know what you think! |
f636e30
to
8cc5af9
Compare
Looks pretty good except that EDIT: I can merge it and make the changes if you want |
8cc5af9
to
2b9353b
Compare
@zoontek I just pushed that up with the original two methods untouched, and just my proposed additions as the 'Option' :-) |
Perfect, I merge it :) |
Wait! I always re-re-read things (can't help it) and I noticed I still had index.js with the Option wrapping in the function definitions, sorry! easy fix at least |
@mikehardy I will cleanup that before the release, no problem |
Sweet! Thank you so much @zoontek - react-native-device-info v3 will be out shortly then I think |
Is it gonna be on IOS any time soon? |
Summary
Howdy @zoontek :-) - this module (which I use and which is fantastic by the way) already has time and date information in it and does it well
react-native-device-info also had some duplicate time and date functions, plus these 2 which were unique
I'd like to have one place in the react-native-community for this type of information and this seems like a natural home
So I'm purging them out of react-native-device-info in preference to here
There was no iOS implementation of them in react-native-device-info (maybe it is not possible? unknown) so this is the complete implementation, such as it is
I did not add it to the changelog as requested in this template because I could not see a changelog?
Test Plan
I added it to the Sync and Async example. Seems to work? Although getting the example to work with local code changes required me to run
yarn add "file:../"
before it would pick up changes...What's required for testing (prerequisites)?
What are the steps to reproduce (after prerequisites)?
Compatibility
Checklist
README.md
CHANGELOG.md
example/App.js
)