Skip to content

Component to use drag gesture to expand or collapse a view size.

License

Notifications You must be signed in to change notification settings

sjwall/react-native-drag-expand

Repository files navigation

react-native-drag-expand

Bring your own UI, headless drag expand view.

npm version npm downloads GitHub license PRs Welcome



Demo

Installing react-native-drag-expand

To install react-native-drag-expand:

npm install react-native-drag-expand

Next, add the view:

import {DragExpandView} from 'react-native-drag-expand'
import {Text, View} from 'react-native'

export default function App() {
  return (
    // Styled view container
    <View>
      <DragExpandView>
        <DragExpandView.Collapsed>
          <View>
            <Text>Your collapsed content</Text>
          </View>
        </DragExpandView.Collapsed>
        <DragExpandView.Expanded>
          <View>
            <Text>Your expanded content</Text>
          </View>
        </DragExpandView.Expanded>
        <DragExpandView.Knob>
          <View>
            <Text>Your drag hold point view</Text>
          </View>
        </DragExpandView.Knob>
      </DragExpandView>
    </View>
  )
}