Skip to content

Commit

Permalink
no message
Browse files Browse the repository at this point in the history
  • Loading branch information
jslok authored and mikehardy committed Jul 30, 2019
1 parent 56fcc86 commit e56ceea
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 12 deletions.
30 changes: 19 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,16 +33,6 @@ or using yarn:
yarn add react-native-device-info
```

> ⚠️ As of version 2.1.1 the package can be loaded async to improve start up time on Android [Refer to this PR for more information](https://github.com/react-native-community/react-native-device-info/pull/680)
```java
@Override
public List<ReactPackage> createAdditionalReactPackages() {
return Arrays.<ReactPackage>asList(
new RNDeviceInfo(true), // Pass true to load the constants asynchronously on start up, default is false
);
}
```

> ⚠️ If you are on React Native > 0.47, you must use version 0.11.0 of this library or higher
## AndroidX Support
Expand All @@ -69,6 +59,24 @@ AndroidX is supported in a non-breaking / backwards-compatible way by using over

## Linking (for React Native <= 0.59 only, React Native >= 0.60 skip this as auto-linking should work)

> ⚠️ This package is loaded async by default to improve start up time on Android
To disable async loading with autolinking, edit react-native.config.js:

```js
module.exports = {
dependencies: {
'react-native-device-info': {
platforms: {
android: {
packageInstance: 'new RNDeviceInfo(false)',
},
},
},
},
};
```

### Automatic

```shell
Expand Down Expand Up @@ -188,7 +196,7 @@ include ':app'
@Override
protected List<ReactPackage> getPackages() {
return Arrays.<ReactPackage>asList(
+ new RNDeviceInfo(),
+ new RNDeviceInfo(), //pass false in constructor to load module synchronously
new MainReactPackage()
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import java.util.List;

public class RNDeviceInfo implements ReactPackage {
private boolean mLoadConstantsAsynchronously;
private boolean mLoadConstantsAsynchronously = true;

public RNDeviceInfo() {
this(false);
Expand Down

0 comments on commit e56ceea

Please sign in to comment.