({ navigation }: Props)
| 42 | ]; |
| 43 | |
| 44 | const TooltipExample = ({ navigation }: Props) => { |
| 45 | const [textAlign, setTextAlign] = React.useState('bold'); |
| 46 | React.useLayoutEffect(() => { |
| 47 | navigation.setOptions({ |
| 48 | header: () => ( |
| 49 | <Appbar.Header elevated> |
| 50 | <Tooltip title="Go back"> |
| 51 | <Appbar.BackAction onPress={() => navigation.goBack()} /> |
| 52 | </Tooltip> |
| 53 | <Appbar.Content title="Tooltips" /> |
| 54 | <Tooltip title="Print ⌘ + P"> |
| 55 | <Appbar.Action icon="printer" onPress={() => {}} /> |
| 56 | </Tooltip> |
| 57 | <Tooltip title="Search"> |
| 58 | <Appbar.Action icon="magnify" onPress={() => {}} /> |
| 59 | </Tooltip> |
| 60 | <Tooltip title="More options"> |
| 61 | <Appbar.Action icon={MORE_ICON} onPress={() => {}} /> |
| 62 | </Tooltip> |
| 63 | </Appbar.Header> |
| 64 | ), |
| 65 | }); |
| 66 | }); |
| 67 | |
| 68 | return ( |
| 69 | <> |
| 70 | <ScreenWrapper> |
| 71 | <Banner visible> |
| 72 | A tooltip is displayed upon |
| 73 | {!isWeb |
| 74 | ? ' tapping and holding a screen element or component' |
| 75 | : ' hovering over a screen element or component'} |
| 76 | . Continuously display the tooltip as long as the user long-presses or |
| 77 | hovers over the element. |
| 78 | </Banner> |
| 79 | <List.Section title="Icon Buttons"> |
| 80 | <View style={styles.iconButtonContainer}> |
| 81 | {formOfTransport.map((transport, index) => ( |
| 82 | <Tooltip |
| 83 | key={index} |
| 84 | title={transport.title} |
| 85 | enterTouchDelay={transport.enterTouchDelay} |
| 86 | leaveTouchDelay={transport.leaveTouchDelay} |
| 87 | > |
| 88 | <IconButton |
| 89 | icon={transport.title.split(' ')[0].toLowerCase()} |
| 90 | size={24} |
| 91 | onPress={() => {}} |
| 92 | /> |
| 93 | </Tooltip> |
| 94 | ))} |
| 95 | </View> |
| 96 | </List.Section> |
| 97 | <List.Section title="Toggle Buttons"> |
| 98 | <ToggleButton.Row |
| 99 | value={textAlign} |
| 100 | style={styles.toggleButtonRow} |
| 101 | onValueChange={setTextAlign} |
nothing calls this directly
no outgoing calls
no test coverage detected
searching dependent graphs…