Skip to content

Commit 7467ee9

Browse files
authored
Merge pull request react-native-datetimepicker#1 from react-native-community/initial
Initial work to port DatePickeriOS
2 parents 8577b6f + 405b216 commit 7467ee9

Some content is hidden

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

72 files changed

+26608
-1
lines changed

.eslintrc.js

+279
Large diffs are not rendered by default.

.flowconfig

+90
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
[ignore]
2+
; This flowconfig is forked by platform - the only difference between them is which suffix is ignored.
3+
.*/*[.]android.js
4+
;.*/*[.]ios.js
5+
6+
; Ignore templates for 'react-native init'
7+
.*/local-cli/templates/.*
8+
9+
; Ignore the Dangerfile
10+
node_modules/react-native/bots/dangerfile.js
11+
12+
; Ignore "BUCK" generated dirs
13+
node_modules/react-native/\.buckd/
14+
15+
; Ignore unexpected extra "@providesModule"
16+
.*/node_modules/.*/node_modules/fbjs/.*
17+
18+
; Ignore duplicate module providers
19+
; For RN Apps installed via npm, "Libraries" folder is inside
20+
; "node_modules/react-native" but in the source repo it is in the root
21+
.*/Libraries/react-native/React.js
22+
23+
; Ignore polyfills
24+
.*/Libraries/polyfills/.*
25+
26+
; Ignore metro
27+
.*/node_modules/metro/.*
28+
29+
; Ignore "config-chain"'s test folder - it has a corrupt JSON file that's tripping flow
30+
.*/node_modules/config-chain/test/*.
31+
32+
; These should not be required directly
33+
; require from fbjs/lib instead: require('fbjs/lib/invariant')
34+
.*/node_modules/invariant/.*
35+
.*/node_modules/warning/.*
36+
37+
[include]
38+
39+
[libs]
40+
node_modules/react-native/Libraries/react-native/react-native-interface.js
41+
node_modules/react-native/flow/
42+
node_modules/react-native/flow-github/
43+
44+
[lints]
45+
46+
[options]
47+
emoji=true
48+
49+
esproposal.optional_chaining=enable
50+
esproposal.nullish_coalescing=enable
51+
52+
module.system=haste
53+
module.system.haste.use_name_reducers=true
54+
# keep the following in sync with server/haste/hasteImpl.js
55+
# get basename
56+
module.system.haste.name_reducers='^.*/\([a-zA-Z0-9$_.-]+\.js\(\.flow\)?\)$' -> '\1'
57+
# strip .js or .js.flow suffix
58+
module.system.haste.name_reducers='^\(.*\)\.js\(\.flow\)?$' -> '\1'
59+
# strip platform suffix
60+
module.system.haste.name_reducers='^\(.*\)\.ios$' -> '\1'
61+
module.system.haste.name_reducers='^\(.*\)\.android$' -> '\1'
62+
module.system.haste.name_reducers='^\(.*\)\.native$' -> '\1'
63+
module.system.haste.paths.blacklist=.*/__tests__/.*
64+
module.system.haste.paths.blacklist=.*/__mocks__/.*
65+
module.system.haste.paths.whitelist=<PROJECT_ROOT>/js/.*
66+
module.system.haste.paths.whitelist=<PROJECT_ROOT>/node_modules/react-native/Libraries/.*
67+
module.system.haste.paths.whitelist=<PROJECT_ROOT>/node_modules/react-native/RNTester/.*
68+
module.system.haste.paths.whitelist=<PROJECT_ROOT>/node_modules/react-native/IntegrationTests/.*
69+
module.system.haste.paths.blacklist=<PROJECT_ROOT>/node_modules/react-native/Libraries/Animated/src/polyfills/.*
70+
71+
munge_underscores=true
72+
73+
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'
74+
# Support the library import in examples
75+
module.name_mapper='^\@react-native-community/async-storage$' -> '<PROJECT_ROOT>/lib/AsyncStorage.js'
76+
77+
suppress_type=$FlowIssue
78+
suppress_type=$FlowFixMe
79+
suppress_type=$FlowFixMeProps
80+
suppress_type=$FlowFixMeState
81+
82+
suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(<VERSION>\\)? *\\(site=[a-z,_]*[react_native\\(_android\\)?_oss|react_native\\(_android\\)?_fb][a-z,_]*\\)?)\\)
83+
suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(<VERSION>\\)? *\\(site=[a-z,_]*[react_native\\(_android\\)?_oss|react_native\\(_android\\)?_fb][a-z,_]*\\)?)\\)?:? #[0-9]+
84+
suppress_comment=\\(.\\|\n\\)*\\$FlowFixedInNextDeploy
85+
suppress_comment=\\(.\\|\n\\)*\\$FlowExpectedError
86+
87+
[strict]
88+
89+
[version]
90+
^0.93.0

.gitignore

+48
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
# OSX
2+
#
3+
.DS_Store
4+
5+
# node.js
6+
#
7+
node_modules/
8+
npm-debug.log
9+
yarn-error.log
10+
11+
12+
# Xcode
13+
#
14+
build/
15+
*.pbxuser
16+
!default.pbxuser
17+
*.mode1v3
18+
!default.mode1v3
19+
*.mode2v3
20+
!default.mode2v3
21+
*.perspectivev3
22+
!default.perspectivev3
23+
xcuserdata
24+
*.xccheckout
25+
*.moved-aside
26+
DerivedData
27+
*.hmap
28+
*.ipa
29+
*.xcuserstate
30+
project.xcworkspace
31+
32+
33+
# Android/IntelliJ
34+
#
35+
build/
36+
.idea
37+
.gradle
38+
local.properties
39+
*.iml
40+
41+
# BUCK
42+
buck-out/
43+
\.buckd/
44+
*.keystore
45+
46+
# Editor config
47+
.vscode
48+

LICENSE.md

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2019 React Native Community
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
# react-native-datetimepicker
1+
# React Native DateTimePicker

RNDateTimePicker.podspec

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
require 'json'
2+
3+
package = JSON.parse(File.read(File.join(__dir__, 'package.json')))
4+
5+
Pod::Spec.new do |s|
6+
s.name = "RNDateTimePicker"
7+
s.version = package['version']
8+
s.summary = package['description']
9+
s.description = package['description']
10+
s.license = package['license']
11+
s.author = package['author']
12+
s.homepage = package['homepage']
13+
s.platform = :ios, "10.0"
14+
s.source = { :git => "https://github.com/react-native-community/react-native-datetimepicker", :tag => "master" }
15+
s.source_files = "ios/*.{h,m}"
16+
s.requires_arc = true
17+
18+
s.dependency "React"
19+
end

example/.buckconfig

+6
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/.flowconfig

+70
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.86.0

example/.gitattributes

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
*.pbxproj -text

example/.gitignore

+56
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

example/.watchmanconfig

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{}

example/App.js

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
import React, {Component} from 'react';
2+
import {StyleSheet, View, Text} from 'react-native';
3+
import DatePicker from 'react-native-datetimepicker';
4+
5+
type Props = {};
6+
export default class App extends Component<Props> {
7+
state = {
8+
date: new Date(),
9+
}
10+
11+
setDate = date => {
12+
this.setState({date});
13+
}
14+
15+
render() {
16+
return (
17+
<View style={styles.container}>
18+
<View style={styles.header}>
19+
<Text style={styles.text}>Example DateTime Picker</Text>
20+
</View>
21+
<DatePicker value={this.state.date} onDateChange={this.setDate} />
22+
</View>
23+
);
24+
}
25+
}
26+
27+
const styles = StyleSheet.create({
28+
container: {
29+
flex: 1,
30+
justifyContent: 'center',
31+
backgroundColor: '#F5FCFF',
32+
},
33+
header: {
34+
alignItems: 'center',
35+
marginBottom: 20,
36+
},
37+
text: {
38+
fontSize: 20,
39+
fontWeight: 'bold',
40+
},
41+
});

0 commit comments

Comments
 (0)