Skip to content

Commit 252e9fa

Browse files
committed
Example is integrated
1 parent 91d5a71 commit 252e9fa

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

63 files changed

+9978
-42
lines changed

example/.buckconfig

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
2+
[android]
3+
target = Google Inc.:Google APIs:23
4+
5+
[maven_repositories]
6+
central = https://repo1.maven.org/maven2

example/.eslintrc.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
module.exports = {
2+
root: true,
3+
extends: '@react-native-community',
4+
parser: '@typescript-eslint/parser',
5+
plugins: ['@typescript-eslint'],
6+
};

example/.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
*.pbxproj -text

example/.gitignore

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
# OSX
2+
#
3+
.DS_Store
4+
5+
# Xcode
6+
#
7+
build/
8+
*.pbxuser
9+
!default.pbxuser
10+
*.mode1v3
11+
!default.mode1v3
12+
*.mode2v3
13+
!default.mode2v3
14+
*.perspectivev3
15+
!default.perspectivev3
16+
xcuserdata
17+
*.xccheckout
18+
*.moved-aside
19+
DerivedData
20+
*.hmap
21+
*.ipa
22+
*.xcuserstate
23+
project.xcworkspace
24+
25+
# Android/IntelliJ
26+
#
27+
build/
28+
.idea
29+
.gradle
30+
local.properties
31+
*.iml
32+
33+
# Visual Studio Code
34+
#
35+
.vscode/
36+
37+
# node.js
38+
#
39+
node_modules/
40+
npm-debug.log
41+
yarn-error.log
42+
43+
# BUCK
44+
buck-out/
45+
\.buckd/
46+
*.keystore
47+
!debug.keystore
48+
49+
# fastlane
50+
#
51+
# It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the
52+
# screenshots whenever they are needed.
53+
# For more information about the recommended setup visit:
54+
# https://docs.fastlane.tools/best-practices/source-control/
55+
56+
*/fastlane/report.xml
57+
*/fastlane/Preview.html
58+
*/fastlane/screenshots
59+
60+
# Bundle artifact
61+
*.jsbundle
62+
63+
# CocoaPods
64+
/ios/Pods/

example/.watchmanconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{}

example/App.tsx

Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
import React from "react";
2+
import {
3+
SafeAreaView,
4+
StyleSheet,
5+
ScrollView,
6+
View,
7+
Text as RNText,
8+
StatusBar
9+
} from "react-native";
10+
11+
import {
12+
Header,
13+
LearnMoreLinks,
14+
Colors,
15+
DebugInstructions,
16+
ReloadInstructions
17+
} from "react-native/Libraries/NewAppScreen";
18+
19+
import Text from "./lib/StatefulComponent/Text";
20+
21+
declare var global: { HermesInternal: null | {} };
22+
23+
const App = () => {
24+
return (
25+
<>
26+
<StatusBar barStyle="dark-content" />
27+
<SafeAreaView>
28+
<ScrollView
29+
contentInsetAdjustmentBehavior="automatic"
30+
style={styles.scrollView}
31+
>
32+
<Header />
33+
{global.HermesInternal == null ? null : (
34+
<View style={styles.engine}>
35+
<Text style={styles.footer}>Engine: Hermes</Text>
36+
</View>
37+
)}
38+
<View style={styles.body}>
39+
<View style={styles.sectionContainer}>
40+
<Text size="XL" bold style={styles.sectionTitle}>
41+
Step One
42+
</Text>
43+
<Text style={styles.sectionDescription}>
44+
Edit <Text style={styles.highlight}>App.tsx</Text> to change
45+
this screen and then come back to see your edits.
46+
</Text>
47+
</View>
48+
<View style={styles.sectionContainer}>
49+
<Text style={styles.sectionTitle}>See Your Changes</Text>
50+
<Text style={styles.sectionDescription}>
51+
<ReloadInstructions />
52+
</Text>
53+
</View>
54+
<View style={styles.sectionContainer}>
55+
<Text style={styles.sectionTitle}>Debug</Text>
56+
<Text style={styles.sectionDescription}>
57+
<DebugInstructions />
58+
</Text>
59+
</View>
60+
<View style={styles.sectionContainer}>
61+
<Text style={styles.sectionTitle}>Learn More</Text>
62+
<Text style={styles.sectionDescription}>
63+
Read the docs to discover what to do next:
64+
</Text>
65+
</View>
66+
<LearnMoreLinks />
67+
</View>
68+
</ScrollView>
69+
</SafeAreaView>
70+
</>
71+
);
72+
};
73+
74+
const styles = StyleSheet.create({
75+
scrollView: {
76+
backgroundColor: Colors.lighter
77+
},
78+
engine: {
79+
position: "absolute",
80+
right: 0
81+
},
82+
body: {
83+
backgroundColor: Colors.white
84+
},
85+
sectionContainer: {
86+
marginTop: 32,
87+
paddingHorizontal: 24
88+
},
89+
sectionTitle: {
90+
fontSize: 24,
91+
fontWeight: "600",
92+
color: Colors.black
93+
},
94+
sectionDescription: {
95+
marginTop: 8,
96+
fontSize: 18,
97+
fontWeight: "400",
98+
color: Colors.dark
99+
},
100+
highlight: {
101+
fontWeight: "700"
102+
},
103+
footer: {
104+
color: Colors.dark,
105+
fontSize: 12,
106+
fontWeight: "600",
107+
padding: 4,
108+
paddingRight: 12,
109+
textAlign: "right"
110+
}
111+
});
112+
113+
export default App;

example/__tests__/App-test.tsx

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
/**
2+
* @format
3+
*/
4+
5+
import 'react-native';
6+
import React from 'react';
7+
import App from '../App';
8+
9+
// Note: test renderer must be required after react-native.
10+
import renderer from 'react-test-renderer';
11+
12+
it('renders correctly', () => {
13+
renderer.create(<App />);
14+
});

example/android/app/_BUCK

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
# To learn about Buck see [Docs](https://buckbuild.com/).
2+
# To run your application with Buck:
3+
# - install Buck
4+
# - `npm start` - to start the packager
5+
# - `cd android`
6+
# - `keytool -genkey -v -keystore keystores/debug.keystore -storepass android -alias androiddebugkey -keypass android -dname "CN=Android Debug,O=Android,C=US"`
7+
# - `./gradlew :app:copyDownloadableDepsToLibs` - make all Gradle compile dependencies available to Buck
8+
# - `buck install -r android/app` - compile, install and run application
9+
#
10+
11+
load(":build_defs.bzl", "create_aar_targets", "create_jar_targets")
12+
13+
lib_deps = []
14+
15+
create_aar_targets(glob(["libs/*.aar"]))
16+
17+
create_jar_targets(glob(["libs/*.jar"]))
18+
19+
android_library(
20+
name = "all-libs",
21+
exported_deps = lib_deps,
22+
)
23+
24+
android_library(
25+
name = "app-code",
26+
srcs = glob([
27+
"src/main/java/**/*.java",
28+
]),
29+
deps = [
30+
":all-libs",
31+
":build_config",
32+
":res",
33+
],
34+
)
35+
36+
android_build_config(
37+
name = "build_config",
38+
package = "com.example",
39+
)
40+
41+
android_resource(
42+
name = "res",
43+
package = "com.example",
44+
res = "src/main/res",
45+
)
46+
47+
android_binary(
48+
name = "app",
49+
keystore = "//android/keystores:debug",
50+
manifest = "src/main/AndroidManifest.xml",
51+
package_type = "debug",
52+
deps = [
53+
":app-code",
54+
],
55+
)

0 commit comments

Comments
 (0)