Skip to content

Commit

Permalink
修复ios原生相关的部分
Browse files Browse the repository at this point in the history
  • Loading branch information
尚博信_王强 committed Dec 26, 2023
1 parent 8672c40 commit e561c8f
Show file tree
Hide file tree
Showing 16 changed files with 2,012 additions and 28 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -76,3 +76,6 @@ android/keystores/debug.keystore

# generated by bob
lib/

# Run Prettier
prettier --write .
10 changes: 10 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
dist/
node_modules/
*.json
*.md
*.ts
*.js
*.html
*.css
example/
src/
112 changes: 109 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,117 @@ npm install react-native-ui-kit-picker
## Usage

```js
import { multiply } from 'react-native-ui-kit-picker';
import { ShowTimePicker,ShowNormalPicker,ShowCityPicker,ShowLinkagePicker } from 'react-native-ui-kit-picker';

let defaultArray = [
{
"label":'主标题一',
'value':[
{
"label":'石家庄市',
'value':'1'
},
{
"label":'唐山市',
'value':'2'
},
{
"label":'秦皇岛市',
'value':'3'
}
]
},
{
"label":'主标题二',
'value':[
{
"label":'太原市',
'value':'1'
},
{
"label":'大同市',
'value':'2'
},
{
"label":'阳泉市',
'value':'3'
}
]
}
]

export default function App() {

const [time,setTime] = React.useState('')
const [sex,setSex] = React.useState<{label?:string,value?:string}>({})
const [city,setCity] = React.useState({
province:'',
city:'',
area:''
})
const [label,setLabel] = React.useState('')

console.log('new Date',new Date('2020-01-01'))

return (
<View style={styles.container}>
<Button title={'时间选择器'} onPress={()=>{
ShowTimePicker({
pattern:'yyyy-MM-dd',
title:'请选择时间',
mixDate:'2020-01-01',
maxDate:'2024-12-31',
selectDate : time
}).then(res=>{
console.log('res',res)
setTime(res)
})
}}/>
<Text>选择的时间:{time}</Text>
<Button title={'普通选择器'} onPress={()=>{
ShowNormalPicker({
array:[
{label:'',value:'1'},
{label:'',value:'2'},
],
selectItem:sex
}).then(res=>{
console.log('res',res.label)
setSex(res)
})
}}/>
<Text>选择的性别:{sex.label}</Text>
<Button title={'城市选择器'} onPress={()=>{
ShowCityPicker({
title:'城市选择器',
selcetCity:city
}).then(res=>{
console.log('res',res)
setCity({
province:res.province,
city:res.city,
area:res.area
})
})
}}/>
<Text>城市选择器:{city.province + city.city + city.area}</Text>
<Button title={'多级联动选择器'} onPress={()=>{
ShowLinkagePicker({
array:defaultArray
}).then(res=>{
console.log('res',res)
setLabel(`${res.label}-${res.value.label}`)
}).catch(err=>{
console.log('err',err)
})
}}/>
<Text>二级联动选择的内容{label}</Text>
</View>
);
}


// ...

const result = await multiply(3, 7);
```

## Contributing
Expand Down
2 changes: 2 additions & 0 deletions example/ios/.xcode.env.local
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export NODE_BINARY=/opt/homebrew/bin/node

2 changes: 1 addition & 1 deletion example/ios/Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ target 'UiKitPickerExample' do
#
# Note that if you have use_frameworks! enabled, Flipper will not work and
# you should disable the next line.
:flipper_configuration => flipper_config,
# :flipper_configuration => flipper_config,
# An absolute path to your application root.
:app_path => "#{Pod::Config.instance.installation_root}/.."
)
Expand Down
Loading

0 comments on commit e561c8f

Please sign in to comment.