11import React , { Component } from 'react' ;
22import { View , StyleSheet , Alert , ScrollView } from 'react-native' ;
3- import { Colors , Text , FloatingButton , FloatingButtonLayouts , Keyboard } from 'react-native-ui-lib' ;
3+ import { SafeAreaProvider } from 'react-native-safe-area-context' ;
4+ import { Colors , Text , TextField , FloatingButton , FloatingButtonLayouts } from 'react-native-ui-lib' ;
45import { renderBooleanOption } from '../ExampleScreenPresenter' ;
56
67interface State {
78 showButton : boolean ;
89 showPrimary : boolean ;
910 showSecondary : boolean ;
1011 showVertical : boolean ;
11- withTrackingView : boolean ;
12+ hoisted : boolean ;
1213}
1314
1415export default class FloatingButtonScreen extends Component < { } , State > {
@@ -18,7 +19,7 @@ export default class FloatingButtonScreen extends Component<{}, State> {
1819 showSecondary : true ,
1920 showVertical : true ,
2021 fullWidth : false ,
21- withTrackingView : false
22+ hoisted : true
2223 } ;
2324
2425 notNow = ( ) => {
@@ -32,72 +33,68 @@ export default class FloatingButtonScreen extends Component<{}, State> {
3233 } ;
3334
3435 render ( ) {
35- const { showSecondary, showVertical, withTrackingView} = this . state ;
36- const Container = withTrackingView ? Keyboard . KeyboardTrackingView : React . Fragment ;
36+ const { showSecondary, showVertical, hoisted} = this . state ;
3737 return (
38- < View style = { styles . container } >
39- < Text text60 center $textDefault marginB-s4 >
40- Trigger Floating Button
41- </ Text >
42- { renderBooleanOption . call ( this , 'Show Floating Button' , 'showButton' ) }
43- { renderBooleanOption . call ( this , 'Full Width Button' , 'fullWidth' ) }
44- { renderBooleanOption . call ( this , 'Show Primary Button' , 'showPrimary' ) }
45- { renderBooleanOption . call ( this , 'Show Secondary Button' , 'showSecondary' ) }
46- { renderBooleanOption . call ( this , 'Button Layout Vertical' , 'showVertical' ) }
47- { renderBooleanOption . call ( this , 'With tracking view' , 'withTrackingView' ) }
38+ < SafeAreaProvider >
39+ < View style = { styles . container } >
40+ < Text text60 center $textDefault marginB-s4 >
41+ Trigger Floating Button
42+ </ Text >
43+ { renderBooleanOption . call ( this , 'Show Floating Button' , 'showButton' ) }
44+ { renderBooleanOption . call ( this , 'Full Width Button' , 'fullWidth' ) }
45+ { renderBooleanOption . call ( this , 'Show Primary Button' , 'showPrimary' ) }
46+ { renderBooleanOption . call ( this , 'Show Secondary Button' , 'showSecondary' ) }
47+ { renderBooleanOption . call ( this , 'Button Layout Vertical' , 'showVertical' ) }
48+ { renderBooleanOption . call ( this , 'Hoisted (keyboard-aware)' , 'hoisted' ) }
4849
49- < ScrollView showsVerticalScrollIndicator = { false } >
50- < View paddingT-20 >
51- < Text text70 $textDefault style = { { fontWeight : 'bold' } } >
52- Scroll behind a FloatingButton
53- </ Text >
54- < Text text80 $textDefault marginT-10 style = { { lineHeight : 24 } } >
55- Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the
56- industry standard dummy text ever since the 1500s, when an unknown printer took a galley of type and
57- scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into
58- electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release
59- of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software
60- like Aldus PageMaker including versions of Lorem Ipsum. Contrary to popular belief, Lorem Ipsum is not
61- simply random text. It has roots in a piece of classical Latin literature from 45 BC, making it over 2000
62- years old. Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been
63- the industry standard dummy text ever since the 1500s, when an unknown printer took a galley of type and
64- scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into
65- electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release
66- of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software
67- like Aldus PageMaker including versions of Lorem Ipsum. Contrary to popular belief, Lorem Ipsum is not
68- simply random text. It has roots in a piece of classical Latin literature from 45 BC, making it over 2000
69- years old.
70- </ Text >
71- </ View >
72- </ ScrollView >
50+ < TextField migrate placeholder = "Tap to test keyboard hoisting" marginB-s4 />
51+
52+ < ScrollView
53+ showsVerticalScrollIndicator = { false }
54+ keyboardDismissMode = "on-drag"
55+ keyboardShouldPersistTaps = "handled"
56+ >
57+ < View paddingT-20 >
58+ < Text text70 $textDefault style = { { fontWeight : 'bold' } } >
59+ Scroll behind a FloatingButton
60+ </ Text >
61+ < Text text80 $textDefault marginT-10 style = { { lineHeight : 24 } } >
62+ Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the
63+ industry standard dummy text ever since the 1500s, when an unknown printer took a galley of type and
64+ scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap
65+ into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the
66+ release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing
67+ software like Aldus PageMaker including versions of Lorem Ipsum. Contrary to popular belief, Lorem Ipsum
68+ is not simply random text. It has roots in a piece of classical Latin literature from 45 BC, making it
69+ over 2000 years old.
70+ </ Text >
71+ </ View >
72+ </ ScrollView >
7373
74- < Container >
7574 < FloatingButton
7675 visible = { this . state . showButton }
7776 fullWidth = { this . state . fullWidth }
7877 button = {
7978 this . state . showPrimary
8079 ? {
81- label : 'Approve' ,
82- onPress : this . close
83- }
80+ label : 'Approve' ,
81+ onPress : this . close
82+ }
8483 : undefined
8584 }
8685 secondaryButton = {
8786 showSecondary
8887 ? {
89- label : 'Not now' ,
90- onPress : this . notNow
91- }
88+ label : 'Not now' ,
89+ onPress : this . notNow
90+ }
9291 : undefined
9392 }
9493 buttonLayout = { showVertical ? FloatingButtonLayouts . VERTICAL : FloatingButtonLayouts . HORIZONTAL }
95- // bottomMargin={80}
96- // hideBackgroundOverlay
97- // withoutAnimation
94+ hoisted = { hoisted }
9895 />
99- </ Container >
100- </ View >
96+ </ View >
97+ </ SafeAreaProvider >
10198 ) ;
10299 }
103100}
0 commit comments