A cross-platform (iOS / Android) single and multiple-choice React Native component.

Overview

react-native-multiple-choice

A cross-platform (iOS / Android) single and multiple-choice React Native component.

Install

npm i react-native-multiple-choice --save

Usage

Here is an overview of the component usage.

<MultipleChoice
    options={[
    'Lorem ipsum dolor sit',
    'Lorem ipsum',
    'Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua.',
    'Lorem ipsum dolor sit amet, consetetur',
    'Lorem ipsum dolor'
    ]}
    selectedOptions={['Lorem ipsum']}
    maxSelectedOptions={2}
    onSelection={(option)=>alert(option + ' was selected!')}
/>

Props

  • style - {} custom style of the list
  • optionStyle - {} custom style of the option element
  • options - [] required array of options
  • selectedOptions - [] optional array of initially selected options
  • maxSelectedOptions - int optional maximum number of selectable options
  • onSelection - function(option){} option selection callback
  • renderIndicator - function(option) should return a selected/deselected indicator node, default: check mark image
  • renderSeparator - function(option) should return a separator node that is displayed between the options, default: gray line
  • renderText - function(option) should return a text node, default: text node
  • renderRow - function(option) should return a option view
  • disabled - bool if set to true component is disabled and can't be interacted with

Screenshot

example

You might also like...
iOS/Android image picker with support for camera, video, configurable compression, multiple images and cropping
iOS/Android image picker with support for camera, video, configurable compression, multiple images and cropping

react-native-image-crop-picker iOS/Android image picker with support for camera, video, configurable compression, multiple images and cropping Result

⚛ Cross-platform React Native dialogs based on the Modal component
⚛ Cross-platform React Native dialogs based on the Modal component

React Native Simple Dialogs ⚛ Cross-platform React Native dialogs based on the Modal component. Features Custom Dialog Confirm Dialog Progress Dialog

React-Native cross-platform, calendar component.
React-Native cross-platform, calendar component.

React Native Calendar Datepicker Description This project aims at providing developers with a cross-platform, highly customizable, calendar date picke

react-native-wheel-picker ★190 - React native cross platform picker.
react-native-wheel-picker ★190 - React native cross platform picker.

react-native-wheel-picker Introduction Cross platform Picker component based on React-native. Since picker is originally supported by ios while Androi

Simple, performant & type-safe cross platform navigation in React Native / React Native Web
Simple, performant & type-safe cross platform navigation in React Native / React Native Web

Simple and performant cross platform navigation on iOS, Android and the web with simple and type-safe api for React 18 (alpha)

Tailwindcss-react-native: Use Tailwindcss in your cross platform React Native applications

tailwindcss-react-native Use Tailwindcss in your cross platform React Native applications. This library is currently stabilising for a v1 release. Fol

Smooth and fast cross platform Material Design date and time picker for React Native Paper
Smooth and fast cross platform Material Design date and time picker for React Native Paper

Smooth and fast cross platform Material Design date and time picker for React Native Paper

A cross-platform bridge that allows you to enable and disable the screen idle timer in your React Native app

react-native-idle-timer A cross-platform bridge that allows you to enable and disable the screen idle timer in your React Native app Install npm insta

Picker is a cross-platform UI component for selecting an item from a list of options.
Picker is a cross-platform UI component for selecting an item from a list of options.

@react-native-picker/picker Android iOS PickerIOS Windows MacOS Supported Versions @react-native-picker/picker react-native react-native-windows = 2.

Comments
  • Not supported in 0.61.5 react native version as List view is deprecated.

    Not supported in 0.61.5 react native version as List view is deprecated.

    Invariant Violation: ListView has been removed from React Native. See https://fb.me/nolistview for more information or use deprecated-react-native-listview.

    This error is located at: in MultipleChoice (at FeatureDevelopmentDetails.js:780) in RCTView (at FeatureDevelopmentDetails.js:777) in RCTView (at FeatureDevelopmentDetails.js:642) in RCTView (at FeatureDevelopmentDetails.js:638) in RCTScrollContentView (at ScrollView.js:1038) in RCTScrollView (at ScrollView.js:1178) in ScrollView (at FeatureDevelopmentDetails.js:636) in RCTView (at FeatureDevelopmentDetails.js:613) in FeatureDevelopmentDetails (created by SceneView) in SceneView (at StackViewLayout.js:795) in RCTView (at createAnimatedComponent.js:151) in AnimatedComponent (at StackViewCard.js:69) in RCTView (at createAnimatedComponent.js:151) in AnimatedComponent (at screens.native.js:59) in Screen (at StackViewCard.js:57) in Card (at createPointerEventsContainer.js:27) in Container (at StackViewLayout.js:860) in RCTView (at screens.native.js:83) in ScreenContainer (at StackViewLayout.js:311) in RCTView (at createAnimatedComponent.js:151) in AnimatedComponent (at StackViewLayout.js:307) in PanGestureHandler (at StackViewLayout.js:300) in StackViewLayout (at withOrientation.js:30) in withOrientation (at StackView.js:79) in RCTView (at Transitioner.js:215) in Transitioner (at StackView.js:22) in StackView (created by Navigator) in Navigator (at createKeyboardAwareNavigator.js:12) in KeyboardAwareNavigator (at createAppContainer.js:388) in NavigationContainer (at ReactComponents/index.ios.js:30) in MyApp (at renderApplication.js:40) in RCTView (at AppContainer.js:101) in RCTView (at AppContainer.js:119) in AppContainer (at renderApplication.js:39)

    Object.defineProperty$argument_2.get react-native-implementation.js:359:8 MultipleChoice#constructor index.js:43:19 renderRoot [native code]:0 runRootCallback [native code]:0 unstable_runWithPriority scheduler.development.js:643:23 Component.prototype.setState react.development.js:325:31 componentDidMount FeatureDevelopmentDetails.js:245:21 tryCatch runtime.js:45:44 invoke runtime.js:271:30 tryCatch runtime.js:45:44 invoke runtime.js:135:28 Promise.resolve.then$argument_0 runtime.js:145:19 tryCallOne core.js:37:14 setImmediate$argument_0 core.js:123:25 _callTimer JSTimers.js:146:14 _callImmediatesPass JSTimers.js:194:17 callImmediates JSTimers.js:458:30 callImmediates [native code]:0 flushedQueue [native code]:0 invokeCallbackAndReturnFlushedQueue [native code]:0 Can you please upgrade this package by using Flatlist please?

    opened by vtrioremya 2
  • Android version is having scrolling issue if fixed height is provided for multiple choice

    Android version is having scrolling issue if fixed height is provided for multiple choice

    Hi,

    I have a screen in which i have other components and also react-native-multiple-choice i have given fixed height as i don't want it to increase the screen height all wrapped in scrollview. The screen works perfectly on ios and i am able to scroll whole screen as well as the react-native-multiple-choice but same code doesn't work on android.

    Following is the code please check and let me know if i am doing anything wrong or missing anything:

    <ScrollView
          showsVerticalScrollIndicator={false}
          ref="scroll" >
            <TouchableWithoutFeedback onPress={dismissKeyboard}>
              <View>
                <View style={[ComponentStyles.componentMargins, ComponentStyles.topMargin]}>
                  <Text style={[ComponentStyles.headerText]}>Please tell us about your music teaching experience. {'\n'}How many years have you been teaching for ?</Text>
                  <View>
                    <View style={[ComponentStyles.marginSmallTopBottom,{flexDirection:'row', alignItems:'center', justifyContent:'space-between',}]}>
        		<Text style={[ComponentStyles.headerText]}>
        		Years
        		</Text>
        		<View>
        		{expYearsComponent}
        		</View>
        		</View>
                  </View>
                </View>
                <Separator/>
                <View style={[ComponentStyles.componentMargins, ComponentStyles.topMargin]}>
                  <Text style={[ComponentStyles.headerText]}>Have you worked at any educational Institute?</Text>
                  <View style={[ComponentStyles.topMargin, ComponentStyles.bottomMargin,{flexDirection:'row'}]}>
                    <View style={[{flexDirection: 'row', alignItems: 'center',}]}>
                      <MKRadioButton
                        checked={this.state.workedAtInstitute}
                        rippleDuration={100}
                        group={this.taughtAtInstituteRadioGroup}
                        onCheckedChange={this.onRadioCheckedChange.bind(this) }/>
                      <Text style={[ComponentStyles.contentText]}>Yes</Text>
                    </View>
                    <View style={[ComponentStyles.marginSmallRightLeft,{flexDirection: 'row', alignItems: 'center',}]}>
                      <MKRadioButton
                      checked = {!this.state.workedAtInstitute}
                      rippleDuration={100}
                      group={this.taughtAtInstituteRadioGroup}/>
                      <Text style={[ComponentStyles.contentText]}>No</Text>
                    </View>
                  </View>
                </View>
                <Separator/>
                <View style={[ComponentStyles.componentMargins,ComponentStyles.topMargin, ComponentStyles.bottomMargin]}>
                  <Text style={[ComponentStyles.headerText]}>In what languages can you teach ?</Text>              
                    <MultipleChoice
                      style={[{flex:1, height:300}]}
                      options={languagesList}
                      selectedOptions={this.state.languages}
                      maxSelectedOptions={0}
                      onSelection={this.onLanguageSelection.bind(this) }
                      />             
                </View>
                <Separator/>
    
                <View style={[
                  ComponentStyles.componentMargin,
                  ComponentStyles.marginLargeTopBottom,
                  {flexDirection: 'row', justifyContent: 'center',}]}>
                  <View style={[{marginRight:8}]}>
                    {cancelButton}
                  </View>
                  <View>
                    {saveButton}
                  </View>
                </View>
                <Spinner overlayColor="rgba(255,255,255, 0.45)" color="#ED1C24" visible={this.props.spinnerVisibilityObject.spinnerVisible && this.props.spinnerVisibilityObject.spinnerType === SpinnerTypes.SAVE_TEACHER_PREFERENCES}/>
              </View>
            </TouchableWithoutFeedback>
    
          </ScrollView>
    
    opened by niranjan-b-prajapati 1
  • Multiple instances of component with same values

    Multiple instances of component with same values

    When using multiple instances of the component with same values, then they are synchronised, so checking value a in instance, means it's also checked in instance b.

    opened by florianbepunkt 3
Owner
Dan
Full Stack Developer
Dan
A cross-platform (iOS / Android), selector/picker component for React Native that is highly customizable and supports sections.

react-native-modal-picker A cross-platform (iOS / Android), selector/picker component for React Native that is highly customizable and supports sectio

Dan 398 Nov 11, 2022
A cross-platform (iOS / Android), selector/picker component for React Native that is highly customizable and supports sections.

react-native-modal-selector A cross-platform (iOS / Android), selector/picker component for React Native that is highly customizable and supports sect

Peace 354 Dec 26, 2022
A Cross Platform(Android & iOS) ActionSheet with a flexible api, native performance and zero dependency code for react native. Create anything you want inside ActionSheet.

react-native-actions-sheet A highly customizable cross platform ActionSheet for react native. Screenshots Features Cross Platform (iOS and Android) Na

Ammar Ahmed 1000 Jan 9, 2023
React Native template for a quick start with React Navigation5 and TypeScript. It's cross-platform runs on Android, iOS, and the web.

对此项目的规划 出于兴趣把自己做 android、ios 开发过程中经验积累沉淀一下,此工程架构会定期更新升级依赖到最新版本,并不断的积累 App 中常用组件和基础页面功能,也会不断优化代码组织架构 此项目对以下情形会有帮助 想用前端技术做 app 开发却无从下手 想在项目中运用 typescrip

Benson 6 Dec 4, 2022
Cross Platform Material Alert and Prompt Dialogs for React Native. Imperative API, Android, IOS, Web

React Native Paper Alerts Cross Platform Material Alert and Prompt for React Native. It tries to follow the API and function signature of React Native

Arafat Zahan 13 Nov 21, 2022
A cross-platform (iOS / Android), full-featured, highly customizable web browser module for React Native apps.

react-native-webbrowser A cross-platform (iOS / Android), full-featured in-app web browser component for React Native that is highly customizable. Cur

Dan 196 Nov 23, 2022
A android like toast for android and ios, android use native toast, ios use UIView+Toast

React Native Toast (remobile) A android like toast for react-native support for ios and android Installation npm install @remobile/react-native-toast

YunJiang.Fang 345 Nov 11, 2022
🏞 react-native-multiple-image-picker enables applications to pick images and videos from multiple smart albums in iOS, similar to the current Facebook app.

React Native Multiple Image Picker (RNMIP) React Native Multiple Image Picker enables application to pick images and videos from multiple smart album

Baron Ha. 238 Dec 26, 2022
🗺 Open the map app of the user's choice.

An easy way to open a location in a map app of the user's choice, based on the apps they have installed on their device. Currently supported apps: App

Flexible Agency 538 Dec 21, 2022
Swiper/carousel component for React Native featuring previews, multiple layouts, parallax images, performant handling of huge numbers of items, and more. Compatible with Android & iOS.

react-native-snap-carousel ✨ Some great news for you, fellow plugin user! ?? Head over there now to learn more about all the goodness that's coming yo

Meliorence 9.8k Jan 5, 2023