Skip to content

Commit 9aa17c9

Browse files
committed
add SVG example. fixes #97
1 parent 9bae019 commit 9aa17c9

File tree

9 files changed

+592
-172
lines changed

9 files changed

+592
-172
lines changed

android/react-native-view-shot.iml

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -77,24 +77,16 @@
7777
<sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
7878
<sourceFolder url="file://$MODULE_DIR$/src/test/rs" isTestSource="true" />
7979
<sourceFolder url="file://$MODULE_DIR$/src/test/shaders" isTestSource="true" />
80-
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/annotations" />
81-
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/assets" />
8280
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/blame" />
8381
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/bundles" />
84-
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/classes" />
85-
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/dependency-cache" />
8682
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental" />
87-
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental-safeguard" />
88-
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/jniLibs" />
8983
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/lint" />
9084
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/manifests" />
9185
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/res" />
9286
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/rs" />
9387
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/shaders" />
9488
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/symbols" />
95-
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/transforms" />
9689
<excludeFolder url="file://$MODULE_DIR$/build/outputs" />
97-
<excludeFolder url="file://$MODULE_DIR$/build/tmp" />
9890
</content>
9991
<orderEntry type="jdk" jdkName="Android API 26 Platform" jdkType="Android SDK" />
10092
<orderEntry type="sourceFolder" forTests="false" />

example/App.js

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import {
1111
Slider,
1212
WebView
1313
} from "react-native";
14+
import SvgUri from "react-native-svg-uri";
1415
import omit from "lodash/omit";
1516
import { captureRef } from "react-native-view-shot";
1617
import { Surface } from "gl-react-native";
@@ -143,6 +144,7 @@ export default class App extends Component {
143144
onPress={this.snapshot("complex")}
144145
/>
145146
<Btn label="📷 All (ScrollView)" onPress={this.snapshot("full")} />
147+
<Btn label="📷 SVG" onPress={this.snapshot("svg")} />
146148
<Btn label="📷 GL React" onPress={this.snapshot("gl")} />
147149
<Btn label="📷 MapView" onPress={this.snapshot("mapview")} />
148150
<Btn label="📷 WebView" onPress={this.snapshot("webview")} />
@@ -252,9 +254,18 @@ export default class App extends Component {
252254
<View ref="empty" collapsable={false} />
253255
<View style={styles.experimental} ref="complex" collapsable={false}>
254256
<Text style={styles.experimentalTitle}>Experimental Stuff</Text>
255-
<Surface ref="gl" width={300} height={300}>
256-
<HelloGL blue={0.5} />
257-
</Surface>
257+
<View ref="svg" collapsable={false}>
258+
<SvgUri
259+
width={200}
260+
height={200}
261+
source={require("./homer-simpson.svg")}
262+
/>
263+
</View>
264+
<View ref="gl" collapsable={false}>
265+
<Surface width={300} height={300}>
266+
<HelloGL blue={0.5} />
267+
</Surface>
268+
</View>
258269
<MapView
259270
ref="mapview"
260271
initialRegion={{

example/android/app/build.gradle

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ def enableProguardInReleaseBuilds = false
8484

8585
android {
8686
compileSdkVersion 23
87-
buildToolsVersion '25.0.0'
87+
buildToolsVersion '25.0.3'
8888

8989
defaultConfig {
9090
applicationId "com.viewshotexample"
@@ -126,6 +126,7 @@ android {
126126
}
127127

128128
dependencies {
129+
compile project(':react-native-svg')
129130
compile fileTree(dir: "libs", include: ["*.jar"])
130131
compile "com.android.support:appcompat-v7:23.0.1"
131132
compile "com.facebook.react:react-native:+" // From node_modules

example/android/app/src/main/java/com/viewshotexample/MainApplication.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
import com.airbnb.android.react.maps.MapsPackage;
77
import com.facebook.react.ReactApplication;
8+
import com.horcrux.svg.SvgPackage;
89
import com.brentvatne.react.ReactVideoPackage;
910
import com.facebook.react.ReactInstanceManager;
1011
import com.facebook.react.ReactNativeHost;
@@ -30,6 +31,7 @@ public boolean getUseDeveloperSupport() {
3031
protected List<ReactPackage> getPackages() {
3132
return Arrays.<ReactPackage>asList(
3233
new MainReactPackage(),
34+
new SvgPackage(),
3335
new ReactVideoPackage(),
3436
new RNViewShotPackage(),
3537
new MapsPackage(),

example/android/settings.gradle

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
rootProject.name = 'ViewShotExample'
2+
include ':react-native-svg'
3+
project(':react-native-svg').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-svg/android')
24

35
include ':app'
46
include ':react-native-view-shot'

0 commit comments

Comments
 (0)