0.2.10 • Published 2 years ago

react-native-home-indicator v0.2.10

Weekly downloads
1,986
License
MIT
Repository
github
Last release
2 years ago

npm version CircleCI codecov

A declarative approach for hiding the Home Indicator on iOS/iPadOS devices.

Getting Started

1. Add dependency

npm install react-native-home-indicator --save

2. Link library

If you're using RN >= 0.60.0 just run pod install as usual

3. Changes in Appdelegate.m

// add to your imports
#import <RNHomeIndicator.h>
// find this line
UIViewController *rootViewController = [UIViewController new];
// and replace with
UIViewController *rootViewController = [HomeIndicatorViewController new];

Simple Usage

Render <PrefersHomeIndicatorAutoHidden /> to signal your preference for hiding the Home Indicator. "The system takes your preference into account, but returning true is no guarantee that the indicator will be hidden." see developer.apple.com/documentation

...
import PrefersHomeIndicatorAutoHidden from 'react-native-home-indicator';

const SomeReactNativeComponent = () => {
    return (
        <View>
            <PrefersHomeIndicatorAutoHidden />
            ...
        </View>
    );
}

Extended Usage

For more complex usage you can use the HomeIndicator component which allows passing your preferred indicator setting as prop. Its even possible to override previous rendered indicator preferences as you can see in the following example.

...
import { HomeIndicator } from 'react-native-home-indicator';

const SomeReactNativeComponent = () => {
    return (
        <View>
            <HomeIndicator autoHidden />
            <SomeDeepComponentTree>
                 <HomeIndicator autoHidden={false} />
            </SomeDeepComponentTree>
        </View>
    );
}
0.2.10

2 years ago

0.2.9

2 years ago

0.2.8

2 years ago

0.2.7

3 years ago

0.2.6

4 years ago

0.2.5

5 years ago

0.2.4

5 years ago

0.2.3

5 years ago

0.2.2

5 years ago

0.2.1

5 years ago

0.2.0

6 years ago

0.1.5

6 years ago

0.1.4

6 years ago

0.1.3

6 years ago

0.1.2

6 years ago

0.1.1

6 years ago

0.1.0

6 years ago