11import React , { Component } from 'react' ;
22import { View , StyleSheet , Alert , ScrollView } from 'react-native' ;
3- import { Colors , Text , FloatingButton , FloatingButtonLayouts } from 'react-native-ui-lib' ;
3+ import { Colors , Text , FloatingButton , FloatingButtonLayouts , Keyboard } from 'react-native-ui-lib' ;
44import { renderBooleanOption } from '../ExampleScreenPresenter' ;
55
66interface State {
77 showButton : boolean ;
88 showPrimary : boolean ;
99 showSecondary : boolean ;
1010 showVertical : boolean ;
11+ withTrackingView : boolean ;
1112}
1213
1314export default class FloatingButtonScreen extends Component < { } , State > {
@@ -16,7 +17,8 @@ export default class FloatingButtonScreen extends Component<{}, State> {
1617 showPrimary : true ,
1718 showSecondary : true ,
1819 showVertical : true ,
19- fullWidth : false
20+ fullWidth : false ,
21+ withTrackingView : false
2022 } ;
2123
2224 notNow = ( ) => {
@@ -30,7 +32,8 @@ export default class FloatingButtonScreen extends Component<{}, State> {
3032 } ;
3133
3234 render ( ) {
33- const { showSecondary, showVertical} = this . state ;
35+ const { showSecondary, showVertical, withTrackingView} = this . state ;
36+ const Container = withTrackingView ? Keyboard . KeyboardTrackingView : React . Fragment ;
3437 return (
3538 < View style = { styles . container } >
3639 < Text text60 center $textDefault marginB-s4 >
@@ -41,6 +44,7 @@ export default class FloatingButtonScreen extends Component<{}, State> {
4144 { renderBooleanOption . call ( this , 'Show Primary Button' , 'showPrimary' ) }
4245 { renderBooleanOption . call ( this , 'Show Secondary Button' , 'showSecondary' ) }
4346 { renderBooleanOption . call ( this , 'Button Layout Vertical' , 'showVertical' ) }
47+ { renderBooleanOption . call ( this , 'With tracking view' , 'withTrackingView' ) }
4448
4549 < ScrollView showsVerticalScrollIndicator = { false } >
4650 < View paddingT-20 >
@@ -67,30 +71,32 @@ export default class FloatingButtonScreen extends Component<{}, State> {
6771 </ View >
6872 </ ScrollView >
6973
70- < FloatingButton
71- visible = { this . state . showButton }
72- fullWidth = { this . state . fullWidth }
73- button = {
74- this . state . showPrimary
75- ? {
76- label : 'Approve' ,
77- onPress : this . close
78- }
79- : undefined
80- }
81- secondaryButton = {
82- showSecondary
83- ? {
84- label : 'Not now' ,
85- onPress : this . notNow
86- }
87- : undefined
88- }
89- buttonLayout = { showVertical ? FloatingButtonLayouts . VERTICAL : FloatingButtonLayouts . HORIZONTAL }
90- // bottomMargin={80}
91- // hideBackgroundOverlay
92- // withoutAnimation
93- />
74+ < Container >
75+ < FloatingButton
76+ visible = { this . state . showButton }
77+ fullWidth = { this . state . fullWidth }
78+ button = {
79+ this . state . showPrimary
80+ ? {
81+ label : 'Approve' ,
82+ onPress : this . close
83+ }
84+ : undefined
85+ }
86+ secondaryButton = {
87+ showSecondary
88+ ? {
89+ label : 'Not now' ,
90+ onPress : this . notNow
91+ }
92+ : undefined
93+ }
94+ buttonLayout = { showVertical ? FloatingButtonLayouts . VERTICAL : FloatingButtonLayouts . HORIZONTAL }
95+ // bottomMargin={80}
96+ // hideBackgroundOverlay
97+ // withoutAnimation
98+ />
99+ </ Container >
94100 </ View >
95101 ) ;
96102 }
0 commit comments