0.3.0 • Published 4 years ago

react-native-dropdown-list v0.3.0

Weekly downloads
59
License
MIT
Repository
github
Last release
4 years ago

How

npm i react-native-dropdown-list
import { Option, useDropdownMenu } from 'react-native-dropdown-list'

const INIT_SELECTED_ID = '限价委托'

const App: FC = () => {
  const [selectedId, setSelectedId] = useState(INIT_SELECTED_ID)
  const OPTIONS: Option[] = useMemo(
    () =>
      [
        '限价委托',
        '高级限价委托',
        '止盈止损',
        '跟踪委托',
        '冰山委托',
        '时间加权委托',
      ].map(a => ({ id: a, title: a, onSelect: () => setSelectedId(a) })),
    [setSelectedId],
  )
  const { btnRef, menu, toggle } = useDropdownMenu({
    options: OPTIONS,
    selectedId,
  })

  return (
    <>
      <StatusBar barStyle="light-content" />
      <Container>
        <Btn ref={btnRef} onPress={toggle}>
          <BtnText>{selectedId}</BtnText>
        </Btn>
        {menu}
      </Container>
    </>
  )
}
0.3.0

4 years ago

0.2.1

4 years ago

0.2.2

4 years ago

0.2.0

4 years ago

0.1.1

4 years ago

0.1.0

4 years ago

0.0.9

4 years ago

0.0.8

4 years ago

0.0.7

4 years ago

0.0.5

4 years ago

0.0.4

4 years ago

0.0.6

4 years ago

0.0.3

4 years ago

0.0.2

4 years ago

0.0.1

4 years ago