-
Notifications
You must be signed in to change notification settings - Fork 345
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
1 parent
740c6c5
commit bdf3eef
Showing
18 changed files
with
2,819 additions
and
748 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 |
---|---|---|
@@ -1,3 +1,13 @@ | ||
module.exports = { | ||
presets: ['module:metro-react-native-babel-preset'], | ||
plugins: [ | ||
[ | ||
'module-resolver', | ||
{ | ||
alias: { | ||
'^react-native$': 'react-native-web', | ||
}, | ||
}, | ||
], | ||
], | ||
}; |
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 @@ | ||
<!DOCTYPE html> | ||
<html lang="en" style="height:100%"> | ||
<head> | ||
<meta charset="UTF-8" /> | ||
<title>React Native for Web</title> | ||
<style> | ||
/* These styles make the body full-height */ | ||
html, body { height: 100%; } | ||
/* These styles disable body scrolling if you are using <ScrollView> */ | ||
body { overflow: hidden; } | ||
/* These styles make the root element full-height */ | ||
#root { display:flex; height:100%; } | ||
</style> | ||
</head> | ||
<body style="height:100%"> | ||
<div id="root"></div> | ||
</body> | ||
</html> |
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,13 @@ | ||
/** | ||
* @format | ||
*/ | ||
|
||
import { AppRegistry } from "react-native"; | ||
import { App } from "./src/App"; | ||
import { name as appName } from "./app.json"; | ||
|
||
AppRegistry.registerComponent(appName, () => App); | ||
|
||
AppRegistry.runApplication(appName, { | ||
rootTag: document.getElementById("root"), | ||
}); |
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
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,62 @@ | ||
//@flow | ||
import React, { Fragment, useState, useCallback, useRef } from 'react'; | ||
import { StyleSheet, View, SafeAreaView, Text, Image, Modal } from 'react-native'; | ||
import { captureRef } from 'react-native-view-shot'; | ||
import Btn from './Btn'; | ||
import Desc from './Desc'; | ||
|
||
const styles = StyleSheet.create({ | ||
root: { | ||
padding: 50, | ||
}, | ||
preview: { | ||
marginTop: 20, | ||
width: 200, | ||
height: 200, | ||
borderWidth: 1, | ||
borderColor: '#aaa', | ||
}, | ||
modal: { | ||
alignSelf: 'flex-end', | ||
padding: 20, | ||
backgroundColor: '#eee', | ||
}, | ||
buttons: { | ||
flexDirection: 'row', | ||
}, | ||
}); | ||
|
||
const ImageExample = () => { | ||
const [source, setSource] = useState(null); | ||
const imageRef = useRef(); | ||
|
||
const onCapture = useCallback(base64 => { | ||
setSource({ uri: "data:image/jpg;base64," + base64 }); | ||
}, []); | ||
|
||
const onPressCapture = useCallback(() => { | ||
captureRef(imageRef, { | ||
result: 'base64', | ||
format: 'jpg' | ||
}).then(onCapture); | ||
}, [onCapture]); | ||
|
||
return ( | ||
<Fragment> | ||
<SafeAreaView> | ||
<View style={styles.root}> | ||
<Btn onPress={onPressCapture} label="Capture Image" /> | ||
<Image ref={imageRef} source={require('./cat.jpg')} style={styles.preview} resizeMode="contain" /> | ||
<Image source={source} style={styles.preview} resizeMode="contain" /> | ||
</View> | ||
</SafeAreaView> | ||
|
||
</Fragment> | ||
); | ||
}; | ||
|
||
ImageExample.navigationOptions = { | ||
title: 'Image', | ||
}; | ||
|
||
export default ImageExample; |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,31 @@ | ||
import FullScreen from './Full'; | ||
import ViewshootScreen from './Viewshoot'; | ||
import TransparencyScreen from './Transparency'; | ||
import VideoScreen from './Video'; | ||
import WebViewScreen from './WebView'; | ||
import MapViewScreen from './MapView'; | ||
import CanvasScreen from './Canvas'; | ||
import GLReactV2Screen from './GLReactV2'; | ||
import SVGUriScreen from './SVGUri'; | ||
import ARTScreen from './ART'; | ||
import FSScreen from './FS'; | ||
import ModalScreen from './Modal'; | ||
import ImageScreen from './Image'; | ||
|
||
const screens = { | ||
Full: { screen: FullScreen }, | ||
Viewshoot: { screen: ViewshootScreen }, | ||
Transparency: { screen: TransparencyScreen }, | ||
Video: { screen: VideoScreen }, | ||
WebView: { screen: WebViewScreen }, | ||
MapView: { screen: MapViewScreen }, | ||
Canvas: { screen: CanvasScreen }, | ||
GLReactV2: { screen: GLReactV2Screen }, | ||
SVGUri: { screen: SVGUriScreen }, | ||
ART: { screen: ARTScreen }, | ||
FS: { screen: FSScreen }, | ||
Modal: { screen: ModalScreen }, | ||
Image: { screen: ImageScreen }, | ||
}; | ||
|
||
export default screens |
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,31 @@ | ||
//import FullScreen from './Full'; | ||
//import ViewshootScreen from './Viewshoot'; | ||
//import TransparencyScreen from './Transparency'; | ||
//import VideoScreen from './Video'; | ||
//import WebViewScreen from './WebView'; | ||
//import MapViewScreen from './MapView'; | ||
//import CanvasScreen from './Canvas'; | ||
//import GLReactV2Screen from './GLReactV2'; | ||
//import SVGUriScreen from './SVGUri'; | ||
//import ARTScreen from './ART'; | ||
//import FSScreen from './FS'; | ||
import ModalScreen from './Modal'; | ||
import ImageScreen from './Image'; | ||
|
||
const screens = { | ||
//Full: { screen: FullScreen }, | ||
//Viewshoot: { screen: ViewshootScreen }, | ||
//Transparency: { screen: TransparencyScreen }, | ||
//Video: { screen: VideoScreen }, | ||
//WebView: { screen: WebViewScreen }, | ||
//MapView: { screen: MapViewScreen }, | ||
//Canvas: { screen: CanvasScreen }, | ||
//GLReactV2: { screen: GLReactV2Screen }, | ||
//SVGUri: { screen: SVGUriScreen }, | ||
//ART: { screen: ARTScreen }, | ||
//FS: { screen: FSScreen }, | ||
Modal: { screen: ModalScreen }, | ||
Image: { screen: ImageScreen }, | ||
}; | ||
|
||
export default screens |
Oops, something went wrong.