-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
397 additions
and
1,504 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import React, { useEffect, useState } from 'react' | ||
import { ScrollView, Text } from 'react-native' | ||
|
||
export default function JSONView({ json }) { | ||
return ( | ||
<ScrollView style={{ flex: 1, overflow: 'scroll' }}> | ||
<Text | ||
style={{ | ||
backgroundColor: 'transparent', | ||
fontSize: 15, | ||
color: '#000', | ||
}} | ||
> | ||
{JSON.stringify(json, null, 2)} | ||
</Text> | ||
</ScrollView> | ||
) | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import { BlurView } from 'expo-blur' | ||
import React, { useEffect, useState } from 'react' | ||
import { Image, StyleSheet, Text } from 'react-native' | ||
|
||
import Example from '../example' | ||
|
||
const IMAGE = { uri: 'https://i.ytimg.com/vi/y588qNiCZZo/maxresdefault.jpg' } | ||
|
||
export default function ExpoBlurExample() { | ||
return ( | ||
<Example title="expo-blur"> | ||
<Image source={IMAGE} style={styles.image} /> | ||
<BlurView style={styles.blur}> | ||
<Text style={styles.text}>Blur View</Text> | ||
</BlurView> | ||
</Example> | ||
) | ||
} | ||
|
||
const styles = StyleSheet.create({ | ||
image: { | ||
flex: 1, | ||
height: 300, | ||
}, | ||
blur: { | ||
position: 'absolute', | ||
top: '50%', | ||
left: 0, | ||
bottom: 0, | ||
right: 0, | ||
padding: 15, | ||
alignItems: 'center', | ||
justifyContent: 'center', | ||
borderRadius: 5, | ||
}, | ||
text: { | ||
backgroundColor: 'transparent', | ||
fontSize: 15, | ||
color: '#fff', | ||
}, | ||
}) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import { Camera } from 'expo-camera' | ||
import React, { useEffect, useState } from 'react' | ||
|
||
import Example from '../example' | ||
|
||
export default function ExpoCameraExample() { | ||
return ( | ||
<Example title="expo-camera"> | ||
<Camera | ||
style={[{ alignItems: 'center', borderRadius: 5, minHeight: 300 }]} | ||
/> | ||
</Example> | ||
) | ||
} |
21 changes: 21 additions & 0 deletions
21
examples/uikits/src/components/expo/ExpoConstantsExample.js
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import Constants from 'expo-constants' | ||
import React, { useEffect, useState } from 'react' | ||
import { Text } from 'react-native' | ||
|
||
import Example from '../example' | ||
|
||
export default function ExpoConstantsExample() { | ||
return ( | ||
<Example title="expo-constants"> | ||
<Text | ||
style={{ | ||
backgroundColor: 'transparent', | ||
fontSize: 15, | ||
color: '#000', | ||
}} | ||
> | ||
{JSON.stringify(Constants, null, 2)} | ||
</Text> | ||
</Example> | ||
) | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import * as Font from 'expo-font' | ||
import React, { useEffect, useState } from 'react' | ||
import { Text } from 'react-native' | ||
|
||
import Example from '../example' | ||
|
||
function ExpoFontExample() { | ||
const [loaded, setLoaded] = useState(false) | ||
|
||
async function loadFontAsync() { | ||
await Font.loadAsync({ | ||
'retro-regular': require('../../assets/retro-regular.ttf'), | ||
}) | ||
setLoaded(true) | ||
} | ||
|
||
useEffect(() => { | ||
loadFontAsync() | ||
}, []) | ||
|
||
return ( | ||
<Example title="expo-font" style={{ justifyContent: 'space-around' }}> | ||
{loaded && ( | ||
<Text | ||
style={{ | ||
fontFamily: 'retro-regular', | ||
backgroundColor: 'transparent', | ||
fontSize: 56, | ||
color: '#000', | ||
}} | ||
> | ||
Cool new font | ||
</Text> | ||
)} | ||
</Example> | ||
) | ||
} | ||
|
||
export default ExpoFontExample |
26 changes: 26 additions & 0 deletions
26
examples/uikits/src/components/expo/ExpoLocationExample.js
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import * as Location from 'expo-location' | ||
import React, { useEffect, useState } from 'react' | ||
import { Button } from 'react-native' | ||
|
||
import Example from '../example' | ||
import JSONView from '../JSONView' | ||
|
||
export default function ExpoLocationExample() { | ||
const [item, setItem] = useState(null) | ||
|
||
return ( | ||
<Example title="expo-location" style={{ justifyContent: 'space-around' }}> | ||
<Button | ||
title="Get Location" | ||
onPress={async () => { | ||
try { | ||
setItem(await Location.getCurrentPositionAsync()) | ||
} catch ({ message }) { | ||
alert('Something went wrong: ' + message) | ||
} | ||
}} | ||
/> | ||
{item && <JSONView json={item} />} | ||
</Example> | ||
) | ||
} |
59 changes: 59 additions & 0 deletions
59
examples/uikits/src/components/expo/ExpoPermissionsExample.js
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
import * as Permissions from 'expo-permissions' | ||
import React, { useEffect, useState } from 'react' | ||
import { Button, ScrollView, Text, View } from 'react-native' | ||
|
||
import Example from '../example' | ||
|
||
const permissions = [ | ||
['CAMERA', Permissions.CAMERA], | ||
['AUDIO_RECORDING', Permissions.AUDIO_RECORDING], | ||
['LOCATION', Permissions.LOCATION], | ||
['USER_FACING_NOTIFICATIONS', Permissions.USER_FACING_NOTIFICATIONS], | ||
['NOTIFICATIONS', Permissions.NOTIFICATIONS], | ||
['CONTACTS', Permissions.CONTACTS], | ||
['SYSTEM_BRIGHTNESS', Permissions.SYSTEM_BRIGHTNESS], | ||
['CAMERA_ROLL', Permissions.CAMERA_ROLL], | ||
['CALENDAR', Permissions.CALENDAR], | ||
['REMINDERS', Permissions.REMINDERS], | ||
] | ||
|
||
export default function PermissionsExample() { | ||
return ( | ||
<Example title="expo-permissions"> | ||
<ScrollView | ||
style={{ flex: 1 }} | ||
contentContainerStyle={{ alignItems: 'stretch', flex: 1 }} | ||
> | ||
{permissions.map(([permissionName, permissionType]) => ( | ||
<View style={{ marginBottom: 12 }}> | ||
<Text style={{ marginBottom: 8 }}>{permissionName}</Text> | ||
<View | ||
style={{ | ||
flexDirection: 'row', | ||
flex: 1, | ||
justifyContent: 'space-around', | ||
}} | ||
> | ||
<Button | ||
style={{ marginVertical: 4 }} | ||
key={permissionType} | ||
onPress={async () => { | ||
alert((await Permissions.getAsync(permissionType)).status) | ||
}} | ||
title={`Get Status`} | ||
/> | ||
<Button | ||
style={{ marginVertical: 4 }} | ||
key={permissionType} | ||
onPress={async () => { | ||
alert((await Permissions.askAsync(permissionType)).status) | ||
}} | ||
title={`Request`} | ||
/> | ||
</View> | ||
</View> | ||
))} | ||
</ScrollView> | ||
</Example> | ||
) | ||
} |
Oops, something went wrong.