diff --git a/zh-cn/react-native-picker.md b/zh-cn/react-native-picker.md new file mode 100644 index 0000000..0e82c91 --- /dev/null +++ b/zh-cn/react-native-picker.md @@ -0,0 +1,314 @@ +> 模板版本:v0.2.2 + +

+

react-native-picker

+

+

+ + Supported platforms + + + License + +

+ +> [!TIP] [Github 地址](https://github.com/react-native-oh-library/react-native-picker) + +## 安装与使用 + +请到三方库的 Releases 发布地址查看配套的版本信息:[@react-native-oh-tpl/react-native-picker Releases](https://github.com/react-native-oh-library/react-native-picker/releases),并下载适用版本的 tgz 包。 + +进入到工程目录并输入以下命令: + +> [!TIP] # 处替换为 tgz 包的路径 + + + +#### **npm** + +```bash +npm install @react-native-oh-tpl/react-native-picker@file:# +``` + +#### **yarn** + +```bash +yarn add @react-native-oh-tpl/react-native-picker@file:# +``` + + + +下面的代码展示了这个库的基本使用场景: + +> [!WARNING] 使用时 import 的库名不变。 + +```js +import React from 'react'; +import { View, Button } from 'react-native'; +import Picker from 'react-native-picker'; + +const MyPicker = () => { + let data = { + pickerData: + [{ + a: [ + { + a1: [1, 2, 3, 4] + }, + { + a2: [5, 6, 7, 8] + }, + { + a3: [9, 10, 11, 12] + } + ] + }, + { + b: [ + { + b1: [11, 22, 33, 44] + }, + { + b2: [55, 66, 77, 88] + }, + { + b3: [99, 1010, 1111, 1212] + } + ] + }, + { + c: [ + { + c1: ['a', 'b', 'c'] + }, + { + c2: ['aa', 'bb', 'cc'] + }, + { + c3: ['aaa', 'bbb', 'ccc'] + } + ] + },], + isLoop: false, + selectedValue: ['b', 'b1', 22], + onPickerConfirm: data => { + console.log('onPickerConfirm:', data) + }, + onPickerCancel: data => { + console.log('onPickerCancel:', data); + }, + onPickerSelect: data => { + console.log('onPickerSelect:', data); + } + } + return ( + +