UNPKG

crn-cli

Version:

The Ctrip React Native CLI Tools

1 lines 2.02 kB
__d(function(g,r,i,a,m,e,d){'use strict';var t=r(d[0]),n=r(d[1]),o=r(d[2]),l=r(d[3]),s=r(d[4]),u=r(d[5]),c=r(d[6]),p=c.KeyboardAvoidingView,h=c.Modal,y=c.SegmentedControlIOS,f=c.StyleSheet,v=c.Text,b=c.TextInput,E=c.TouchableHighlight,x=c.View,w=r(d[7]),C=r(d[8]),S=(function(c){function f(){var n,s;t(this,f);for(var c=arguments.length,w=new Array(c),C=0;C<c;C++)w[C]=arguments[C];return(s=o(this,(n=l(f)).call.apply(n,[this].concat(w)))).state={behavior:'padding',modalOpen:!1},s.onSegmentChange=function(t){s.setState({behavior:t.toLowerCase()})},s.renderExample=function(){return u.createElement(x,{style:I.outerContainer},u.createElement(h,{animationType:"fade",visible:s.state.modalOpen},u.createElement(p,{behavior:s.state.behavior,style:I.container},u.createElement(y,{onValueChange:s.onSegmentChange,selectedIndex:'padding'===s.state.behavior?0:1,style:I.segment,values:['Padding','Position']}),u.createElement(b,{placeholder:"<TextInput />",style:I.textInput})),u.createElement(E,{onPress:function(){return s.setState({modalOpen:!1})},style:I.closeButton},u.createElement(v,null,"Close"))),u.createElement(E,{onPress:function(){return s.setState({modalOpen:!0})}},u.createElement(v,null,"Open Example")))},s}return s(f,c),n(f,[{key:"render",value:function(){return u.createElement(C,{title:"Keyboard Avoiding View"},u.createElement(w,{title:"Keyboard-avoiding views move out of the way of the keyboard."},this.renderExample()))}}]),f})(u.Component),I=f.create({outerContainer:{flex:1},container:{flex:1,justifyContent:'center',paddingHorizontal:20,paddingTop:20},textInput:{borderRadius:5,borderWidth:1,height:44,paddingHorizontal:10},segment:{marginBottom:10},closeButton:{position:'absolute',top:30,left:10}});e.title='<KeyboardAvoidingView>',e.description='Base component for views that automatically adjust their height or position to move out of the way of the keyboard.',e.examples=[{title:'Simple keyboard view',render:function(){return u.createElement(S,null)}}]},666712,[3,4,5,8,9,54,15,666679,666681]);