11import React from 'react' ;
22import PropTypes from 'prop-types' ;
33import {
4- View , StyleSheet , Text , Image , TouchableOpacity
4+ View , StyleSheet , Text , Image , TouchableOpacity ,
5+ ScrollView ,
6+ Dimensions
57} from 'react-native' ;
68import { radioButton } from '../constant' ;
79
@@ -10,19 +12,27 @@ export default function Radio(props) {
1012 name, value, meta, onChangeInputValue, isMandatory
1113 } = props ;
1214
15+ const deviceWidth = Dimensions . get ( 'window' ) . width ;
1316 const onPress = value => ( ) => onChangeInputValue ( value ) ;
1417
1518 return (
1619 < View key = { name } style = { [ styles . container , props . style ] } >
1720 < Text style = { [ styles . heading , meta . headingStyle ] } > { `${ meta . text } ${ isMandatory ? '*' : '' } ` } </ Text >
18- < View style = { { flexDirection : meta . isHorizontal ? 'row' : 'column' , borderWidth :0 } } >
21+
22+ < ScrollView disabled = { meta . isScrollable ? false : true } horizontal = { meta . isHorizontal }
23+ showsHorizontalScrollIndicator = { false }
24+ style = { { borderWidth :0 , width :'100%' } }
25+ contentContainerStyle = { { width :'auto' } } >
26+
1927 { meta . data . map ( ( item , index ) => (
20- < View key = { index } style = { styles . radioContainer } >
28+ < View key = { index } style = { styles . radioContainer } >
29+
2130 < TouchableOpacity
2231 onPressIn = { onPress ( item . value || item . label ) }
2332 hitSlop = { styles . slop }
2433 style = { styles . buttonContainer }
2534 key = { index }
35+ disabled = { meta . disabled }
2636 >
2737 < Image
2838 accessibilityLabel = { `choose-option-${ item . label } ` }
@@ -37,7 +47,7 @@ export default function Radio(props) {
3747 </ TouchableOpacity >
3848 </ View >
3949 ) ) }
40- </ View >
50+ </ ScrollView >
4151 </ View >
4252 ) ;
4353}
0 commit comments