|
2 | 2 |
|
3 | 3 | import * as React from 'react';
|
4 | 4 | import { View, StyleSheet } from 'react-native';
|
5 |
| -import { Colors, FAB, withTheme } from 'react-native-paper'; |
| 5 | +import { Colors, FAB, Portal, withTheme } from 'react-native-paper'; |
6 | 6 | import type { Theme } from 'react-native-paper/types';
|
7 | 7 |
|
8 | 8 | type Props = {
|
@@ -38,22 +38,24 @@ class ButtonExample extends React.Component<Props, State> {
|
38 | 38 | style={styles.fab}
|
39 | 39 | onPress={() => {}}
|
40 | 40 | />
|
41 |
| - <FAB.Group |
42 |
| - open={this.state.open} |
43 |
| - icon={this.state.open ? 'today' : 'add'} |
44 |
| - actions={[ |
45 |
| - { icon: 'add', onPress: () => {} }, |
46 |
| - { icon: 'star', label: 'Star', onPress: () => {} }, |
47 |
| - { icon: 'email', label: 'Email', onPress: () => {} }, |
48 |
| - { icon: 'notifications', label: 'Remind', onPress: () => {} }, |
49 |
| - ]} |
50 |
| - onStateChange={({ open }) => this.setState({ open })} |
51 |
| - onPress={() => { |
52 |
| - if (this.state.open) { |
53 |
| - // do something if the speed dial is open |
54 |
| - } |
55 |
| - }} |
56 |
| - /> |
| 41 | + <Portal> |
| 42 | + <FAB.Group |
| 43 | + open={this.state.open} |
| 44 | + icon={this.state.open ? 'today' : 'add'} |
| 45 | + actions={[ |
| 46 | + { icon: 'add', onPress: () => {} }, |
| 47 | + { icon: 'star', label: 'Star', onPress: () => {} }, |
| 48 | + { icon: 'email', label: 'Email', onPress: () => {} }, |
| 49 | + { icon: 'notifications', label: 'Remind', onPress: () => {} }, |
| 50 | + ]} |
| 51 | + onStateChange={({ open }) => this.setState({ open })} |
| 52 | + onPress={() => { |
| 53 | + if (this.state.open) { |
| 54 | + // do something if the speed dial is open |
| 55 | + } |
| 56 | + }} |
| 57 | + /> |
| 58 | + </Portal> |
57 | 59 | </View>
|
58 | 60 | </View>
|
59 | 61 | );
|
|
0 commit comments