Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 16 additions & 2 deletions example/src/Examples/BannerExample.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ const PHOTOS = Array.from({ length: 24 }).map(
const BannerExample = () => {
const [visible, setVisible] = React.useState<boolean>(true);
const [useCustomTheme, setUseCustomTheme] = React.useState<boolean>(false);
const [urgent, setUrgent] = React.useState<boolean>(false);
const defaultTheme = useTheme();

const [height, setHeight] = React.useState(0);
Expand Down Expand Up @@ -52,8 +53,14 @@ const BannerExample = () => {
</View>
</ScreenWrapper>
<FAB icon="eye" style={styles.fab} onPress={() => setVisible(!visible)} />
<FAB
icon="alert"
style={styles.urgentFab}
onPress={() => setUrgent(!urgent)}
/>
<Banner
onLayout={handleLayout}
urgent={urgent}
actions={[
{
label: `Set ${useCustomTheme ? 'default' : 'custom'} theme`,
Expand All @@ -75,8 +82,9 @@ const BannerExample = () => {
theme={useCustomTheme ? customTheme : defaultTheme}
style={styles.banner}
>
Two line text string with two actions. One to two lines is preferable on
mobile.
{urgent
? 'Urgent: this message interrupts the screen reader.'
: 'Two line text string with two actions. One to two lines is preferable on mobile.'}
</Banner>
</>
);
Expand Down Expand Up @@ -128,6 +136,12 @@ const styles = StyleSheet.create({
bottom: 0,
margin: 16,
},
urgentFab: {
alignSelf: 'flex-end',
position: 'absolute',
bottom: 0,
margin: 16,
},
});

export default BannerExample;
Loading