Skip to content

Commit 55dfe7c

Browse files
authored
Merge pull request #4 from ptomasroos/update-example-and-tests
Update example and tests
2 parents 07ab4e7 + 1937aa0 commit 55dfe7c

Some content is hidden

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

59 files changed

+12645
-436
lines changed

examples/Basic/.babelrc

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

examples/Basic/.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

examples/Basic/.flowconfig

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
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+
esproposal.optional_chaining=enable
33+
esproposal.nullish_coalescing=enable
34+
35+
module.system=haste
36+
module.system.haste.use_name_reducers=true
37+
# get basename
38+
module.system.haste.name_reducers='^.*/\([a-zA-Z0-9$_.-]+\.js\(\.flow\)?\)$' -> '\1'
39+
# strip .js or .js.flow suffix
40+
module.system.haste.name_reducers='^\(.*\)\.js\(\.flow\)?$' -> '\1'
41+
# strip .ios suffix
42+
module.system.haste.name_reducers='^\(.*\)\.ios$' -> '\1'
43+
module.system.haste.name_reducers='^\(.*\)\.android$' -> '\1'
44+
module.system.haste.name_reducers='^\(.*\)\.native$' -> '\1'
45+
module.system.haste.paths.blacklist=.*/__tests__/.*
46+
module.system.haste.paths.blacklist=.*/__mocks__/.*
47+
module.system.haste.paths.blacklist=<PROJECT_ROOT>/node_modules/react-native/Libraries/Animated/src/polyfills/.*
48+
module.system.haste.paths.whitelist=<PROJECT_ROOT>/node_modules/react-native/Libraries/.*
49+
50+
munge_underscores=true
51+
52+
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'
53+
54+
module.file_ext=.js
55+
module.file_ext=.jsx
56+
module.file_ext=.json
57+
module.file_ext=.native.js
58+
59+
suppress_type=$FlowIssue
60+
suppress_type=$FlowFixMe
61+
suppress_type=$FlowFixMeProps
62+
suppress_type=$FlowFixMeState
63+
64+
suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(<VERSION>\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)
65+
suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(<VERSION>\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)?:? #[0-9]+
66+
suppress_comment=\\(.\\|\n\\)*\\$FlowFixedInNextDeploy
67+
suppress_comment=\\(.\\|\n\\)*\\$FlowExpectedError
68+
69+
[version]
70+
^0.78.0

examples/Basic/.gitattributes

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

examples/Basic/.gitignore

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
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
57+
ios/Pods/

examples/Basic/.watchmanconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{}
Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,20 @@
1-
import React, { Component } from 'react';
1+
// @flow
2+
3+
import React from 'react';
24
import { AppRegistry, Text, View } from 'react-native';
35

46
import Scene1 from './Scene1';
57
import Scene2 from './Scene2';
68

7-
class Basic extends Component {
9+
type Props = {};
10+
11+
type State = {
12+
scene: string,
13+
};
14+
15+
class App extends React.Component<Props, State> {
816
state = {
9-
scene: 'Scene1'
17+
scene: 'Scene1',
1018
};
1119

1220
changeScene = scene => {
@@ -28,4 +36,4 @@ class Basic extends Component {
2836
}
2937
}
3038

31-
export default Basic;
39+
export default App;

examples/Basic/Gemfile

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
source "https://rubygems.org"
2+
3+
gem "xcodeproj"
4+
gem "cocoapods"
5+
gem "cocoapods-check"
6+
gem "cocoapods-fix-react-native"

examples/Basic/Gemfile.lock

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
GEM
2+
remote: https://rubygems.org/
3+
specs:
4+
CFPropertyList (3.0.0)
5+
activesupport (4.2.10)
6+
i18n (~> 0.7)
7+
minitest (~> 5.1)
8+
thread_safe (~> 0.3, >= 0.3.4)
9+
tzinfo (~> 1.1)
10+
atomos (0.1.3)
11+
claide (1.0.2)
12+
cocoapods (1.5.3)
13+
activesupport (>= 4.0.2, < 5)
14+
claide (>= 1.0.2, < 2.0)
15+
cocoapods-core (= 1.5.3)
16+
cocoapods-deintegrate (>= 1.0.2, < 2.0)
17+
cocoapods-downloader (>= 1.2.0, < 2.0)
18+
cocoapods-plugins (>= 1.0.0, < 2.0)
19+
cocoapods-search (>= 1.0.0, < 2.0)
20+
cocoapods-stats (>= 1.0.0, < 2.0)
21+
cocoapods-trunk (>= 1.3.0, < 2.0)
22+
cocoapods-try (>= 1.1.0, < 2.0)
23+
colored2 (~> 3.1)
24+
escape (~> 0.0.4)
25+
fourflusher (~> 2.0.1)
26+
gh_inspector (~> 1.0)
27+
molinillo (~> 0.6.5)
28+
nap (~> 1.0)
29+
ruby-macho (~> 1.1)
30+
xcodeproj (>= 1.5.7, < 2.0)
31+
cocoapods-check (1.0.2)
32+
cocoapods (~> 1.0)
33+
cocoapods-core (1.5.3)
34+
activesupport (>= 4.0.2, < 6)
35+
fuzzy_match (~> 2.0.4)
36+
nap (~> 1.0)
37+
cocoapods-deintegrate (1.0.2)
38+
cocoapods-downloader (1.2.2)
39+
cocoapods-fix-react-native (2018.10.31.23)
40+
cocoapods-plugins (1.0.0)
41+
nap
42+
cocoapods-search (1.0.0)
43+
cocoapods-stats (1.0.0)
44+
cocoapods-trunk (1.3.1)
45+
nap (>= 0.8, < 2.0)
46+
netrc (~> 0.11)
47+
cocoapods-try (1.1.0)
48+
colored2 (3.1.2)
49+
concurrent-ruby (1.1.3)
50+
escape (0.0.4)
51+
fourflusher (2.0.1)
52+
fuzzy_match (2.0.4)
53+
gh_inspector (1.1.3)
54+
i18n (0.9.5)
55+
concurrent-ruby (~> 1.0)
56+
minitest (5.11.3)
57+
molinillo (0.6.6)
58+
nanaimo (0.2.6)
59+
nap (1.1.0)
60+
netrc (0.11.0)
61+
ruby-macho (1.3.1)
62+
thread_safe (0.3.6)
63+
tzinfo (1.2.5)
64+
thread_safe (~> 0.1)
65+
xcodeproj (1.7.0)
66+
CFPropertyList (>= 2.3.3, < 4.0)
67+
atomos (~> 0.1.3)
68+
claide (>= 1.0.2, < 2.0)
69+
colored2 (~> 3.1)
70+
nanaimo (~> 0.2.6)
71+
72+
PLATFORMS
73+
ruby
74+
75+
DEPENDENCIES
76+
cocoapods
77+
cocoapods-check
78+
cocoapods-fix-react-native
79+
xcodeproj
80+
81+
BUNDLED WITH
82+
1.16.6

examples/Basic/Scene1.js

Lines changed: 23 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,18 @@
1-
import React, { Component } from 'react';
1+
// @flow
2+
import * as React from 'react';
23
import {
34
AppRegistry,
45
StyleSheet,
56
Text,
67
ScrollView,
78
Dimensions,
89
View,
9-
TouchableHighlight
10+
TouchableHighlight,
1011
} from 'react-native';
1112

12-
import { Keyframes } from '@ptomasroos/react-native-keyframes';
13+
import { Keyframes } from 'react-native-keyframes';
1314

14-
class Scene1 extends Component {
15+
class Scene1 extends React.Component {
1516
componentDidMount() {
1617
if (this.flirtAnimation) {
1718
this.flirtAnimation.start();
@@ -30,24 +31,16 @@ class Scene1 extends Component {
3031
return (
3132
<ScrollView>
3233
<Keyframes
33-
ref={ref => this.likeAnimation = ref}
34+
ref={ref => (this.likeAnimation = ref)}
3435
src={require('./like.kf.json')}
3536
style={{ width: 300, height: 300 }}
3637
/>
37-
<Text style={styles.welcome}>
38-
Scene1
39-
</Text>
40-
<Text style={styles.welcome}>
41-
Scene1
42-
</Text>
43-
<Text style={styles.welcome}>
44-
Scene1
45-
</Text>
46-
<Text style={styles.welcome}>
47-
Scene1
48-
</Text>
38+
<Text style={styles.welcome}>Scene1</Text>
39+
<Text style={styles.welcome}>Scene1</Text>
40+
<Text style={styles.welcome}>Scene1</Text>
41+
<Text style={styles.welcome}>Scene1</Text>
4942
<Keyframes
50-
ref={ref => this.flirtAnimation = ref}
43+
ref={ref => (this.flirtAnimation = ref)}
5144
src={require('./flirt.kf.json')}
5245
style={{ width: 300, height: 300 }}
5346
/>
@@ -65,38 +58,22 @@ class Scene1 extends Component {
6558
<Text>Play once</Text>
6659
</TouchableHighlight>
6760
</View>
68-
<Text style={styles.welcome}>
69-
Scene1
70-
</Text>
61+
<Text style={styles.welcome}>Scene1</Text>
7162
<TouchableHighlight onPress={() => this.props.changeScene('Scene2')}>
7263
<Text>Go to Scene2</Text>
7364
</TouchableHighlight>
74-
<Text style={styles.welcome}>
75-
Scene1
76-
</Text>
65+
<Text style={styles.welcome}>Scene1</Text>
7766
<Keyframes
78-
ref={ref => this.nearAnimation = ref}
67+
ref={ref => (this.nearAnimation = ref)}
7968
src={require('./near-you.kf.json')}
8069
style={{ width: 300, height: 300 }}
8170
/>
82-
<Text style={styles.welcome}>
83-
Scene1
84-
</Text>
85-
<Text style={styles.welcome}>
86-
Scene1
87-
</Text>
88-
<Text style={styles.welcome}>
89-
Scene1
90-
</Text>
91-
<Text style={styles.welcome}>
92-
Scene1
93-
</Text>
94-
<Text style={styles.welcome}>
95-
Scene1
96-
</Text>
97-
<Text style={styles.welcome}>
98-
Scene1
99-
</Text>
71+
<Text style={styles.welcome}>Scene1</Text>
72+
<Text style={styles.welcome}>Scene1</Text>
73+
<Text style={styles.welcome}>Scene1</Text>
74+
<Text style={styles.welcome}>Scene1</Text>
75+
<Text style={styles.welcome}>Scene1</Text>
76+
<Text style={styles.welcome}>Scene1</Text>
10077
</ScrollView>
10178
);
10279
}
@@ -105,13 +82,13 @@ class Scene1 extends Component {
10582
const styles = StyleSheet.create({
10683
container: {
10784
flex: 1,
108-
backgroundColor: '#F5FCFF'
85+
backgroundColor: '#F5FCFF',
10986
},
11087
welcome: {
11188
fontSize: 20,
11289
textAlign: 'center',
113-
margin: 10
114-
}
90+
margin: 10,
91+
},
11592
});
11693

11794
export default Scene1;

0 commit comments

Comments
 (0)