Skip to content

A React Native library to check if the device's automatic time setting is enabled on both Android and iOS platforms using native code.

License

Notifications You must be signed in to change notification settings

flaviolima9904/react-native-check-device-auto-time

Repository files navigation

react-native-check-device-auto-time

A React Native library to check if the device's automatic time setting is enabled on both Android and iOS platforms using native code.

Installation

  1. Install the library:

    npm install react-native-check-device-auto-time

    or

    yarn add react-native-check-device-auto-time
  2. Link the native modules:

    For React Native 0.60 and above, the linking is done automatically. For older versions, you might need to link the library manually:

    react-native link react-native-check-device-auto-time

Usage

  1. Import the library:

    import CheckDeviceAutoTime from 'react-native-check-device-auto-time';
  2. Use the isAutomaticTimeEnabled function in your React Native component:

    import React, { useEffect, useState } from 'react';
    import { View, Text } from 'react-native';
    import CheckDeviceAutoTime from 'react-native-check-device-auto-time';
    
    const App = () => {
        const [isAutoTimeEnabled, setIsAutoTimeEnabled] = useState(false);
    
        useEffect(() => {
            const checkAutoTime = async () => {
                const isEnabled = await CheckDeviceAutoTime.isAutomaticTimeEnabled();
                setIsAutoTimeEnabled(isEnabled);
            };
    
            checkAutoTime();
        }, []);
    
        return (
            <View>
                <Text>Automatic Time Enabled: {isAutoTimeEnabled ? 'Yes' : 'No'}</Text>
            </View>
        );
    };
    
    export default App;

License

This project is licensed under the MIT License. See the LICENSE file for details.

About

A React Native library to check if the device's automatic time setting is enabled on both Android and iOS platforms using native code.

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published