Skip to content

Commit af2d054

Browse files
committed
Few demo projects
1 parent c2345a9 commit af2d054

File tree

349 files changed

+84691
-0
lines changed

Some content is hidden

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

349 files changed

+84691
-0
lines changed

.DS_Store

8 KB
Binary file not shown.

AnimationExample/.babelrc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"presets": ["react-native"]
3+
}

AnimationExample/.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

AnimationExample/.flowconfig

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
[ignore]
2+
; We fork some components by platform
3+
.*/*[.]android.js
4+
5+
; Ignore "BUCK" generated dirs
6+
<PROJECT_ROOT>/\.buckd/
7+
8+
; Ignore unexpected extra "@providesModule"
9+
.*/node_modules/.*/node_modules/fbjs/.*
10+
11+
; Ignore duplicate module providers
12+
; For RN Apps installed via npm, "Libraries" folder is inside
13+
; "node_modules/react-native" but in the source repo it is in the root
14+
.*/Libraries/react-native/React.js
15+
16+
; Ignore polyfills
17+
.*/Libraries/polyfills/.*
18+
19+
; Ignore metro
20+
.*/node_modules/metro/.*
21+
22+
[include]
23+
24+
[libs]
25+
node_modules/react-native/Libraries/react-native/react-native-interface.js
26+
node_modules/react-native/flow/
27+
node_modules/react-native/flow-github/
28+
29+
[options]
30+
emoji=true
31+
32+
module.system=haste
33+
34+
munge_underscores=true
35+
36+
module.name_mapper='^[./a-zA-Z0-9$_-]+\.\(bmp\|gif\|jpg\|jpeg\|png\|psd\|svg\|webp\|m4v\|mov\|mp4\|mpeg\|mpg\|webm\|aac\|aiff\|caf\|m4a\|mp3\|wav\|html\|pdf\)$' -> 'RelativeImageStub'
37+
38+
module.file_ext=.js
39+
module.file_ext=.jsx
40+
module.file_ext=.json
41+
module.file_ext=.native.js
42+
43+
suppress_type=$FlowIssue
44+
suppress_type=$FlowFixMe
45+
suppress_type=$FlowFixMeProps
46+
suppress_type=$FlowFixMeState
47+
48+
suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(<VERSION>\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)
49+
suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(<VERSION>\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)?:? #[0-9]+
50+
suppress_comment=\\(.\\|\n\\)*\\$FlowFixedInNextDeploy
51+
suppress_comment=\\(.\\|\n\\)*\\$FlowExpectedError
52+
53+
[version]
54+
^0.67.0

AnimationExample/.gitattributes

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

AnimationExample/.gitignore

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
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+
# node.js
34+
#
35+
node_modules/
36+
npm-debug.log
37+
yarn-error.log
38+
39+
# BUCK
40+
buck-out/
41+
\.buckd/
42+
*.keystore
43+
44+
# fastlane
45+
#
46+
# It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the
47+
# screenshots whenever they are needed.
48+
# For more information about the recommended setup visit:
49+
# https://docs.fastlane.tools/best-practices/source-control/
50+
51+
*/fastlane/report.xml
52+
*/fastlane/Preview.html
53+
*/fastlane/screenshots
54+
55+
# Bundle artifact
56+
*.jsbundle

AnimationExample/.watchmanconfig

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

AnimationExample/App.js

Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
import React, { Component } from 'react';
2+
import {
3+
Platform,
4+
StyleSheet,
5+
Text,
6+
View,
7+
Animated
8+
} from 'react-native';
9+
10+
export default class App extends Component {
11+
constructor(props) {
12+
super(props);
13+
14+
this.state = {
15+
animationfactor: new Animated.Value(50),
16+
interpolationFactor: new Animated.Value(1),
17+
interpolationFactor1: new Animated.Value(0)
18+
};
19+
}
20+
componentDidMount() {
21+
Animated.timing(this.state.animationfactor, {
22+
toValue: 300,
23+
duration: 1000,
24+
delay: 1000,
25+
//useNativeDriver: true
26+
}).start(() => {
27+
alert('done'); //callback arrow fn calledd after animation is done
28+
});
29+
30+
Animated.timing(this.state.interpolationFactor, {
31+
toValue: 0,
32+
duration: 1000,
33+
useNativeDriver: true
34+
}).start();
35+
36+
Animated.timing(this.state.interpolationFactor1, {
37+
toValue: 1,
38+
duration: 1000,
39+
useNativeDriver: true
40+
}).start();
41+
}
42+
render() {
43+
return (
44+
<View style={styles.container}>
45+
<Animated.View
46+
style={{width: this.state.animationfactor, height: 10, backgroundColor: 'red', position: 'absolute', left: 20, top: 300}}>
47+
</Animated.View>
48+
49+
<Animated.View style={{
50+
width: 100,
51+
height: 100,
52+
backgroundColor: 'green',
53+
opacity: this.state.interpolationFactor.interpolate({
54+
inputRange: [0, 1],
55+
outputRange: [1, 0]
56+
}),
57+
transform: [{
58+
translateX: this.state.interpolationFactor.interpolate({
59+
inputRange: [0, 1],
60+
outputRange: [0, 100]
61+
})
62+
}, {
63+
rotate: this.state.interpolationFactor.interpolate({
64+
inputRange: [0, 1],
65+
outputRange: ['360deg', '0deg']
66+
})
67+
}]
68+
}}>
69+
</Animated.View>
70+
71+
<Animated.View style={{
72+
width: 50,
73+
height: 50,
74+
backgroundColor: 'blue',
75+
marginTop: 40,
76+
transform: [{
77+
scale: this.state.interpolationFactor1.interpolate({
78+
inputRange: [0, 1],
79+
outputRange: [1, 3]
80+
})
81+
}, {
82+
rotate: this.state.interpolationFactor1.interpolate({
83+
inputRange: [0, 1],
84+
outputRange: ['0deg', '-415deg']
85+
})
86+
}]
87+
}}>
88+
</Animated.View>
89+
</View>
90+
);
91+
}
92+
}
93+
94+
const styles = StyleSheet.create({
95+
container: {
96+
flex: 1,
97+
justifyContent: 'center',
98+
alignItems: 'center',
99+
backgroundColor: '#F5FCFF',
100+
},
101+
102+
});
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
import React, { Component} from 'react';
2+
import {
3+
View,
4+
Text,
5+
Animated,
6+
ScrollView,
7+
StyleSheet,
8+
Dimensions
9+
} from 'react-native';
10+
11+
export default class ScrollViewAnimationExample extends Component {
12+
constructor(props) {
13+
super(props);
14+
this.data = [1,2,3,4,5,6,7,8,1,2,3,4,5,6,7,8,1,2,3,4,5,6,7,8,1,2,3,4,5,6,7,8];
15+
this.state = {
16+
xOffset: new Animated.Value(0)
17+
}
18+
}
19+
render() {
20+
return (
21+
<View style={{flex: 1, padding: 20}}>
22+
<Animated.View style={{
23+
width: 50,
24+
height: 50,
25+
backgroundColor: 'red',
26+
transform: [{
27+
translateX: this.state.xOffset
28+
}]
29+
}}>
30+
</Animated.View>
31+
<Animated.ScrollView
32+
scrollEventThrottle={16}
33+
horizontal={false}
34+
paginEnabled={false}
35+
showsHorizontalScrollIndicator={false}
36+
onScroll={Animated.event(
37+
[
38+
{
39+
nativeEvent: {
40+
contentOffset: {
41+
y: this.state.xOffset
42+
}
43+
}
44+
}
45+
],
46+
{useNativeDriver: true})
47+
}>
48+
{this.data.map((item, index) => {
49+
return (
50+
<View key={index} style={styles.row}>
51+
<Text>{`This is row ${item}`}</Text>
52+
</View>
53+
)
54+
})}
55+
</Animated.ScrollView>
56+
</View>
57+
);
58+
}
59+
}
60+
61+
const styles = StyleSheet.create({
62+
row: {
63+
padding: 10,
64+
backgroundColor: '#ccc',
65+
marginBottom: 5,
66+
flex: 1,
67+
width: Dimensions.get('window').width
68+
}
69+
});

AnimationExample/android/app/BUCK

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
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+
lib_deps = []
12+
13+
for jarfile in glob(['libs/*.jar']):
14+
name = 'jars__' + jarfile[jarfile.rindex('/') + 1: jarfile.rindex('.jar')]
15+
lib_deps.append(':' + name)
16+
prebuilt_jar(
17+
name = name,
18+
binary_jar = jarfile,
19+
)
20+
21+
for aarfile in glob(['libs/*.aar']):
22+
name = 'aars__' + aarfile[aarfile.rindex('/') + 1: aarfile.rindex('.aar')]
23+
lib_deps.append(':' + name)
24+
android_prebuilt_aar(
25+
name = name,
26+
aar = aarfile,
27+
)
28+
29+
android_library(
30+
name = "all-libs",
31+
exported_deps = lib_deps,
32+
)
33+
34+
android_library(
35+
name = "app-code",
36+
srcs = glob([
37+
"src/main/java/**/*.java",
38+
]),
39+
deps = [
40+
":all-libs",
41+
":build_config",
42+
":res",
43+
],
44+
)
45+
46+
android_build_config(
47+
name = "build_config",
48+
package = "com.animationexample",
49+
)
50+
51+
android_resource(
52+
name = "res",
53+
package = "com.animationexample",
54+
res = "src/main/res",
55+
)
56+
57+
android_binary(
58+
name = "app",
59+
keystore = "//android/keystores:debug",
60+
manifest = "src/main/AndroidManifest.xml",
61+
package_type = "debug",
62+
deps = [
63+
":app-code",
64+
],
65+
)

0 commit comments

Comments
 (0)