Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
R
react-native-picker
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Jira
Jira
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
ym
react-native-picker
Commits
ceb35185
Commit
ceb35185
authored
Dec 07, 2017
by
xwenliang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update PickerTest
parent
80cc9a3e
Changes
33
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
33 changed files
with
1225 additions
and
448 deletions
+1225
-448
README.md
README.md
+2
-2
example/PickerTest/.babelrc
example/PickerTest/.babelrc
+3
-0
example/PickerTest/.flowconfig
example/PickerTest/.flowconfig
+23
-69
example/PickerTest/.gitattributes
example/PickerTest/.gitattributes
+1
-0
example/PickerTest/.gitignore
example/PickerTest/.gitignore
+16
-3
example/PickerTest/PickerTest.js
example/PickerTest/PickerTest.js
+229
-0
example/PickerTest/__tests__/App.js
example/PickerTest/__tests__/App.js
+12
-0
example/PickerTest/android/app/BUCK
example/PickerTest/android/app/BUCK
+26
-27
example/PickerTest/android/app/build.gradle
example/PickerTest/android/app/build.gradle
+14
-3
example/PickerTest/android/app/proguard-rules.pro
example/PickerTest/android/app/proguard-rules.pro
+4
-0
example/PickerTest/android/app/src/main/AndroidManifest.xml
example/PickerTest/android/app/src/main/AndroidManifest.xml
+2
-1
example/PickerTest/android/app/src/main/java/com/pickertest/MainApplication.java
...oid/app/src/main/java/com/pickertest/MainApplication.java
+14
-4
example/PickerTest/android/app/src/main/res/values/strings.xml
...le/PickerTest/android/app/src/main/res/values/strings.xml
+0
-1
example/PickerTest/android/build.gradle
example/PickerTest/android/build.gradle
+1
-1
example/PickerTest/android/gradle/wrapper/gradle-wrapper.properties
...ckerTest/android/gradle/wrapper/gradle-wrapper.properties
+1
-1
example/PickerTest/android/keystores/BUCK
example/PickerTest/android/keystores/BUCK
+6
-6
example/PickerTest/android/settings.gradle
example/PickerTest/android/settings.gradle
+2
-2
example/PickerTest/app.json
example/PickerTest/app.json
+4
-0
example/PickerTest/index.android.js
example/PickerTest/index.android.js
+0
-4
example/PickerTest/index.ios.js
example/PickerTest/index.ios.js
+0
-4
example/PickerTest/index.js
example/PickerTest/index.js
+2
-230
example/PickerTest/ios/PickerTest-tvOS/Info.plist
example/PickerTest/ios/PickerTest-tvOS/Info.plist
+54
-0
example/PickerTest/ios/PickerTest-tvOSTests/Info.plist
example/PickerTest/ios/PickerTest-tvOSTests/Info.plist
+24
-0
example/PickerTest/ios/PickerTest.xcodeproj/project.pbxproj
example/PickerTest/ios/PickerTest.xcodeproj/project.pbxproj
+577
-48
example/PickerTest/ios/PickerTest.xcodeproj/xcshareddata/xcschemes/PickerTest-tvOS.xcscheme
...xcodeproj/xcshareddata/xcschemes/PickerTest-tvOS.xcscheme
+129
-0
example/PickerTest/ios/PickerTest.xcodeproj/xcshareddata/xcschemes/PickerTest.xcscheme
...Test.xcodeproj/xcshareddata/xcschemes/PickerTest.xcscheme
+22
-5
example/PickerTest/ios/PickerTest/AppDelegate.m
example/PickerTest/ios/PickerTest/AppDelegate.m
+3
-3
example/PickerTest/ios/PickerTest/Images.xcassets/Contents.json
...e/PickerTest/ios/PickerTest/Images.xcassets/Contents.json
+6
-0
example/PickerTest/ios/PickerTest/Info.plist
example/PickerTest/ios/PickerTest/Info.plist
+3
-1
example/PickerTest/ios/PickerTestTests/PickerTestTests.m
example/PickerTest/ios/PickerTestTests/PickerTestTests.m
+3
-3
example/PickerTest/package.json
example/PickerTest/package.json
+13
-3
index.js
index.js
+28
-26
package.json
package.json
+1
-1
No files found.
README.md
View file @
ceb35185
...
...
@@ -45,7 +45,7 @@
#### Step 1 - install
```
```
javascript
npm
install
react
-
native
-
picker
--
save
```
...
...
@@ -190,4 +190,4 @@ $ pod install
]
```
### For pure javascript version -> [v3.0.5](https://github.com/beefe/react-native-picker/tree/pure-javascript-version)
### For pure javascript version -> [v3.0.5](https://github.com/beefe/react-native-picker/tree/pure-javascript-version)
example/PickerTest/.babelrc
0 → 100644
View file @
ceb35185
{
"presets": ["react-native"]
}
example/PickerTest/.flowconfig
View file @
ceb35185
[ignore]
; We fork some components by platform
.*/*[.]android.js
# We fork some components by platform.
.*/*.web.js
.*/*.android.js
; Ignore "BUCK" generated dirs
<PROJECT_ROOT>/\.buckd/
# Some modules have their own node_modules with overlap
.*/node_modules/
node-haste
/.*
; Ignore unexpected extra "@providesModule"
.*/node_modules/
.*/node_modules/fbjs
/.*
# Ugh
.*/node_modules/babel.*
.*/node_modules/babylon.*
.*/node_modules/invariant.*
# Ignore react and fbjs where there are overlaps, but don't ignore
# anything that react-native relies on
.*/node_modules/fbjs/lib/Map.js
.*/node_modules/fbjs/lib/ErrorUtils.js
# Flow has a built-in definition for the 'react' module which we prefer to use
# over the currently-untyped source
.*/node_modules/react/react.js
.*/node_modules/react/lib/React.js
.*/node_modules/react/lib/ReactDOM.js
.*/__mocks__/.*
.*/__tests__/.*
.*/commoner/test/source/widget/share.js
# Ignore commoner tests
.*/node_modules/commoner/test/.*
# See https://github.com/facebook/flow/issues/442
.*/react-tools/node_modules/commoner/lib/reader.js
# Ignore jest
.*/node_modules/jest-cli/.*
# Ignore Website
.*/website/.*
# Ignore generators
.*/local-cli/generator.*
# Ignore BUCK generated folders
.*\.buckd/
.*/node_modules/is-my-json-valid/test/.*\.json
.*/node_modules/iconv-lite/encodings/tables/.*\.json
.*/node_modules/y18n/test/.*\.json
.*/node_modules/spdx-license-ids/spdx-license-ids.json
.*/node_modules/spdx-exceptions/index.json
.*/node_modules/resolve/test/subdirs/node_modules/a/b/c/x.json
.*/node_modules/resolve/lib/core.json
.*/node_modules/jsonparse/samplejson/.*\.json
.*/node_modules/json5/test/.*\.json
.*/node_modules/ua-parser-js/test/.*\.json
.*/node_modules/builtin-modules/builtin-modules.json
.*/node_modules/binary-extensions/binary-extensions.json
.*/node_modules/url-regex/tlds.json
.*/node_modules/joi/.*\.json
.*/node_modules/isemail/.*\.json
.*/node_modules/tr46/.*\.json
; Ignore duplicate module providers
; For RN Apps installed via npm, "Libraries" folder is inside
; "node_modules/react-native" but in the source repo it is in the root
.*/Libraries/react-native/React.js
; Ignore polyfills
.*/Libraries/polyfills/.*
[include]
[libs]
node_modules/react-native/Libraries/react-native/react-native-interface.js
node_modules/react-native/flow
flow/
node_modules/react-native/flow/
[options]
module.system=hast
e
emoji=tru
e
esproposal.class_static_fields=enable
esproposal.class_instance_fields=enable
module.system=haste
munge_underscores=true
module.name_mapper='^image![a-zA-Z0-9$_-]+$' -> 'GlobalImageStub'
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'
suppress_type=$FlowIssue
suppress_type=$FlowFixMe
suppress_type=$FlowFixMeProps
suppress_type=$FlowFixMeState
suppress_type=$FixMe
suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(>=0\\.\\(
2[0-4]\\|1
[0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)
suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(>=0\\.\\(
2[0-4]\\|1
[0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)?:? #[0-9]+
suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(>=0\\.\\(
5[0-7]\\|[1-4]
[0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)
suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(>=0\\.\\(
5[0-7]\\|[1-4]
[0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)?:? #[0-9]+
suppress_comment=\\(.\\|\n\\)*\\$FlowFixedInNextDeploy
suppress_comment=\\(.\\|\n\\)*\\$FlowExpectedError
unsafe.enable_getters_and_setters=true
[version]
0.24
.0
^0.57
.0
example/PickerTest/.gitattributes
0 → 100644
View file @
ceb35185
*.pbxproj -text
example/PickerTest/.gitignore
View file @
ceb35185
...
...
@@ -22,19 +22,32 @@ DerivedData
*.xcuserstate
project.xcworkspace
# Android/IJ
# Android/I
ntelli
J
#
build/
.idea
.gradle
local.properties
*.iml
# node.js
#
node_modules/
npm-debug.log
yarn-error.log
# BUCK
buck-out/
\.buckd/
android/app/libs
android/keystores/debug.keystore
*.keystore
# fastlane
#
# It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the
# screenshots whenever they are needed.
# For more information about the recommended setup visit:
# https://docs.fastlane.tools/best-practices/source-control/
*/fastlane/report.xml
*/fastlane/Preview.html
*/fastlane/screenshots
example/PickerTest/PickerTest.js
0 → 100644
View file @
ceb35185
/**
* Bootstrap of PickerTest
*/
import
React
,
{
Component
}
from
'
react
'
;
import
{
View
,
Text
,
TextInput
,
TouchableOpacity
,
Dimensions
}
from
'
react-native
'
;
import
Picker
from
'
react-native-picker
'
;
import
area
from
'
./area.json
'
;
export
default
class
PickerTest
extends
Component
{
constructor
(
props
,
context
)
{
super
(
props
,
context
);
}
_createDateData
()
{
let
date
=
[];
for
(
let
i
=
1970
;
i
<
2020
;
i
++
){
let
month
=
[];
for
(
let
j
=
1
;
j
<
13
;
j
++
){
let
day
=
[];
if
(
j
===
2
){
for
(
let
k
=
1
;
k
<
29
;
k
++
){
day
.
push
(
k
+
'
日
'
);
}
//Leap day for years that are divisible by 4, such as 2000, 2004
if
(
i
%
4
===
0
){
day
.
push
(
29
+
'
日
'
);
}
}
else
if
(
j
in
{
1
:
1
,
3
:
1
,
5
:
1
,
7
:
1
,
8
:
1
,
10
:
1
,
12
:
1
}){
for
(
let
k
=
1
;
k
<
32
;
k
++
){
day
.
push
(
k
+
'
日
'
);
}
}
else
{
for
(
let
k
=
1
;
k
<
31
;
k
++
){
day
.
push
(
k
+
'
日
'
);
}
}
let
_month
=
{};
_month
[
j
+
'
月
'
]
=
day
;
month
.
push
(
_month
);
}
let
_date
=
{};
_date
[
i
+
'
年
'
]
=
month
;
date
.
push
(
_date
);
}
return
date
;
}
_createAreaData
()
{
let
data
=
[];
let
len
=
area
.
length
;
for
(
let
i
=
0
;
i
<
len
;
i
++
){
let
city
=
[];
for
(
let
j
=
0
,
cityLen
=
area
[
i
][
'
city
'
].
length
;
j
<
cityLen
;
j
++
){
let
_city
=
{};
_city
[
area
[
i
][
'
city
'
][
j
][
'
name
'
]]
=
area
[
i
][
'
city
'
][
j
][
'
area
'
];
city
.
push
(
_city
);
}
let
_data
=
{};
_data
[
area
[
i
][
'
name
'
]]
=
city
;
data
.
push
(
_data
);
}
return
data
;
}
_showDatePicker
()
{
Picker
.
init
({
pickerData
:
this
.
_createDateData
(),
pickerToolBarFontSize
:
16
,
pickerFontSize
:
16
,
pickerFontColor
:
[
255
,
0
,
0
,
1
],
onPickerConfirm
:
(
pickedValue
,
pickedIndex
)
=>
{
console
.
log
(
'
date
'
,
pickedValue
,
pickedIndex
);
},
onPickerCancel
:
(
pickedValue
,
pickedIndex
)
=>
{
console
.
log
(
'
date
'
,
pickedValue
,
pickedIndex
);
},
onPickerSelect
:
(
pickedValue
,
pickedIndex
)
=>
{
console
.
log
(
'
date
'
,
pickedValue
,
pickedIndex
);
}
});
Picker
.
show
();
}
_showAreaPicker
()
{
Picker
.
init
({
pickerData
:
this
.
_createAreaData
(),
selectedValue
:
[
'
河北
'
,
'
唐山
'
,
'
古冶区
'
],
onPickerConfirm
:
pickedValue
=>
{
console
.
log
(
'
area
'
,
pickedValue
);
},
onPickerCancel
:
pickedValue
=>
{
console
.
log
(
'
area
'
,
pickedValue
);
},
onPickerSelect
:
pickedValue
=>
{
//Picker.select(['山东', '青岛', '黄岛区'])
console
.
log
(
'
area
'
,
pickedValue
);
}
});
Picker
.
show
();
}
_showTimePicker
()
{
let
years
=
[],
months
=
[],
days
=
[],
hours
=
[],
minutes
=
[];
for
(
let
i
=
1
;
i
<
51
;
i
++
){
years
.
push
(
i
+
1980
);
}
for
(
let
i
=
1
;
i
<
13
;
i
++
){
months
.
push
(
i
);
hours
.
push
(
i
);
}
for
(
let
i
=
1
;
i
<
32
;
i
++
){
days
.
push
(
i
);
}
for
(
let
i
=
1
;
i
<
61
;
i
++
){
minutes
.
push
(
i
);
}
let
pickerData
=
[
years
,
months
,
days
,
[
'
am
'
,
'
pm
'
],
hours
,
minutes
];
let
date
=
new
Date
();
let
selectedValue
=
[
date
.
getFullYear
(),
date
.
getMonth
()
+
1
,
date
.
getDate
(),
date
.
getHours
()
>
11
?
'
pm
'
:
'
am
'
,
date
.
getHours
()
===
12
?
12
:
date
.
getHours
()
%
12
,
date
.
getMinutes
()
];
Picker
.
init
({
pickerData
,
selectedValue
,
pickerTitleText
:
'
Select Date and Time
'
,
wheelFlex
:
[
2
,
1
,
1
,
2
,
1
,
1
],
onPickerConfirm
:
pickedValue
=>
{
console
.
log
(
'
area
'
,
pickedValue
);
},
onPickerCancel
:
pickedValue
=>
{
console
.
log
(
'
area
'
,
pickedValue
);
},
onPickerSelect
:
pickedValue
=>
{
let
targetValue
=
[...
pickedValue
];
if
(
parseInt
(
targetValue
[
1
])
===
2
){
if
(
targetValue
[
0
]
%
4
===
0
&&
targetValue
[
2
]
>
29
){
targetValue
[
2
]
=
29
;
}
else
if
(
targetValue
[
0
]
%
4
!==
0
&&
targetValue
[
2
]
>
28
){
targetValue
[
2
]
=
28
;
}
}
else
if
(
targetValue
[
1
]
in
{
4
:
1
,
6
:
1
,
9
:
1
,
11
:
1
}
&&
targetValue
[
2
]
>
30
){
targetValue
[
2
]
=
30
;
}
// forbidden some value such as some 2.29, 4.31, 6.31...
if
(
JSON
.
stringify
(
targetValue
)
!==
JSON
.
stringify
(
pickedValue
)){
// android will return String all the time,but we put Number into picker at first
// so we need to convert them to Number again
targetValue
.
map
((
v
,
k
)
=>
{
if
(
k
!==
3
){
targetValue
[
k
]
=
parseInt
(
v
);
}
});
Picker
.
select
(
targetValue
);
pickedValue
=
targetValue
;
}
}
});
Picker
.
show
();
}
_toggle
()
{
Picker
.
toggle
();
}
_isPickerShow
(){
Picker
.
isPickerShow
(
status
=>
{
alert
(
status
);
});
}
render
()
{
return
(
<
View
style
=
{{
height
:
Dimensions
.
get
(
'
window
'
).
height
}}
>
<
TouchableOpacity
style
=
{{
marginTop
:
40
,
marginLeft
:
20
}}
onPress
=
{
this
.
_showDatePicker
.
bind
(
this
)}
>
<
Text
>
DatePicker
<
/Text
>
<
/TouchableOpacity
>
<
TouchableOpacity
style
=
{{
marginTop
:
10
,
marginLeft
:
20
}}
onPress
=
{
this
.
_showTimePicker
.
bind
(
this
)}
>
<
Text
>
TimePicker
<
/Text
>
<
/TouchableOpacity
>
<
TouchableOpacity
style
=
{{
marginTop
:
10
,
marginLeft
:
20
}}
onPress
=
{
this
.
_showAreaPicker
.
bind
(
this
)}
>
<
Text
>
AreaPicker
<
/Text
>
<
/TouchableOpacity
>
<
TouchableOpacity
style
=
{{
marginTop
:
10
,
marginLeft
:
20
}}
onPress
=
{
this
.
_toggle
.
bind
(
this
)}
>
<
Text
>
toggle
<
/Text
>
<
/TouchableOpacity
>
<
TouchableOpacity
style
=
{{
marginTop
:
10
,
marginLeft
:
20
}}
onPress
=
{
this
.
_isPickerShow
.
bind
(
this
)}
>
<
Text
>
isPickerShow
<
/Text
>
<
/TouchableOpacity
>
<
TextInput
placeholder
=
"
test picker with input
"
style
=
{{
height
:
40
,
borderColor
:
'
gray
'
,
borderWidth
:
1
,
marginLeft
:
20
,
marginRight
:
20
,
marginTop
:
10
,
padding
:
5
}}
/
>
<
/View
>
);
}
};
\ No newline at end of file
example/PickerTest/__tests__/App.js
0 → 100644
View file @
ceb35185
import
'
react-native
'
;
import
React
from
'
react
'
;
import
App
from
'
../App
'
;
// Note: test renderer must be required after react-native.
import
renderer
from
'
react-test-renderer
'
;
it
(
'
renders correctly
'
,
()
=>
{
const
tree
=
renderer
.
create
(
<
App
/>
);
});
example/PickerTest/android/app/BUCK
View file @
ceb35185
import
re
# To learn about Buck see [Docs](https://buckbuild.com/).
# To run your application with Buck:
# - install Buck
...
...
@@ -11,8 +9,9 @@ import re
#
lib_deps
=
[]
for
jarfile
in
glob
([
'libs/*.jar'
]):
name
=
'jars__'
+
re
.
sub
(
r'^.*/([^/]+)\
.j
ar$'
,
r'\1'
,
jarfile
)
name
=
'jars__'
+
jarfile
[
jarfile
.
rindex
(
'/'
)
+
1
:
jarfile
.
rindex
(
'.jar'
)]
lib_deps
.
append
(
':'
+
name
)
prebuilt_jar
(
name
=
name
,
...
...
@@ -20,7 +19,7 @@ for jarfile in glob(['libs/*.jar']):
)
for
aarfile
in
glob
([
'libs/*.aar'
]):
name
=
'aars__'
+
re
.
sub
(
r'^.*/([^/]+)\
.
aar$'
,
r'\1'
,
aarfile
)
name
=
'aars__'
+
aarfile
[
aarfile
.
rindex
(
'/'
)
+
1
:
aarfile
.
rindex
(
'.aar'
)]
lib_deps
.
append
(
':'
+
name
)
android_prebuilt_aar
(
name
=
name
,
...
...
@@ -28,39 +27,39 @@ for aarfile in glob(['libs/*.aar']):
)
android_library
(
name
=
'all-libs'
,
exported_deps
=
lib_deps
name
=
"all-libs"
,
exported_deps
=
lib_deps
,
)
android_library
(
name
=
'app-code'
,
srcs
=
glob
([
'src/main/java/**/*.java'
,
]),
deps
=
[
':all-libs'
,
':build_config'
,
':res'
,
],
name
=
"app-code"
,
srcs
=
glob
([
"src/main/java/**/*.java"
,
]),
deps
=
[
":all-libs"
,
":build_config"
,
":res"
,
],
)
android_build_config
(
name
=
'build_config'
,
package
=
'com.pickertest'
,
name
=
"build_config"
,
package
=
"com.pickertest"
,
)
android_resource
(
name
=
'res'
,
res
=
'src/main/res'
,
package
=
'com.pickertest'
,
name
=
"res"
,
package
=
"com.pickertest"
,
res
=
"src/main/res"
,
)
android_binary
(
name
=
'app'
,
package_type
=
'debug'
,
manifest
=
'src/main/AndroidManifest.xml'
,
keystore
=
'//android/keystores:debug'
,
deps
=
[
':app-code'
,
],
name
=
"app"
,
keystore
=
"//android/keystores:debug"
,
manifest
=
"src/main/AndroidManifest.xml"
,
package_type
=
"debug"
,
deps
=
[
":app-code"
,
],
)
example/PickerTest/android/app/build.gradle
View file @
ceb35185
...
...
@@ -33,6 +33,13 @@ import com.android.build.OutputFile
* // bundleInPaidRelease: true,
* // bundleInBeta: true,
*
* // whether to disable dev mode in custom build variants (by default only disabled in release)
* // for example: to disable dev mode in the staging build type (if configured)
* devDisabledInStaging: true,
* // The configuration property can be in the following formats
* // 'devDisabledIn${productFlavor}${buildType}'
* // 'devDisabledIn${buildType}'
*
* // the root of your project, i.e. where "package.json" lives
* root: "../../",
*
...
...
@@ -58,13 +65,17 @@ import com.android.build.OutputFile
* inputExcludes: ["android/**", "ios/**"],
*
* // override which node gets called and with what additional arguments
* nodeExecutableAndArgs: ["node"]
* nodeExecutableAndArgs: ["node"]
,
*
* // supply additional arguments to the packager
* extraPackagerArgs: []
* ]
*/
project
.
ext
.
react
=
[
entryFile:
"index.js"
]
apply
from:
"../../node_modules/react-native/react.gradle"
/**
...
...
@@ -135,6 +146,6 @@ dependencies {
// Run this once to be able to run the application with BUCK
// puts all compile dependencies into folder libs for BUCK to use
task
copyDownloadableDepsToLibs
(
type:
Copy
)
{
from
configurations
.
compile
into
'libs'
from
configurations
.
compile
into
'libs'
}
example/PickerTest/android/app/proguard-rules.pro
View file @
ceb35185
...
...
@@ -50,6 +50,10 @@
-
dontwarn
com
.
facebook
.
react
.
**
#
TextLayoutBuilder
uses
a
non
-
public
Android
constructor
within
StaticLayout
.
#
See
libs
/
proxy
/
src
/
main
/
java
/
com
/
facebook
/
fbui
/
textlayoutbuilder
/
proxy
for
details
.
-
dontwarn
android
.
text
.
StaticLayout
#
okhttp
-
keepattributes
Signature
...
...
example/PickerTest/android/app/src/main/AndroidManifest.xml
View file @
ceb35185
...
...
@@ -19,7 +19,8 @@
<activity
android:name=
".MainActivity"
android:label=
"@string/app_name"
android:configChanges=
"keyboard|keyboardHidden|orientation|screenSize"
>
android:configChanges=
"keyboard|keyboardHidden|orientation|screenSize"
android:windowSoftInputMode=
"adjustResize"
>
<intent-filter>
<action
android:name=
"android.intent.action.MAIN"
/>
<category
android:name=
"android.intent.category.LAUNCHER"
/>
...
...
example/PickerTest/android/app/src/main/java/com/pickertest/MainApplication.java
View file @
ceb35185
package
com.pickertest
;
import
android.app.Application
;
import
android.util.Log
;
import
com.facebook.react.ReactApplication
;
import
com.beefe.picker.PickerViewPackage
;
import
com.facebook.react.ReactInstanceManager
;
import
com.facebook.react.ReactNativeHost
;
import
com.facebook.react.ReactPackage
;
import
com.facebook.react.shell.MainReactPackage
;
import
com.facebook.soloader.SoLoader
;
import
java.util.Arrays
;
import
java.util.List
;
...
...
@@ -17,7 +16,7 @@ public class MainApplication extends Application implements ReactApplication {
private
final
ReactNativeHost
mReactNativeHost
=
new
ReactNativeHost
(
this
)
{
@Override
p
rotected
boolean
getUseDeveloperSupport
()
{
p
ublic
boolean
getUseDeveloperSupport
()
{
return
BuildConfig
.
DEBUG
;
}
...
...
@@ -28,10 +27,21 @@ public class MainApplication extends Application implements ReactApplication {
new
PickerViewPackage
()
);
}
@Override
protected
String
getJSMainModuleName
()
{
return
"index"
;
}
};
@Override
public
ReactNativeHost
getReactNativeHost
()
{
return
mReactNativeHost
;
return
mReactNativeHost
;
}
@Override
public
void
onCreate
()
{
super
.
onCreate
();
SoLoader
.
init
(
this
,
/* native exopackage */
false
);
}
}
example/PickerTest/android/app/src/main/res/values/strings.xml
View file @
ceb35185
<resources>
<string
name=
"app_name"
>
PickerTest
</string>
</resources>
example/PickerTest/android/build.gradle
View file @
ceb35185
...
...
@@ -5,7 +5,7 @@ buildscript {
jcenter
()
}
dependencies
{
classpath
'com.android.tools.build:gradle:
1.3.1
'
classpath
'com.android.tools.build:gradle:
2.2.3
'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
...
...
example/PickerTest/android/gradle/wrapper/gradle-wrapper.properties
View file @
ceb35185
...
...
@@ -2,4 +2,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath
=
wrapper/dists
zipStoreBase
=
GRADLE_USER_HOME
zipStorePath
=
wrapper/dists
distributionUrl
=
https
\:
//services.gradle.org/distributions/gradle-2.
4
-all.zip
distributionUrl
=
https
\:
//services.gradle.org/distributions/gradle-2.
14.1
-all.zip
example/PickerTest/android/keystores/BUCK
View file @
ceb35185
keystore
(
name
=
'debug'
,
store
=
'debug.keystore'
,
properties
=
'debug.keystore.properties'
,
visibility
=
[
'PUBLIC'
,
],
name
=
"debug"
,
properties
=
"debug.keystore.properties"
,
store
=
"debug.keystore"
,
visibility
=
[
"PUBLIC"
,
],
)
example/PickerTest/android/settings.gradle
View file @
ceb35185
rootProject
.
name
=
'PickerTest'
include
':app'
include
':react-native-picker'
project
(
':react-native-picker'
).
projectDir
=
new
File
(
rootProject
.
projectDir
,
'../node_modules/react-native-picker/android'
)
include
':app'
example/PickerTest/app.json
0 → 100644
View file @
ceb35185
{
"name"
:
"PickerTest"
,
"displayName"
:
"PickerTest"
}
\ No newline at end of file
example/PickerTest/index.android.js
deleted
100644 → 0
View file @
80cc9a3e
/**
* react-native-picker example for android
*/
import
'
./index.js
'
;
\ No newline at end of file
example/PickerTest/index.ios.js
deleted
100644 → 0
View file @
80cc9a3e
/**
* react-native-picker example for ios
*/
import
'
./index.js
'
;
\ No newline at end of file
example/PickerTest/index.js
View file @
ceb35185
/**
* Bootstrap of PickerTest
*/
import
React
,
{
Component
}
from
'
react
'
;
import
{
AppRegistry
,
View
,
Text
,
TextInput
,
TouchableOpacity
,
Dimensions
}
from
'
react-native
'
;
import
Picker
from
'
react-native-picker
'
;
import
area
from
'
./area.json
'
;
class
PickerTest
extends
Component
{
constructor
(
props
,
context
)
{
super
(
props
,
context
);
}
_createDateData
()
{
let
date
=
[];
for
(
let
i
=
1950
;
i
<
2050
;
i
++
){
let
month
=
[];
for
(
let
j
=
1
;
j
<
13
;
j
++
){
let
day
=
[];
if
(
j
===
2
){
for
(
let
k
=
1
;
k
<
29
;
k
++
){
day
.
push
(
k
+
'
日
'
);
}
//Leap day for years that are divisible by 4, such as 2000, 2004
if
(
i
%
4
===
0
){
day
.
push
(
29
+
'
日
'
);
}
}
else
if
(
j
in
{
1
:
1
,
3
:
1
,
5
:
1
,
7
:
1
,
8
:
1
,
10
:
1
,
12
:
1
}){
for
(
let
k
=
1
;
k
<
32
;
k
++
){
day
.
push
(
k
+
'
日
'
);
}
}
else
{
for
(
let
k
=
1
;
k
<
31
;
k
++
){
day
.
push
(
k
+
'
日
'
);
}
}
let
_month
=
{};
_month
[
j
+
'
月
'
]
=
day
;
month
.
push
(
_month
);
}
let
_date
=
{};
_date
[
i
+
'
年
'
]
=
month
;
date
.
push
(
_date
);
}
return
date
;
}
_createAreaData
()
{
let
data
=
[];
let
len
=
area
.
length
;
for
(
let
i
=
0
;
i
<
len
;
i
++
){
let
city
=
[];
for
(
let
j
=
0
,
cityLen
=
area
[
i
][
'
city
'
].
length
;
j
<
cityLen
;
j
++
){
let
_city
=
{};
_city
[
area
[
i
][
'
city
'
][
j
][
'
name
'
]]
=
area
[
i
][
'
city
'
][
j
][
'
area
'
];
city
.
push
(
_city
);
}
let
_data
=
{};
_data
[
area
[
i
][
'
name
'
]]
=
city
;
data
.
push
(
_data
);
}
return
data
;
}
_showDatePicker
()
{
Picker
.
init
({
pickerData
:
this
.
_createDateData
(),
pickerToolBarFontSize
:
16
,
pickerFontSize
:
16
,
pickerFontColor
:
[
255
,
0
,
0
,
1
],
onPickerConfirm
:
(
pickedValue
,
pickedIndex
)
=>
{
console
.
log
(
'
date
'
,
pickedValue
,
pickedIndex
);
},
onPickerCancel
:
(
pickedValue
,
pickedIndex
)
=>
{
console
.
log
(
'
date
'
,
pickedValue
,
pickedIndex
);
},
onPickerSelect
:
(
pickedValue
,
pickedIndex
)
=>
{
console
.
log
(
'
date
'
,
pickedValue
,
pickedIndex
);
}
});
Picker
.
show
();
}
_showAreaPicker
()
{
Picker
.
init
({
pickerData
:
this
.
_createAreaData
(),
selectedValue
:
[
'
河北
'
,
'
唐山
'
,
'
古冶区
'
],
onPickerConfirm
:
pickedValue
=>
{
console
.
log
(
'
area
'
,
pickedValue
);
},
onPickerCancel
:
pickedValue
=>
{
console
.
log
(
'
area
'
,
pickedValue
);
},
onPickerSelect
:
pickedValue
=>
{
//Picker.select(['山东', '青岛', '黄岛区'])
console
.
log
(
'
area
'
,
pickedValue
);
}
});
Picker
.
show
();
}
_showTimePicker
()
{
let
years
=
[],
months
=
[],
days
=
[],
hours
=
[],
minutes
=
[];
for
(
let
i
=
1
;
i
<
51
;
i
++
){
years
.
push
(
i
+
1980
);
}
for
(
let
i
=
1
;
i
<
13
;
i
++
){
months
.
push
(
i
);
hours
.
push
(
i
);
}
for
(
let
i
=
1
;
i
<
32
;
i
++
){
days
.
push
(
i
);
}
for
(
let
i
=
1
;
i
<
61
;
i
++
){
minutes
.
push
(
i
);
}
let
pickerData
=
[
years
,
months
,
days
,
[
'
am
'
,
'
pm
'
],
hours
,
minutes
];
let
date
=
new
Date
();
let
selectedValue
=
[
[
date
.
getFullYear
()],
[
date
.
getMonth
()
+
1
],
[
date
.
getDate
()],
[
date
.
getHours
()
>
11
?
'
pm
'
:
'
am
'
],
[
date
.
getHours
()
===
12
?
12
:
date
.
getHours
()
%
12
],
[
date
.
getMinutes
()]
];
Picker
.
init
({
pickerData
,
selectedValue
,
pickerTitleText
:
'
Select Date and Time
'
,
wheelFlex
:
[
2
,
1
,
1
,
2
,
1
,
1
],
onPickerConfirm
:
pickedValue
=>
{
console
.
log
(
'
area
'
,
pickedValue
);
},
onPickerCancel
:
pickedValue
=>
{
console
.
log
(
'
area
'
,
pickedValue
);
},
onPickerSelect
:
pickedValue
=>
{
let
targetValue
=
[...
pickedValue
];
if
(
parseInt
(
targetValue
[
1
])
===
2
){
if
(
targetValue
[
0
]
%
4
===
0
&&
targetValue
[
2
]
>
29
){
targetValue
[
2
]
=
29
;
}
else
if
(
targetValue
[
0
]
%
4
!==
0
&&
targetValue
[
2
]
>
28
){
targetValue
[
2
]
=
28
;
}
}
else
if
(
targetValue
[
1
]
in
{
4
:
1
,
6
:
1
,
9
:
1
,
11
:
1
}
&&
targetValue
[
2
]
>
30
){
targetValue
[
2
]
=
30
;
}
// forbidden some value such as some 2.29, 4.31, 6.31...
if
(
JSON
.
stringify
(
targetValue
)
!==
JSON
.
stringify
(
pickedValue
)){
// android will return String all the time,but we put Number into picker at first
// so we need to convert them to Number again
targetValue
.
map
((
v
,
k
)
=>
{
if
(
k
!==
3
){
targetValue
[
k
]
=
parseInt
(
v
);
}
});
Picker
.
select
(
targetValue
);
pickedValue
=
targetValue
;
}
}
});
Picker
.
show
();
}
_toggle
()
{
Picker
.
toggle
();
}
_isPickerShow
(){
Picker
.
isPickerShow
(
status
=>
{
alert
(
status
);
});
}
render
()
{
return
(
<
View
style
=
{{
height
:
Dimensions
.
get
(
'
window
'
).
height
}}
>
<
TouchableOpacity
style
=
{{
marginTop
:
40
,
marginLeft
:
20
}}
onPress
=
{
this
.
_showDatePicker
.
bind
(
this
)}
>
<
Text
>
DatePicker
<
/Text
>
<
/TouchableOpacity
>
<
TouchableOpacity
style
=
{{
marginTop
:
10
,
marginLeft
:
20
}}
onPress
=
{
this
.
_showTimePicker
.
bind
(
this
)}
>
<
Text
>
TimePicker
<
/Text
>
<
/TouchableOpacity
>
<
TouchableOpacity
style
=
{{
marginTop
:
10
,
marginLeft
:
20
}}
onPress
=
{
this
.
_showAreaPicker
.
bind
(
this
)}
>
<
Text
>
AreaPicker
<
/Text
>
<
/TouchableOpacity
>
<
TouchableOpacity
style
=
{{
marginTop
:
10
,
marginLeft
:
20
}}
onPress
=
{
this
.
_toggle
.
bind
(
this
)}
>
<
Text
>
toggle
<
/Text
>
<
/TouchableOpacity
>
<
TouchableOpacity
style
=
{{
marginTop
:
10
,
marginLeft
:
20
}}
onPress
=
{
this
.
_isPickerShow
.
bind
(
this
)}
>
<
Text
>
isPickerShow
<
/Text
>
<
/TouchableOpacity
>
<
TextInput
placeholder
=
"
test picker with input
"
style
=
{{
height
:
40
,
borderColor
:
'
gray
'
,
borderWidth
:
1
,
marginLeft
:
20
,
marginRight
:
20
,
marginTop
:
10
,
padding
:
5
}}
/
>
<
/View
>
);
}
};
import
{
AppRegistry
}
from
'
react-native
'
;
import
PickerTest
from
'
./PickerTest
'
;
AppRegistry
.
registerComponent
(
'
PickerTest
'
,
()
=>
PickerTest
);
example/PickerTest/ios/PickerTest-tvOS/Info.plist
0 → 100644
View file @
ceb35185
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist
version=
"1.0"
>
<dict>
<key>
CFBundleDevelopmentRegion
</key>
<string>
en
</string>
<key>
CFBundleExecutable
</key>
<string>
$(EXECUTABLE_NAME)
</string>
<key>
CFBundleIdentifier
</key>
<string>
org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier)
</string>
<key>
CFBundleInfoDictionaryVersion
</key>
<string>
6.0
</string>
<key>
CFBundleName
</key>
<string>
$(PRODUCT_NAME)
</string>
<key>
CFBundlePackageType
</key>
<string>
APPL
</string>
<key>
CFBundleShortVersionString
</key>
<string>
1.0
</string>
<key>
CFBundleSignature
</key>
<string>
????
</string>
<key>
CFBundleVersion
</key>
<string>
1
</string>
<key>
LSRequiresIPhoneOS
</key>
<true/>
<key>
UILaunchStoryboardName
</key>
<string>
LaunchScreen
</string>
<key>
UIRequiredDeviceCapabilities
</key>
<array>
<string>
armv7
</string>
</array>
<key>
UISupportedInterfaceOrientations
</key>
<array>
<string>
UIInterfaceOrientationPortrait
</string>
<string>
UIInterfaceOrientationLandscapeLeft
</string>
<string>
UIInterfaceOrientationLandscapeRight
</string>
</array>
<key>
UIViewControllerBasedStatusBarAppearance
</key>
<false/>
<key>
NSLocationWhenInUseUsageDescription
</key>
<string></string>
<key>
NSAppTransportSecurity
</key>
<!--See http://ste.vn/2015/06/10/configuring-app-transport-security-ios-9-osx-10-11/ -->
<dict>
<key>
NSExceptionDomains
</key>
<dict>
<key>
localhost
</key>
<dict>
<key>
NSExceptionAllowsInsecureHTTPLoads
</key>
<true/>
</dict>
</dict>
</dict>
</dict>
</plist>
example/PickerTest/ios/PickerTest-tvOSTests/Info.plist
0 → 100644
View file @
ceb35185
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist
version=
"1.0"
>
<dict>
<key>
CFBundleDevelopmentRegion
</key>
<string>
en
</string>
<key>
CFBundleExecutable
</key>
<string>
$(EXECUTABLE_NAME)
</string>
<key>
CFBundleIdentifier
</key>
<string>
org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier)
</string>
<key>
CFBundleInfoDictionaryVersion
</key>
<string>
6.0
</string>
<key>
CFBundleName
</key>
<string>
$(PRODUCT_NAME)
</string>
<key>
CFBundlePackageType
</key>
<string>
BNDL
</string>
<key>
CFBundleShortVersionString
</key>
<string>
1.0
</string>
<key>
CFBundleSignature
</key>
<string>
????
</string>
<key>
CFBundleVersion
</key>
<string>
1
</string>
</dict>
</plist>
example/PickerTest/ios/PickerTest.xcodeproj/project.pbxproj
View file @
ceb35185
This diff is collapsed.
Click to expand it.
example/PickerTest/ios/PickerTest.xcodeproj/xcshareddata/xcschemes/PickerTest-tvOS.xcscheme
0 → 100644
View file @
ceb35185
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion =
"0820"
version =
"1.3"
>
<BuildAction
parallelizeBuildables =
"NO"
buildImplicitDependencies =
"YES"
>
<BuildActionEntries>
<BuildActionEntry
buildForTesting =
"YES"
buildForRunning =
"YES"
buildForProfiling =
"YES"
buildForArchiving =
"YES"
buildForAnalyzing =
"YES"
>
<BuildableReference
BuildableIdentifier =
"primary"
BlueprintIdentifier =
"2D2A28121D9B038B00D4039D"
BuildableName =
"libReact.a"
BlueprintName =
"React-tvOS"
ReferencedContainer =
"container:../node_modules/react-native/React/React.xcodeproj"
>
</BuildableReference>
</BuildActionEntry>
<BuildActionEntry
buildForTesting =
"YES"
buildForRunning =
"YES"
buildForProfiling =
"YES"
buildForArchiving =
"YES"
buildForAnalyzing =
"YES"
>
<BuildableReference
BuildableIdentifier =
"primary"
BlueprintIdentifier =
"2D02E47A1E0B4A5D006451C7"
BuildableName =
"PickerTest-tvOS.app"
BlueprintName =
"PickerTest-tvOS"
ReferencedContainer =
"container:PickerTest.xcodeproj"
>
</BuildableReference>
</BuildActionEntry>
<BuildActionEntry
buildForTesting =
"YES"
buildForRunning =
"YES"
buildForProfiling =
"NO"
buildForArchiving =
"NO"
buildForAnalyzing =
"YES"
>
<BuildableReference
BuildableIdentifier =
"primary"
BlueprintIdentifier =
"2D02E48F1E0B4A5D006451C7"
BuildableName =
"PickerTest-tvOSTests.xctest"
BlueprintName =
"PickerTest-tvOSTests"
ReferencedContainer =
"container:PickerTest.xcodeproj"
>
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration =
"Debug"
selectedDebuggerIdentifier =
"Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier =
"Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv =
"YES"
>
<Testables>
<TestableReference
skipped =
"NO"
>
<BuildableReference
BuildableIdentifier =
"primary"
BlueprintIdentifier =
"2D02E48F1E0B4A5D006451C7"
BuildableName =
"PickerTest-tvOSTests.xctest"
BlueprintName =
"PickerTest-tvOSTests"
ReferencedContainer =
"container:PickerTest.xcodeproj"
>
</BuildableReference>
</TestableReference>
</Testables>
<MacroExpansion>
<BuildableReference
BuildableIdentifier =
"primary"
BlueprintIdentifier =
"2D02E47A1E0B4A5D006451C7"
BuildableName =
"PickerTest-tvOS.app"
BlueprintName =
"PickerTest-tvOS"
ReferencedContainer =
"container:PickerTest.xcodeproj"
>
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</TestAction>
<LaunchAction
buildConfiguration =
"Debug"
selectedDebuggerIdentifier =
"Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier =
"Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle =
"0"
useCustomWorkingDirectory =
"NO"
ignoresPersistentStateOnLaunch =
"NO"
debugDocumentVersioning =
"YES"
debugServiceExtension =
"internal"
allowLocationSimulation =
"YES"
>
<BuildableProductRunnable
runnableDebuggingMode =
"0"
>
<BuildableReference
BuildableIdentifier =
"primary"
BlueprintIdentifier =
"2D02E47A1E0B4A5D006451C7"
BuildableName =
"PickerTest-tvOS.app"
BlueprintName =
"PickerTest-tvOS"
ReferencedContainer =
"container:PickerTest.xcodeproj"
>
</BuildableReference>
</BuildableProductRunnable>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration =
"Release"
shouldUseLaunchSchemeArgsEnv =
"YES"
savedToolIdentifier =
""
useCustomWorkingDirectory =
"NO"
debugDocumentVersioning =
"YES"
>
<BuildableProductRunnable
runnableDebuggingMode =
"0"
>
<BuildableReference
BuildableIdentifier =
"primary"
BlueprintIdentifier =
"2D02E47A1E0B4A5D006451C7"
BuildableName =
"PickerTest-tvOS.app"
BlueprintName =
"PickerTest-tvOS"
ReferencedContainer =
"container:PickerTest.xcodeproj"
>
</BuildableReference>
</BuildableProductRunnable>
</ProfileAction>
<AnalyzeAction
buildConfiguration =
"Debug"
>
</AnalyzeAction>
<ArchiveAction
buildConfiguration =
"Release"
revealArchiveInOrganizer =
"YES"
>
</ArchiveAction>
</Scheme>
example/PickerTest/ios/PickerTest.xcodeproj/xcshareddata/xcschemes/PickerTest.xcscheme
View file @
ceb35185
...
...
@@ -3,9 +3,23 @@
LastUpgradeVersion =
"0620"
version =
"1.3"
>
<BuildAction
parallelizeBuildables =
"
YES
"
parallelizeBuildables =
"
NO
"
buildImplicitDependencies =
"YES"
>
<BuildActionEntries>
<BuildActionEntry
buildForTesting =
"YES"
buildForRunning =
"YES"
buildForProfiling =
"YES"
buildForArchiving =
"YES"
buildForAnalyzing =
"YES"
>
<BuildableReference
BuildableIdentifier =
"primary"
BlueprintIdentifier =
"83CBBA2D1A601D0E00E9B192"
BuildableName =
"libReact.a"
BlueprintName =
"React"
ReferencedContainer =
"container:../node_modules/react-native/React/React.xcodeproj"
>
</BuildableReference>
</BuildActionEntry>
<BuildActionEntry
buildForTesting =
"YES"
buildForRunning =
"YES"
...
...
@@ -37,10 +51,10 @@
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration =
"Debug"
selectedDebuggerIdentifier =
"Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier =
"Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv =
"YES"
buildConfiguration =
"Debug"
>
shouldUseLaunchSchemeArgsEnv =
"YES"
>
<Testables>
<TestableReference
skipped =
"NO"
>
...
...
@@ -62,15 +76,18 @@
ReferencedContainer =
"container:PickerTest.xcodeproj"
>
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</TestAction>
<LaunchAction
buildConfiguration =
"Debug"
selectedDebuggerIdentifier =
"Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier =
"Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle =
"0"
useCustomWorkingDirectory =
"NO"
buildConfiguration =
"Debug"
ignoresPersistentStateOnLaunch =
"NO"
debugDocumentVersioning =
"YES"
debugServiceExtension =
"internal"
allowLocationSimulation =
"YES"
>
<BuildableProductRunnable
runnableDebuggingMode =
"0"
>
...
...
@@ -86,10 +103,10 @@
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration =
"Release"
shouldUseLaunchSchemeArgsEnv =
"YES"
savedToolIdentifier =
""
useCustomWorkingDirectory =
"NO"
buildConfiguration =
"Release"
debugDocumentVersioning =
"YES"
>
<BuildableProductRunnable
runnableDebuggingMode =
"0"
>
...
...
example/PickerTest/ios/PickerTest/AppDelegate.m
View file @
ceb35185
...
...
@@ -9,8 +9,8 @@
#import "AppDelegate.h"
#import
"RCTBundleURLProvider.h"
#import
"RCTRootView.h"
#import
<React/RCTBundleURLProvider.h>
#import
<React/RCTRootView.h>
@implementation
AppDelegate
...
...
@@ -18,7 +18,7 @@
{
NSURL
*
jsCodeLocation
;
jsCodeLocation
=
[[
RCTBundleURLProvider
sharedSettings
]
jsBundleURLForBundleRoot
:
@"index
.ios
"
fallbackResource
:
nil
];
jsCodeLocation
=
[[
RCTBundleURLProvider
sharedSettings
]
jsBundleURLForBundleRoot
:
@"index"
fallbackResource
:
nil
];
RCTRootView
*
rootView
=
[[
RCTRootView
alloc
]
initWithBundleURL
:
jsCodeLocation
moduleName:
@"PickerTest"
...
...
example/PickerTest/ios/PickerTest/Images.xcassets/Contents.json
0 → 100644
View file @
ceb35185
{
"info"
:
{
"version"
:
1
,
"author"
:
"xcode"
}
}
example/PickerTest/ios/PickerTest/Info.plist
View file @
ceb35185
...
...
@@ -4,6 +4,8 @@
<dict>
<key>
CFBundleDevelopmentRegion
</key>
<string>
en
</string>
<key>
CFBundleDisplayName
</key>
<string>
PickerTest
</string>
<key>
CFBundleExecutable
</key>
<string>
$(EXECUTABLE_NAME)
</string>
<key>
CFBundleIdentifier
</key>
...
...
@@ -45,7 +47,7 @@
<dict>
<key>
localhost
</key>
<dict>
<key>
NS
Temporary
ExceptionAllowsInsecureHTTPLoads
</key>
<key>
NSExceptionAllowsInsecureHTTPLoads
</key>
<true/>
</dict>
</dict>
...
...
example/PickerTest/ios/PickerTestTests/PickerTestTests.m
View file @
ceb35185
...
...
@@ -10,8 +10,8 @@
#import <UIKit/UIKit.h>
#import <XCTest/XCTest.h>
#import
"RCTLog.h"
#import
"RCTRootView.h"
#import
<React/RCTLog.h>
#import
<React/RCTRootView.h>
#define TIMEOUT_SECONDS 600
#define TEXT_TO_LOOK_FOR @"Welcome to React Native!"
...
...
@@ -37,7 +37,7 @@
-
(
void
)
testRendersWelcomeScreen
{
UIViewController
*
vc
=
[[[
[
UIApplication
sharedApplication
]
delegate
]
window
]
rootViewController
];
UIViewController
*
vc
=
[[[
RCTSharedApplication
()
delegate
]
window
]
rootViewController
];
NSDate
*
date
=
[
NSDate
dateWithTimeIntervalSinceNow
:
TIMEOUT_SECONDS
];
BOOL
foundElement
=
NO
;
...
...
example/PickerTest/package.json
View file @
ceb35185
...
...
@@ -3,11 +3,21 @@
"version"
:
"0.0.1"
,
"private"
:
true
,
"scripts"
:
{
"start"
:
"node_modules/react-native/packager/packager.sh"
"start"
:
"node node_modules/react-native/local-cli/cli.js start"
,
"test"
:
"jest"
},
"dependencies"
:
{
"react"
:
"1
5.3.1
"
,
"react-native"
:
"^0.
32
.0"
,
"react"
:
"1
6.0.0
"
,
"react-native"
:
"^0.
51
.0"
,
"react-native-picker"
:
"github:beefe/react-native-picker"
},
"devDependencies"
:
{
"babel-jest"
:
"21.2.0"
,
"babel-preset-react-native"
:
"4.0.0"
,
"jest"
:
"21.2.1"
,
"react-test-renderer"
:
"16.0.0"
},
"jest"
:
{
"preset"
:
"react-native"
}
}
index.js
View file @
ceb35185
...
...
@@ -4,36 +4,38 @@ import {
NativeAppEventEmitter
}
from
'
react-native
'
;
let
ios
=
Platform
.
OS
===
'
ios
'
;
let
android
=
Platform
.
OS
===
'
android
'
;
let
Picker
=
NativeModules
.
BEEPickerManager
;
const
ios
=
Platform
.
OS
===
'
ios
'
;
const
android
=
Platform
.
OS
===
'
android
'
;
const
Picker
=
NativeModules
.
BEEPickerManager
;
const
options
=
{
isLoop
:
false
,
pickerConfirmBtnText
:
'
confirm
'
,
pickerCancelBtnText
:
'
cancel
'
,
pickerTitleText
:
'
pls select
'
,
pickerConfirmBtnColor
:
[
1
,
186
,
245
,
1
],
pickerCancelBtnColor
:
[
1
,
186
,
245
,
1
],
pickerTitleColor
:
[
20
,
20
,
20
,
1
],
pickerToolBarBg
:
[
232
,
232
,
232
,
1
],
pickerBg
:
[
196
,
199
,
206
,
1
],
wheelFlex
:
[
1
,
1
,
1
],
pickerData
:
[],
selectedValue
:
[],
onPickerConfirm
(){},
onPickerCancel
(){},
onPickerSelect
(){},
pickerToolBarFontSize
:
16
,
pickerFontSize
:
16
,
pickerFontColor
:
[
31
,
31
,
31
,
1
]
};
export
default
{
init
(
options
){
let
opt
=
{
isLoop
:
false
,
pickerConfirmBtnText
:
'
confirm
'
,
pickerCancelBtnText
:
'
cancel
'
,
pickerTitleText
:
'
pls select
'
,
pickerConfirmBtnColor
:
[
1
,
186
,
245
,
1
],
pickerCancelBtnColor
:
[
1
,
186
,
245
,
1
],
pickerTitleColor
:
[
20
,
20
,
20
,
1
],
pickerToolBarBg
:
[
232
,
232
,
232
,
1
],
pickerBg
:
[
196
,
199
,
206
,
1
],
wheelFlex
:
[
1
,
1
,
1
],
pickerData
:
[],
selectedValue
:
[],
onPickerConfirm
(){},
onPickerCancel
(){},
onPickerSelect
(){},
//4.0.12 add
pickerToolBarFontSize
:
16
,
pickerFontSize
:
16
,
pickerFontColor
:
[
31
,
31
,
31
,
1
],
...
options
init
(
params
){
const
opt
=
{
...
options
,
...
params
};
le
t
fnConf
=
{
cons
t
fnConf
=
{
confirm
:
opt
.
onPickerConfirm
,
cancel
:
opt
.
onPickerCancel
,
select
:
opt
.
onPickerSelect
...
...
package.json
View file @
ceb35185
{
"name"
:
"react-native-picker"
,
"version"
:
"4.3.
0
"
,
"version"
:
"4.3.
1
"
,
"description"
:
"A Native Picker with high performance."
,
"main"
:
"index.js"
,
"types"
:
"index.d.ts"
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment