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
... | |
<uses-permission android:name="android.permission.VIBRATE" /> | |
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/> | |
... |
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
ext { | |
googlePlayServicesVersion = "+" // default: "+" | |
firebaseMessagingVersion = "+" // default: "+" | |
buildToolsVersion = "29.0.2" | |
minSdkVersion = 16 | |
compileSdkVersion = 29 | |
targetSdkVersion = 29 | |
} |
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
DeviceInfo.getBatteryLevel().then(batteryLevel => { | |
// 0.759999 | |
}); |
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
DeviceInfo.getAndroidId().then(androidId => { | |
// androidId here | |
}); |
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
import { PermissionsAndroid } from 'react-native'; | |
import Contacts from 'react-native-contacts'; | |
PermissionsAndroid.request( | |
PermissionsAndroid.PERMISSIONS.READ_CONTACTS, | |
{ | |
'title': 'Contacts', | |
'message': 'Let us us access your contacts', | |
'buttonPositive': 'Please accept' | |
} |
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
class App extends Component { | |
render() { | |
return ( | |
<View style={styles.container}> | |
<RNCamera | |
style={{ flex: 1, alignItems: 'center' }} | |
ref={ref => { | |
this.camera = ref | |
}} | |
/> |
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
import {check, PERMISSIONS, RESULTS} from 'react-native-permissions'; | |
check(PERMISSIONS.IOS.CAMERA) | |
.then((result) => { | |
switch (result) { | |
case RESULTS.UNAVAILABLE: | |
console.log( | |
'feature is not available', | |
); | |
break; |
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
DeviceInfo.isCameraPresent() | |
.then(isCameraPresent => { | |
// true or false | |
}) | |
.catch(cameraAccessException => { | |
// is thrown if a camera device could not be queried or opened by the CameraManager on Android | |
}); |
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
import React from "react" | |
const ComponentOne = ({ children }) => { | |
return ( | |
<div> | |
<h5>This is the component one</h5>; | |
{ children } | |
</div> | |
); | |
} |
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
const App = () => { | |
const content = "Which component is using the content?"; | |
return ( | |
<div className="App"> | |
<ComponentOne> | |
<ComponentTwo> | |
<ComponentThree> | |
<ComponentUsingProps content={content} /> | |
<ComponentThree> | |
</ComponentTwo> |